diff --git a/modules/perfview b/modules/perfview index e343a0cf01..9c4f637c48 160000 --- a/modules/perfview +++ b/modules/perfview @@ -1 +1 @@ -Subproject commit e343a0cf01305c7866c412d4ce708c3e0ec960c8 +Subproject commit 9c4f637c48953d66216adca0f131fc75be99851c diff --git a/test/Sentry.Profiling.Tests/Resources/README.md b/test/Sentry.Profiling.Tests/Resources/README.md index db5693a9ee..68e2c3f37a 100644 --- a/test/Sentry.Profiling.Tests/Resources/README.md +++ b/test/Sentry.Profiling.Tests/Resources/README.md @@ -49,3 +49,27 @@ And for reference, you can create a JSON that can be displayed by [SpeedScope](h ```shell-script dotnet-trace convert sample.nettrace --format Speedscope ``` + +## Regenerating `sample.etlx` after a perfview submodule bump + +`sample.etlx` is committed, and its format version is tied to the TraceEvent build in +`modules/perfview`. A submodule bump can therefore leave it unreadable, which surfaces as: + +``` +FastSerialization.SerializationException : File format is version 74 App accepts formats >= 78. +``` + +To regenerate it, delete the file and run the tests once — `TraceLogProcessorTests` rebuilds it from +`sample.nettrace` when it is absent: + +```shell-script +rm test/Sentry.Profiling.Tests/Resources/sample.etlx +dotnet test test/Sentry.Profiling.Tests --filter "FullyQualifiedName~TraceLogProcessorTests" +``` + +Then commit the regenerated file, along with any `*.verified.txt` snapshot changes it produces +(`pwsh ./scripts/accept-verifier-changes.ps1` — review the diff, module names in particular). + +Do **not** leave it uncommitted and rely on regeneration at test time. The path is shared by every +target framework, and `dotnet test` runs one host per TFM, so they race on both this file and the +`sample.etlx.new` temp that TraceEvent writes alongside it. diff --git a/test/Sentry.Profiling.Tests/Resources/sample.etlx b/test/Sentry.Profiling.Tests/Resources/sample.etlx index 2639f75ee0..2b03e5922a 100644 Binary files a/test/Sentry.Profiling.Tests/Resources/sample.etlx and b/test/Sentry.Profiling.Tests/Resources/sample.etlx differ diff --git a/test/Sentry.Profiling.Tests/TraceLogProcessorTests.ProfileInfo_Serialization_Works.verified.txt b/test/Sentry.Profiling.Tests/TraceLogProcessorTests.ProfileInfo_Serialization_Works.verified.txt index 481fcf2e42..8106a2d6f6 100644 --- a/test/Sentry.Profiling.Tests/TraceLogProcessorTests.ProfileInfo_Serialization_Works.verified.txt +++ b/test/Sentry.Profiling.Tests/TraceLogProcessorTests.ProfileInfo_Serialization_Works.verified.txt @@ -251,17 +251,17 @@ frames: [ { function: System.IO.Pipes.PipeStream.ReadCore(value class System.Span`1), - module: System.IO.Pipes.il, + module: System.IO.Pipes, in_app: false }, { function: System.IO.Pipes.PipeStream.Read(unsigned int8[],int32,int32), - module: System.IO.Pipes.il, + module: System.IO.Pipes, in_app: false }, { function: System.IO.BinaryReader.ReadBytes(int32), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { @@ -344,142 +344,142 @@ }, { function: System.Threading.LowLevelLifoSemaphore.WaitForSignal(int32), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Threading.LowLevelLifoSemaphore.Wait(int32,bool), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart(), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Threading.Thread.StartCallback(), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Threading.WaitHandle.WaitOneNoCheck(int32), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Threading.WaitHandle.WaitOne(int32), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Threading.PortableThreadPool+GateThread.GateThreadStart(), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Text.Unicode.Utf8Utility.TranscodeToUtf16(unsigned int8*,int32,wchar*,int32,unsigned int8*&,wchar*&), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Text.UTF8Encoding.GetChars(unsigned int8*,int32,wchar*,int32), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.String.CreateStringFromEncoding(unsigned int8*,int32,class System.Text.Encoding), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Reflection.MdFieldInfo.get_Name(), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Diagnostics.Tracing.EventSource.AddProviderEnumKind(class System.Diagnostics.Tracing.ManifestBuilder,class System.Reflection.FieldInfo,class System.String), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Diagnostics.Tracing.EventSource.CreateManifestAndDescriptors(class System.Type,class System.String,class System.Diagnostics.Tracing.EventSource,value class System.Diagnostics.Tracing.EventManifestOptions), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Diagnostics.Tracing.EventSource.EnsureDescriptorsInitialized(), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Diagnostics.Tracing.EventSource.DoCommand(class System.Diagnostics.Tracing.EventCommandEventArgs), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Diagnostics.Tracing.EventSource.SendCommand(class System.Diagnostics.Tracing.EventListener,value class System.Diagnostics.Tracing.EventProviderType,int32,int32,value class System.Diagnostics.Tracing.EventCommand,bool,value class System.Diagnostics.Tracing.EventLevel,value class System.Diagnostics.Tracing.EventKeywords,class System.Collections.Generic.IDictionary`2), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Diagnostics.Tracing.EventSource+OverrideEventProvider.OnControllerCommand(value class System.Diagnostics.Tracing.ControllerCommand,class System.Collections.Generic.IDictionary`2,int32,int32), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Diagnostics.Tracing.EventProvider.EtwEnableCallBack(value class System.Guid&,int32,unsigned int8,int64,int64,value class EVENT_FILTER_DESCRIPTOR*,void*), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.IO.Stream+<>c.b__40_0(class System.Object), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Threading.Tasks.Task`1[System.Int32].InnerInvoke(), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Threading.Tasks.Task+<>c.<.cctor>b__272_0(class System.Object), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(class System.Threading.Thread,class System.Threading.ExecutionContext,class System.Threading.ContextCallback,class System.Object), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Threading.Tasks.Task.ExecuteWithThreadLocal(class System.Threading.Tasks.Task&,class System.Threading.Thread), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Threading.Tasks.Task.ExecuteEntryUnsafe(class System.Threading.Thread), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Threading.Tasks.Task.ExecuteFromThreadPool(class System.Threading.Thread), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Threading.ThreadPoolWorkQueue.Dispatch(), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Collections.Concurrent.ConcurrentDictionary`2[System.__Canon,System.IntPtr].TryAddInternal(!0,value class System.Nullable`1,!1,bool,bool,!1&), - module: System.Collections.Concurrent.il, + module: System.Collections.Concurrent, in_app: false }, { function: System.Collections.Concurrent.ConcurrentDictionary`2[System.__Canon,System.IntPtr].set_Item(!0,!1), - module: System.Collections.Concurrent.il, + module: System.Collections.Concurrent, in_app: false }, { @@ -502,12 +502,12 @@ }, { function: System.MulticastDelegate.CombineImpl(class System.Delegate), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Delegate.Combine(class System.Delegate,class System.Delegate), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { @@ -597,7 +597,7 @@ }, { function: System.Collections.Generic.Dictionary`2[System.__Canon,Avalonia.Media.KnownColor]..ctor(class System.Collections.Generic.IEqualityComparer`1), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { @@ -1022,4 +1022,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/Sentry.Profiling.Tests/TraceLogProcessorTests.Profile_Serialization_Works.verified.txt b/test/Sentry.Profiling.Tests/TraceLogProcessorTests.Profile_Serialization_Works.verified.txt index 7720ab6755..55f60e511c 100644 --- a/test/Sentry.Profiling.Tests/TraceLogProcessorTests.Profile_Serialization_Works.verified.txt +++ b/test/Sentry.Profiling.Tests/TraceLogProcessorTests.Profile_Serialization_Works.verified.txt @@ -228,17 +228,17 @@ frames: [ { function: System.IO.Pipes.PipeStream.ReadCore(value class System.Span`1), - module: System.IO.Pipes.il, + module: System.IO.Pipes, in_app: false }, { function: System.IO.Pipes.PipeStream.Read(unsigned int8[],int32,int32), - module: System.IO.Pipes.il, + module: System.IO.Pipes, in_app: false }, { function: System.IO.BinaryReader.ReadBytes(int32), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { @@ -321,142 +321,142 @@ }, { function: System.Threading.LowLevelLifoSemaphore.WaitForSignal(int32), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Threading.LowLevelLifoSemaphore.Wait(int32,bool), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart(), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Threading.Thread.StartCallback(), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Threading.WaitHandle.WaitOneNoCheck(int32), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Threading.WaitHandle.WaitOne(int32), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Threading.PortableThreadPool+GateThread.GateThreadStart(), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Text.Unicode.Utf8Utility.TranscodeToUtf16(unsigned int8*,int32,wchar*,int32,unsigned int8*&,wchar*&), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Text.UTF8Encoding.GetChars(unsigned int8*,int32,wchar*,int32), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.String.CreateStringFromEncoding(unsigned int8*,int32,class System.Text.Encoding), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Reflection.MdFieldInfo.get_Name(), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Diagnostics.Tracing.EventSource.AddProviderEnumKind(class System.Diagnostics.Tracing.ManifestBuilder,class System.Reflection.FieldInfo,class System.String), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Diagnostics.Tracing.EventSource.CreateManifestAndDescriptors(class System.Type,class System.String,class System.Diagnostics.Tracing.EventSource,value class System.Diagnostics.Tracing.EventManifestOptions), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Diagnostics.Tracing.EventSource.EnsureDescriptorsInitialized(), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Diagnostics.Tracing.EventSource.DoCommand(class System.Diagnostics.Tracing.EventCommandEventArgs), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Diagnostics.Tracing.EventSource.SendCommand(class System.Diagnostics.Tracing.EventListener,value class System.Diagnostics.Tracing.EventProviderType,int32,int32,value class System.Diagnostics.Tracing.EventCommand,bool,value class System.Diagnostics.Tracing.EventLevel,value class System.Diagnostics.Tracing.EventKeywords,class System.Collections.Generic.IDictionary`2), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Diagnostics.Tracing.EventSource+OverrideEventProvider.OnControllerCommand(value class System.Diagnostics.Tracing.ControllerCommand,class System.Collections.Generic.IDictionary`2,int32,int32), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Diagnostics.Tracing.EventProvider.EtwEnableCallBack(value class System.Guid&,int32,unsigned int8,int64,int64,value class EVENT_FILTER_DESCRIPTOR*,void*), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.IO.Stream+<>c.b__40_0(class System.Object), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Threading.Tasks.Task`1[System.Int32].InnerInvoke(), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Threading.Tasks.Task+<>c.<.cctor>b__272_0(class System.Object), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(class System.Threading.Thread,class System.Threading.ExecutionContext,class System.Threading.ContextCallback,class System.Object), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Threading.Tasks.Task.ExecuteWithThreadLocal(class System.Threading.Tasks.Task&,class System.Threading.Thread), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Threading.Tasks.Task.ExecuteEntryUnsafe(class System.Threading.Thread), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Threading.Tasks.Task.ExecuteFromThreadPool(class System.Threading.Thread), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Threading.ThreadPoolWorkQueue.Dispatch(), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Collections.Concurrent.ConcurrentDictionary`2[System.__Canon,System.IntPtr].TryAddInternal(!0,value class System.Nullable`1,!1,bool,bool,!1&), - module: System.Collections.Concurrent.il, + module: System.Collections.Concurrent, in_app: false }, { function: System.Collections.Concurrent.ConcurrentDictionary`2[System.__Canon,System.IntPtr].set_Item(!0,!1), - module: System.Collections.Concurrent.il, + module: System.Collections.Concurrent, in_app: false }, { @@ -479,12 +479,12 @@ }, { function: System.MulticastDelegate.CombineImpl(class System.Delegate), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { function: System.Delegate.Combine(class System.Delegate,class System.Delegate), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { @@ -574,7 +574,7 @@ }, { function: System.Collections.Generic.Dictionary`2[System.__Canon,Avalonia.Media.KnownColor]..ctor(class System.Collections.Generic.IEqualityComparer`1), - module: System.Private.CoreLib.il, + module: System.Private.CoreLib, in_app: false }, { @@ -998,4 +998,4 @@ stack_id: 18 } ] -} +} \ No newline at end of file diff --git a/test/Sentry.Profiling.Tests/TraceLogProcessorTests.verify.cs b/test/Sentry.Profiling.Tests/TraceLogProcessorTests.verify.cs index 5b4307e951..50aa52a39a 100644 --- a/test/Sentry.Profiling.Tests/TraceLogProcessorTests.verify.cs +++ b/test/Sentry.Profiling.Tests/TraceLogProcessorTests.verify.cs @@ -50,13 +50,16 @@ private SampleProfile GetProfile() if (!File.Exists(etlxFilePath)) { var etlFilePath = Path.ChangeExtension(etlxFilePath, "nettrace"); - var source = new EventPipeEventSource(etlFilePath); - typeof(TraceLog) - .GetMethod( + using var source = new EventPipeEventSource(etlFilePath); + var createFromEventPipeEventSources = typeof(TraceLog).GetMethod( "CreateFromEventPipeEventSources", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static, - new Type[] { typeof(TraceEventDispatcher), typeof(string), typeof(TraceLogOptions) })? - .Invoke(null, new object[] { source, etlxFilePath, new TraceLogOptions() { ContinueOnError = true } }); + new Type[] { typeof(TraceEventDispatcher), typeof(string), typeof(TraceLogOptions) }) + ?? throw new InvalidOperationException( + "TraceLog.CreateFromEventPipeEventSources was not found. Has the perfview submodule changed its signature?"); + + createFromEventPipeEventSources.Invoke( + null, new object[] { source, etlxFilePath, new TraceLogOptions() { ContinueOnError = true } }); } using var traceLog = new TraceLog(etlxFilePath);