-
Notifications
You must be signed in to change notification settings - Fork 790
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
AsyncLocal diagnostics, clean slate #16779
Conversation
❗ Release notes required
|
This reverts commit 8c77c0c.
I think this is good for a review now. |
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.
Okay so I finally gathered some mental resources for reviewing this :)
I added a few remarks and questions mostly for my understanding. Overall these are good changes since removing custom CEs reduces cognitive load of the code. Also I think it's a good moment to get this in.
Thanks!
ah, ok I'm seeing the issue now. |
We used
node
CE, a customizedasync
CE variant to ensureDiagnosticsThreadStatics
flow from thread to thread along with the execution of asynchronous compiler tasks.AsyncLocal<'T>
achieves this without the need for a specialized CE.from documetation:
This allows us to just remove
NodeCode
and replacenode
expressions withasync
.Tests show
AsyncLocal
works as expected in scenarios involvingtask
,async
,Async.SwitchToNewThread()
SwitchToThreadPool()
,Thread.Start()
as well as TPL parallel execution.MultipleDiagnosticsLoggers.Parallel
generally for use in place ofNodeCode.Parallel
. Replays diagnostics onto caller's logger preserving the given order of computations.MultipleDiagnosticsLoggers.Sequential
replacesNodeCode.Parallel
. UnlikeAsync.Sequential
it starts immediately on the same thread so It automatically uses caller's diagnostics context.AsyncLocal
diagnostics flow in async and sync contexts.Previous attempts: #16602, #16645