in JetBrains.Profiler.SelfApi/src/DotTrace.cs [272:289]
public static void Detach()
{
lock (Mutex)
{
if (_session == null)
throw new InvalidOperationException("The profiling session is not active: Did you call Attach()?");
try
{
_session.Detach().AwaitFinished();
_collectedSnapshots = _session.GetCollectedSnapshotsIndexFiles();
}
finally
{
_session = null;
}
}
}