microsoft / perfview

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

Error: Could not load file or assembly 'System.Net.Http, Version=4.2.0.0 ... #1816

Open rjk opened 1 year ago

rjk commented 1 year ago

I downloaded PerfView.exe latest release just now (exe says it's 3.0.7.0) and ran the following command line. The first time through I saw a message that I need to run with /AcceptEULA so I re-ran with that. It opened an elevation prompt and another cmd window running PerfView. Great so far. I pressed S to stop collection after a while and got this error:

Error: Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

Here's the command I ran:

C:\Users\rory.admin>downloads\PerfView.exe collect -MaxCollectSec:300 -NoGui /onlyProviders=*Microsoft-ApplicationInsights-Core,*Microsoft-ApplicationInsights-Data,*Microsoft-ApplicationInsights-WindowsServer-TelemetryChannel,*Microsoft-ApplicationInsights-Extensibility-AppMapCorrelation-Dependency,*Microsoft-ApplicationInsights-Extensibility-AppMapCorrelation-Web,*Microsoft-ApplicationInsights-Extensibility-DependencyCollector,*Microsoft-ApplicationInsights-Extensibility-HostingStartup,*Microsoft-ApplicationInsights-Extensibility-PerformanceCollector,*Microsoft-ApplicationInsights-Extensibility-EventCounterCollector,*Microsoft-ApplicationInsights-Extensibility-PerformanceCollector-QuickPulse,*Microsoft-ApplicationInsights-Extensibility-Web,*Microsoft-ApplicationInsights-Extensibility-WindowsServer,*Microsoft-ApplicationInsights-WindowsServer-Core,*Microsoft-ApplicationInsights-LoggerProvider,*Microsoft-ApplicationInsights-Extensibility-EventSourceListener,*Microsoft-ApplicationInsights-AspNetCore,*Redfield-Microsoft-ApplicationInsights-Core,*Redfield-Microsoft-ApplicationInsights-Data,*Redfield-Microsoft-ApplicationInsights-WindowsServer-TelemetryChannel,*Redfield-Microsoft-ApplicationInsights-Extensibility-AppMapCorrelation-Dependency,*Redfield-Microsoft-ApplicationInsights-Extensibility-AppMapCorrelation-Web,*Redfield-Microsoft-ApplicationInsights-Extensibility-DependencyCollector,*Redfield-Microsoft-ApplicationInsights-Extensibility-PerformanceCollector,*Redfield-Microsoft-ApplicationInsights-Extensibility-EventCounterCollector,*Redfield-Microsoft-ApplicationInsights-Extensibility-PerformanceCollector-QuickPulse,*Redfield-Microsoft-ApplicationInsights-Extensibility-Web,*Redfield-Microsoft-ApplicationInsights-Extensibility-WindowsServer,*Redfield-Microsoft-ApplicationInsights-LoggerProvider,*Redfield-Microsoft-ApplicationInsights-Extensibility-EventSourceListener,*Redfield-Microsoft-ApplicationInsights-AspNetCore /accepteula

This opened an elevation prompt and opened a new window. Once the error is shown it looks like this:

image

Full text in that window is:

VERBOSE LOG IN: PerfViewData.log.txt
EXECUTING: PerfView /RestartingToElevelate:collect /BufferSizeMB:256 /StackCompression /MaxCollectSec:300 /KernelEvents:None /ClrEvents:None /TplEvents:TasksFlowActivityIds /Providers:*Microsoft-ApplicationInsights-Core,*Microsoft-ApplicationInsights-Data,*Microsoft-ApplicationInsights-WindowsServer-TelemetryChannel,*Microsoft-ApplicationInsights-Extensibility-AppMapCorrelation-Dependency,*Microsoft-ApplicationInsights-Extensibility-AppMapCorrelation-Web,*Microsoft-ApplicationInsights-Extensibility-DependencyCollector,*Microsoft-ApplicationInsights-Extensibility-HostingStartup,*Microsoft-ApplicationInsights-Extensibility-PerformanceCollector,*Microsoft-ApplicationInsights-Extensibility-EventCounterCollector,*Microsoft-ApplicationInsights-Extensibility-PerformanceCollector-QuickPulse,*Microsoft-ApplicationInsights-Extensibility-Web,*Microsoft-ApplicationInsights-Extensibility-WindowsServer,*Microsoft-ApplicationInsights-WindowsServer-Core,*Microsoft-ApplicationInsights-LoggerProvider,*Microsoft-ApplicationInsights-Extensibility-EventSourceListener,*Microsoft-ApplicationInsights-AspNetCore,*Redfield-Microsoft-ApplicationInsights-Core,*Redfield-Microsoft-ApplicationInsights-Data,*Redfield-Microsoft-ApplicationInsights-WindowsServer-TelemetryChannel,*Redfield-Microsoft-ApplicationInsights-Extensibility-AppMapCorrelation-Dependency,*Redfield-Microsoft-ApplicationInsights-Extensibility-AppMapCorrelation-Web,*Redfield-Microsoft-ApplicationInsights-Extensibility-DependencyCollector,*Redfield-Microsoft-ApplicationInsights-Extensibility-PerformanceCollector,*Redfield-Microsoft-ApplicationInsights-Extensibility-EventCounterCollector,*Redfield-Microsoft-ApplicationInsights-Extensibility-PerformanceCollector-QuickPulse,*Redfield-Microsoft-ApplicationInsights-Extensibility-Web,*Redfield-Microsoft-ApplicationInsights-Extensibility-WindowsServer,*Redfield-Microsoft-ApplicationInsights-LoggerProvider,*Redfield-Microsoft-ApplicationInsights-Extensibility-EventSourceListener,*Redfield-Microsoft-ApplicationInsights-AspNetCore /NoGui /NoNGenRundown /NoClrRundown Collect

Pre V4.0 .NET Rundown disabled, Type 'E' to enable symbols for V3.5 processes.
Do NOT close this console window.   It will leave collection on!
Type S to stop collection, 'A' will abort.
Kernel Log: C:\Users\rory.admin\PerfViewData.kernel.etl
User mode Log: C:\Users\rory.admin\PerfViewData.etl
Starting collection at 2023-02-22 14:51:52
Collecting   10 sec: Size=  4,0 MB.
Collecting   20 sec: Size=  8,1 MB.
Collecting   31 sec: Size= 11,9 MB.
Collecting   41 sec: Size= 15,8 MB.
Collecting   51 sec: Size= 19,6 MB.
Collecting  1,0 min: Size= 23,8 MB.
Collecting  1,2 min: Size= 27,5 MB.
Manually Stopped (NoGui)
Sending rundown command to CLR providers...
Merging data files to PerfViewData.etl.  Can take 10s of seconds... (can skip if data analyzed on same machine with PerfView)
Error: Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
DONE 14:53:13 FAIL: PerfView /RestartingToElevelate:collect /BufferSizeMB:256 /StackCompression /MaxCollectSec:300 /KernelEvents:None /ClrEvents:None /TplEvents:TasksFlowActivityIds /Providers:*Microsoft-ApplicationInsights-Core,*Microsoft-ApplicationInsights-Data,*Microsoft-ApplicationInsights-WindowsServer-TelemetryChannel,*Microsoft-ApplicationInsights-Extensibility-AppMapCorrelation-Dependency,*Microsoft-ApplicationInsights-Extensibility-AppMapCorrelation-Web,*Microsoft-ApplicationInsights-Extensibility-DependencyCollector,*Microsoft-ApplicationInsights-Extensibility-HostingStartup,*Microsoft-ApplicationInsights-Extensibility-PerformanceCollector,*Microsoft-ApplicationInsights-Extensibility-EventCounterCollector,*Microsoft-ApplicationInsights-Extensibility-PerformanceCollector-QuickPulse,*Microsoft-ApplicationInsights-Extensibility-Web,*Microsoft-ApplicationInsights-Extensibility-WindowsServer,*Microsoft-ApplicationInsights-WindowsServer-Core,*Microsoft-ApplicationInsights-LoggerProvider,*Microsoft-ApplicationInsights-Extensibility-EventSourceListener,*Microsoft-ApplicationInsights-AspNetCore,*Redfield-Microsoft-ApplicationInsights-Core,*Redfield-Microsoft-ApplicationInsights-Data,*Redfield-Microsoft-ApplicationInsights-WindowsServer-TelemetryChannel,*Redfield-Microsoft-ApplicationInsights-Extensibility-AppMapCorrelation-Dependency,*Redfield-Microsoft-ApplicationInsights-Extensibility-AppMapCorrelation-Web,*Redfield-Microsoft-ApplicationInsights-Extensibility-DependencyCollector,*Redfield-Microsoft-ApplicationInsights-Extensibility-PerformanceCollector,*Redfield-Microsoft-ApplicationInsights-Extensibility-EventCounterCollector,*Redfield-Microsoft-ApplicationInsights-Extensibility-PerformanceCollector-QuickPulse,*Redfield-Microsoft-ApplicationInsights-Extensibility-Web,*Redfield-Microsoft-ApplicationInsights-Extensibility-WindowsServer,*Redfield-Microsoft-ApplicationInsights-LoggerProvider,*Redfield-Microsoft-ApplicationInsights-Extensibility-EventSourceListener,*Redfield-Microsoft-ApplicationInsights-AspNetCore /NoGui /NoNGenRundown /NoClrRundown Collect
Press enter to close window.
S

When I run PerfView.exe only I get this error in a GUI window and then the app closes even if I click Continue. I'm not able to use PerfView.exe on this machine.

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)
   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)

Log file is here:

PerfViewData.log.txt

It did output PerfviewData.etl and PerfViewData.clrRundown.etl and I'm able to look at events etc in PerfviewData.etl from another machine. I'm not familiar enough with PerfView to know if it's complete or what the effect of the error is.

Everything works fine for me on a very similarly configured server.

brianrob commented 1 year ago

I am not able to reproduce this, but I suspect it is due to missing unpacked dependencies. Can you please try clearing out %USERPROFILE%\AppData\Roaming\PerfView and then re-running PerfView?

rjk commented 1 year ago

I deleted that folder and still get the exception when I start up PerfView.exe from gui:

image

Any other way I can run with more logs?

brianrob commented 1 year ago

What operating system is this running on? I might have seen this before on an older OS.

From: Rory @.> Sent: Friday, February 24, 2023 3:14 PM To: microsoft/perfview @.> Cc: Brian Robbins @.>; Comment @.> Subject: Re: [microsoft/perfview] Error: Could not load file or assembly 'System.Net.Http, Version=4.2.0.0 ... (Issue #1816)

I deleted that folder and still get the exception when I start up PerfView.exe from gui:

[image]https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F29672%2F221319001-c5fef348-5c9c-4206-8c35-bbc5ec50a55d.png&data=05%7C01%7Cbrianrob%40microsoft.com%7C194d55b4920a4368c5c408db16bcdefc%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638128772684452723%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=dXCCRyvWvcL83V5YeTalAr1oD3SaY2R2wBz1SSOf6Ao%3D&reserved=0

Any other way I can run with more logs?

- Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fperfview%2Fissues%2F1816%23issuecomment-1444653073&data=05%7C01%7Cbrianrob%40microsoft.com%7C194d55b4920a4368c5c408db16bcdefc%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638128772684452723%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=5aPtIWO2sT%2F1FOdT86AnyylYRfqdqiSSXWXhxdxWERY%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABPMGETJXYGH4WULAWODU3LWZE6FDANCNFSM6AAAAAAVEMDJWE&data=05%7C01%7Cbrianrob%40microsoft.com%7C194d55b4920a4368c5c408db16bcdefc%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638128772684452723%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=fmpCeazn2HnuJPKMluqHASrqudur0SkP%2BvrtAcSrWaA%3D&reserved=0. You are receiving this because you commented.Message ID: @.**@.>>

rjk commented 1 year ago

Windows Server 2016 Standard x64, on a VM. Windows version 10.0.14393 I have several similarly-configured (but not exact) other VMs where PerfView runs fine.

brianrob commented 1 year ago

Ok, that seems like it should be fine. If you are able to capture a dump on the first chance exception, I could try looking at that.

mahamr commented 1 year ago

I've also seen this multiple times with different customers - going back to the last 2.x version is the workaround. Next time it happens if we have the time I'll see if we can dump on that exception as well.

brianrob commented 1 year ago

I have seen this recently if there is a PerfView.exe.config file next to PerfView.exe that has a binding redirect pointing to System.Net.Http 4.2.0.0. I recently submitted a fix for this that removes these binding redirects: https://github.com/microsoft/perfview/pull/1830

Hopefully that takes care of this.

brianrob commented 1 year ago

@rjk did the latest version of PerfView fix this for you?