Skip to content

Use inbox TaskToAsyncResult class and remove TaskToApm. - #68139

Merged
BrennanConroy merged 1 commit into
dotnet:mainfrom
teo-tsirpanis:task-to-asyncresult
Jul 31, 2026
Merged

BrennanConroy merged 1 commit into
dotnet:mainfrom
teo-tsirpanis:task-to-asyncresult

Conversation

@teo-tsirpanis

Copy link
Copy Markdown
Contributor

Description

Removes the TaskToApm utility class, and replaces its uses with the TaskToAsyncResult class, available since .NET 8.

Copilot AI review requested due to automatic review settings July 31, 2026 16:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the repo-local TaskToApm helper and switches APM (Begin/End) stream overrides across shared infrastructure, servers, and middleware to use the framework-provided System.Threading.Tasks.TaskToAsyncResult (available in .NET 8+), reducing shared code duplication.

Changes:

  • Deleted src/Shared/TaskToApm.cs and removed all project inclusions of it.
  • Updated Stream BeginRead/EndRead and BeginWrite/EndWrite implementations to use TaskToAsyncResult.
  • Cleaned up affected .csproj files to stop linking/compiling the removed shared source.

Reviewed changes

Copilot reviewed 32 out of 32 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Shared/test/Shared.Tests/Microsoft.AspNetCore.Shared.Tests.csproj Stops compiling the removed TaskToApm shared source into Shared.Tests.
src/Shared/TaskToApm.cs Removes the repo-local Task-to-APM adapter implementation.
src/Shared/ServerInfrastructure/DuplexPipeStream.cs Switches APM read/write wrappers to TaskToAsyncResult.
src/Shared/SegmentWriteStream.cs Switches APM write wrappers to TaskToAsyncResult.
src/Servers/Kestrel/Transport.Quic/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.csproj Removes linked compile item for TaskToApm.cs.
src/Servers/Kestrel/samples/http2cat/http2cat.csproj Removes linked compile item for TaskToApm.cs.
src/Servers/Kestrel/Core/src/Middleware/Internal/LoggingStream.cs Switches APM read/write wrappers to TaskToAsyncResult.
src/Servers/Kestrel/Core/src/Microsoft.AspNetCore.Server.Kestrel.Core.csproj Removes linked compile item for TaskToApm.cs.
src/Servers/Kestrel/Core/src/Internal/Http/HttpResponseStream.cs Switches APM write wrappers to TaskToAsyncResult.
src/Servers/Kestrel/Core/src/Internal/Http/HttpRequestStream.cs Switches APM read wrappers to TaskToAsyncResult.
src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/IISExpress.FunctionalTests.csproj Removes linked compile item for TaskToApm.cs.
src/Servers/IIS/IIS/test/IIS.ShadowCopy.Tests/IIS.ShadowCopy.Tests.csproj Removes linked compile item for TaskToApm.cs.
src/Servers/IIS/IIS/test/IIS.NewShim.FunctionalTests/IIS.NewShim.FunctionalTests.csproj Removes linked compile item for TaskToApm.cs.
src/Servers/IIS/IIS/test/IIS.NewHandler.FunctionalTests/IIS.NewHandler.FunctionalTests.csproj Removes linked compile item for TaskToApm.cs.
src/Servers/IIS/IIS/test/IIS.LongTests/IIS.LongTests.csproj Removes linked compile item for TaskToApm.cs.
src/Servers/IIS/IIS/test/IIS.FunctionalTests/IIS.FunctionalTests.csproj Removes linked compile item for TaskToApm.cs.
src/Servers/IIS/IIS/src/Microsoft.AspNetCore.Server.IIS.csproj Removes linked compile item for TaskToApm.cs.
src/Servers/IIS/IIS/src/Core/HttpResponseStream.cs Switches APM write wrappers to TaskToAsyncResult.
src/Servers/IIS/IIS/src/Core/HttpRequestStream.cs Switches APM read wrappers to TaskToAsyncResult.
src/Servers/HttpSys/src/ResponseStream.cs Switches APM write wrappers to TaskToAsyncResult.
src/Servers/HttpSys/src/RequestProcessing/ResponseBody.cs Switches APM write wrappers to TaskToAsyncResult.
src/Servers/HttpSys/src/RequestProcessing/RequestStream.cs Switches APM read wrappers to TaskToAsyncResult.
src/Servers/HttpSys/src/Microsoft.AspNetCore.Server.HttpSys.csproj Stops compiling the removed TaskToApm shared source.
src/Middleware/ResponseCompression/src/ResponseCompressionBody.cs Switches APM write wrappers to TaskToAsyncResult.
src/Middleware/ResponseCompression/src/Microsoft.AspNetCore.ResponseCompression.csproj Removes linked compile item for TaskToApm.cs.
src/Middleware/ResponseCaching/src/Streams/ResponseCachingStream.cs Switches APM write wrappers to TaskToAsyncResult.
src/Middleware/ResponseCaching/src/Microsoft.AspNetCore.ResponseCaching.csproj Removes linked compile item for TaskToApm.cs.
src/Middleware/OutputCaching/src/Streams/OutputCacheStream.cs Switches APM write wrappers to TaskToAsyncResult.
src/Middleware/OutputCaching/src/Microsoft.AspNetCore.OutputCaching.csproj Removes linked compile item for TaskToApm.cs.
src/Middleware/HttpLogging/src/ResponseBufferingStream.cs Switches APM write wrappers to TaskToAsyncResult.
src/Middleware/HttpLogging/src/RequestBufferingStream.cs Switches APM read wrappers to TaskToAsyncResult.
src/Middleware/HttpLogging/src/Microsoft.AspNetCore.HttpLogging.csproj Removes linked compile item for TaskToApm.cs.

@BrennanConroy
BrennanConroy merged commit 4061277 into dotnet:main Jul 31, 2026
28 checks passed
@teo-tsirpanis
teo-tsirpanis deleted the task-to-asyncresult branch July 31, 2026 18:41
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc1 milestone Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants