Using the following console program, I expected to see no mention of M1 or M4 in the profiling results (becase profiling should have been paused when those methods were called). However, M1, M2, M3, M4 and M4 were all shown as taking about 500ms to execute.
Is it possible to pause the profiler when using SelfAttach.Attach? If it's not possible, how do I turn this into a feature request?
The reason I'm trying to do this, is because I've deteced that my UI thread is blocked for too long so I want to turn on the profiler to recored what's happening. When the UI threads is unblocked again, I want to pause profiling until next time I detect that it's blocked.
var config = new OpenProfilingConfig()
ProfilingControlKind = ProfilingControlKind.API,
RedistPath = @"C:\Program Files (x86)\JetBrains\dotTrace\Profiler SDK v5\Redist"
// Give profiler a chance to setup
Console.WriteLine("Press Enter when the profiler is ready");
Console.WriteLine("Press Enter to exit");