I have a C # web server that I have profiled using the StackOverflow mini filter. Since this is not an ASP.NET server, but each request was usually executed in its own thread, I linked the miniprofile to using the ThreadStatic repository to track all the profilers of the incoming request from beginning to end. It works well.
Recently, we have converted everything to use async/await , which means that continuations after await usually do not return to the same Thread and therefore the ThreadStatic repository no longer works.
What is the best way to transfer a small piece of data between different ThreadPool threads in this case? Are there existing SynchronizationContext implementations that would be useful for something like this?
multithreading c # async-await miniprofiler
Cuthbert
source share