microsoft / perfview

PerfView is a CPU and memory performance-analysis tool
http://channel9.msdn.com/Series/PerfView-Tutorial
MIT License
4.1k stars 698 forks source link

Unhanded exception is thrown after the app opens #2062

Closed cosminilie closed 1 month ago

cosminilie commented 1 month ago

After downloading and running the app on Windows Server 2016 I get an unhanded exception. I tried older versions and found that this was introduced with https://github.com/microsoft/perfview/releases/tag/v3.0.4. It worked fine with v3.0.3 and older versions.

Some details on my OS and .NET version:

OS: Microsoft Windows [Version 10.0.14393]

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\full
    version    REG_SZ    4.7.02558

It has an old .NET version which is EOF i think. If that is indeed the problem feel free to close it, but i would document that it requires a minimal version. There might be documentation like that, but I haven't found it.

Exception:

An unhanded exception occured.

At this point you can opt to continue, however it is possible that the aborted computation will cause additional failures.   Because PerfView generally only opens files for reading, there is no danger of corrupting  files, so it generally does not hurt to try.   However be on guard for unusual/incorrect behavior going forward.

You can of course exit and restart PerfView to be completely safe.

The fact that this exception went unhanded is a programmer error.   It should be reported so it can be fixed.  Please set along the following stack trace information which will be useful in diagnosing the problem.

StackTrace:
System.NullReferenceException: Object reference not set to an instance of an object.
   at PerfView.GuiApp.OnGuiUnhandledException(Object sender, DispatcherUnhandledExceptionEventArgs e) in D:\a\_work\1\s\src\PerfView\GuiApp.cs:line 141
   at System.Windows.Threading.Dispatcher.CatchException(Exception e)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
brianrob commented 1 month ago

I just tried to repro this, and was able to run on .NET 4.7.2, which shows up in the registry as 4.7.03062. I suspect that you have 4.7 or 4.7.1. Earlier versions such as 4.6.x do not work because they don't appear to contain netstandard.dll which is required by TraceEvent (built against netstandard20).

I agree we should document .NET 4.7.2 as the required version of .NET Framework. If an older version is needed, an older version of PerfView can be used. I've posted https://github.com/microsoft/perfview/pull/2064 to update the README.