-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Remove APM use outside of TaskHost node provider / endpoint #11800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ccastanedaucf
wants to merge
1
commit into
dotnet:main
Choose a base branch
from
ccastanedaucf:dev/chcasta/dead-ifdefs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+17
−151
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -21,7 +21,7 @@ | |||||||
using System.Security.Principal; | ||||||||
|
||||||||
#endif | ||||||||
#if NET451_OR_GREATER || NETCOREAPP | ||||||||
#if !TASKHOST | ||||||||
using System.Threading.Tasks; | ||||||||
#endif | ||||||||
|
||||||||
|
@@ -368,7 +368,7 @@ private void PacketPumpProc() | |||||||
try | ||||||||
{ | ||||||||
// Wait for a connection | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nitpick] Ensure that TASKHOST is defined only for TaskHost scenarios since it now controls the use of legacy APM code in this section.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||
#if FEATURE_APM | ||||||||
#if TASKHOST | ||||||||
IAsyncResult resultForConnection = localPipeServer.BeginWaitForConnection(null, null); | ||||||||
CommunicationsUtilities.Trace("Waiting for connection {0} ms...", waitTimeRemaining); | ||||||||
bool connected = resultForConnection.AsyncWaitHandle.WaitOne(waitTimeRemaining, false); | ||||||||
|
@@ -385,7 +385,7 @@ private void PacketPumpProc() | |||||||
} | ||||||||
|
||||||||
CommunicationsUtilities.Trace("Parent started connecting. Reading handshake from parent"); | ||||||||
#if FEATURE_APM | ||||||||
#if TASKHOST | ||||||||
localPipeServer.EndWaitForConnection(resultForConnection); | ||||||||
#endif | ||||||||
|
||||||||
|
@@ -521,9 +521,7 @@ private void RunReadLoop(BufferedReadStream localReadPipe, NamedPipeServerStream | |||||||
// spammed to the endpoint and it never gets an opportunity to shutdown. | ||||||||
CommunicationsUtilities.Trace("Entering read loop."); | ||||||||
byte[] headerByte = new byte[5]; | ||||||||
#if NET451_OR_GREATER | ||||||||
Task<int> readTask = localReadPipe.ReadAsync(headerByte, 0, headerByte.Length, CancellationToken.None); | ||||||||
#elif NETCOREAPP | ||||||||
#if !TASKHOST | ||||||||
Task<int> readTask = CommunicationsUtilities.ReadAsync(localReadPipe, headerByte, headerByte.Length).AsTask(); | ||||||||
#else | ||||||||
IAsyncResult result = localReadPipe.BeginRead(headerByte, 0, headerByte.Length, null, null); | ||||||||
|
@@ -533,7 +531,7 @@ private void RunReadLoop(BufferedReadStream localReadPipe, NamedPipeServerStream | |||||||
// packets to be sent by other threads which are shutting down, such as the logging thread. | ||||||||
WaitHandle[] handles = new WaitHandle[] | ||||||||
{ | ||||||||
#if NET451_OR_GREATER || NETCOREAPP | ||||||||
#if !TASKHOST | ||||||||
((IAsyncResult)readTask).AsyncWaitHandle, | ||||||||
#else | ||||||||
result.AsyncWaitHandle, | ||||||||
|
@@ -553,7 +551,7 @@ private void RunReadLoop(BufferedReadStream localReadPipe, NamedPipeServerStream | |||||||
int bytesRead = 0; | ||||||||
try | ||||||||
{ | ||||||||
#if NET451_OR_GREATER || NETCOREAPP | ||||||||
#if !TASKHOST | ||||||||
bytesRead = readTask.Result; | ||||||||
#else | ||||||||
bytesRead = localReadPipe.EndRead(result); | ||||||||
|
@@ -613,17 +611,11 @@ private void RunReadLoop(BufferedReadStream localReadPipe, NamedPipeServerStream | |||||||
break; | ||||||||
} | ||||||||
|
||||||||
#if NET451_OR_GREATER | ||||||||
readTask = localReadPipe.ReadAsync(headerByte, 0, headerByte.Length, CancellationToken.None); | ||||||||
#elif NETCOREAPP | ||||||||
#if !TASKHOST | ||||||||
readTask = CommunicationsUtilities.ReadAsync(localReadPipe, headerByte, headerByte.Length).AsTask(); | ||||||||
#else | ||||||||
result = localReadPipe.BeginRead(headerByte, 0, headerByte.Length, null, null); | ||||||||
#endif | ||||||||
|
||||||||
#if NET451_OR_GREATER || NETCOREAPP | ||||||||
handles[0] = ((IAsyncResult)readTask).AsyncWaitHandle; | ||||||||
#else | ||||||||
result = localReadPipe.BeginRead(headerByte, 0, headerByte.Length, null, null); | ||||||||
handles[0] = result.AsyncWaitHandle; | ||||||||
#endif | ||||||||
} | ||||||||
|
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider adding an inline comment here to clarify that '!TASKHOST' triggers TPL-based concurrency and that APM logic is reserved for TaskHost builds.
Copilot uses AI. Check for mistakes.