-
Notifications
You must be signed in to change notification settings - Fork 386
Closed
dotnet/docs
#29245Description
Description
Unhandled exception in a program results in a broken trace collected by dotnet-trace. (If I catch the exception, the produced trace is OK)
Steps to reproduce:
- Run a program via
dotnet run -c release - Start collecting the trace via
dotnet-trace collect -p <PID> - At some point the program throws an unhandled exception and exits
dotnet-traceexits too, saysTrace completed.and produces a trace file
However, that trace file would be broken.
When trying to open it in PerfView, the error is
[ERROR: processing events ****]
***** Consider using /ContinueOnError to ignore the bad part of the trace. *****
Error: Exception EventPipe conversion: System.Exception: Read past end of stream.
at FastSerialization.IOStreamStreamReader.Fill(Int32 minimum)
at FastSerialization.MemoryStreamReader.ReadByte()
at FastSerialization.Deserializer.ReadObject()
at Microsoft.Diagnostics.Tracing.EventPipeEventSource.Process()
at Microsoft.Diagnostics.Tracing.Etlx.TraceLog.CopyRawEvents(TraceEventDispatcher rawEvents, IStreamWriter writer)
at Microsoft.Diagnostics.Tracing.Etlx.TraceLog.<>c__DisplayClass120_0.<FastSerialization.IFastSerializable.ToStream>b__0()
at FastSerialization.DeferedRegion.Write(Serializer serializer, Action toStream)
at Microsoft.Diagnostics.Tracing.Etlx.TraceLog.FastSerialization.IFastSerializable.ToStream(Serializer serializer)
at FastSerialization.Serializer.WriteObjectData(IFastSerializable obj, Tags beginTag)
at FastSerialization.Serializer.WriteObjectRef(IFastSerializable obj, Boolean defered)
at FastSerialization.Serializer..ctor(IStreamWriter writer, IFastSerializable entryObject)
at Microsoft.Diagnostics.Tracing.Etlx.TraceLog.CreateFromEventPipeEventSources(TraceEventDispatcher source, String etlxFilePath, TraceLogOptions options)
at Microsoft.Diagnostics.Tracing.Etlx.TraceLog.CreateFromEventPipeDataFile(String filePath, String etlxFilePath, TraceLogOptions options)
at PerfView.EventPipePerfViewData.GetTraceLog(TextWriter log, Action`3 onLostEvents)
[Error: exception while opening EventPipe data.]
When trying to convert it to Speedscope format, via dotnet-trace convert, it would say
Detected a potentially broken trace. Continuing with best-efforts to convert the trace, but resulting speedscope file may contain broken stacks as a result.
and produce an empty result.
Configuration
OS: Windows 11
dotnet-trace version: 6.0.257301+27172ce4d05e8a3b0ffdefd65f073d40a1b1fe54
.NET SDK version: 7.0 Preview 2
App's target framework: net6.0 (.NET 6.0.2)
Reactions are currently unavailable