Search code examples
jetbrains-idedottrace

dotTrace API profiling not saving snapshots


I am trying to profile a method using the JetBrains Profiler API (JetBrains.Profiler.Api 1.1.8). The workflow is:

  • launch application
  • get application to a point where I want to profile
  • launch dotTrace and start it with the following settings
  • dotTrace settings
  • the profiling task bar shows that the session is running

I have tried both of the following code snippets

MeasureProfiler.StartCollectingData();
SomeLongRunningMethod();
MeasureProfiler.SaveData();

.
..
...

MeasureProfiler.StartCollectingData();
SomeLongRunningMethod();
MeasureProfiler.StopCollectingData();
MeasureProfiler.SaveData();

the method executes but I can't see the snapshot anywhere on disk or in dotTrace snapshots. What am I missing?


Solution

  • this was a user error on my end. I used the JetBrains.Profiler.Api which requires you to launch dotTrace before hand and attach accordingly using the API switches. Once I did that, traces showed up as they were supposed to. They also have a JetBrains.Profiler.SelfApi package which can capture traces without attaching to dotTrace beforehand.