Repository navigation
Use inbox TaskToAsyncResult class and remove TaskToApm. - #68139
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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.csand removed all project inclusions of it. - Updated Stream
BeginRead/EndReadandBeginWrite/EndWriteimplementations to useTaskToAsyncResult. - Cleaned up affected
.csprojfiles 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
approved these changes
Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Removes the
TaskToApmutility class, and replaces its uses with theTaskToAsyncResultclass, available since .NET 8.