providers: providerCollection);
var shouldExit = new ManualResetEvent(false);
+ var terminated = false;
ulong sessionId = 0;
using (Stream stream = EventPipeClient.CollectTracing(processId, configuration, out sessionId))
Debug.WriteLine($"PACKET: {Convert.ToBase64String(buffer, 0, nBytesRead)} (bytes {nBytesRead})");
}
+ terminated = true;
+ shouldExit.Set();
}
});
collectingTask.Start();
while (!Console.KeyAvailable && !shouldExit.WaitOne(250)) { }
} while (!shouldExit.WaitOne(0) && Console.ReadKey(true).Key != ConsoleKey.Enter);
- EventPipeClient.StopTracing(processId, sessionId);
+ if (!terminated)
+ {
+ EventPipeClient.StopTracing(processId, sessionId);
+ }
collectingTask.Wait();
}