I`m currently profiling my application with dotTrace Timeline. I found that a lot of time is spent in GC, which is expected, but what is not expected is that I see a lot of time user threads are suspended during Background collection.
profiler screenshots :
From image I see that I have two threads doing some CPU bound work, then 'Background' GC occur, and first thread is suspended a bit later and second suspended immediately.
You can see that user threads indeed are blocked by Garbage collector thread.
I know there could be foreground blocking GC of Gen 0 and Gen 1 during background GC. But this is not a case since all GC is on Gen 2.
I created basic reproduction solution on github: https://github.com/isaevdan/BackgroundGCSuspendsThreads