Unable to start collection
When trying to start collection in perfview, the collection window immediatly closes, witht eh following error in the logs. This is occuring on version 2.0.12.
Any idea what is causing this?
Started with command line: "C:\Tools\PerfView.exe" /RestartingToElevelate: /BufferSizeMB:256 /MinSecForTrigger:0 GuiCollect
PerfView Version: 2.0.12 BuildDate: Sat, 07 Apr 2018 06:40:07 GMT
PerfView Start Time 10/04/2018 18:15:32
Started: GuiCollect
Warning: PdbScope not found at C:\Tools\PerfViewExtensions\PdbScope.exe
Disabling the Image Size Menu Item.
Warning: ILSize not found at C:\Tools\PerfViewExtensions\ILSize.dll
Disabling the IL Size Menu Item.
Collection Dialog open.
Completed: GuiCollect (Elapsed Time: 0.144 sec)
Started: Collecting data C:\Tools\PerfViewData.etl
[Kernel Log: C:\Tools\PerfViewData.kernel.etl]
Kernel keywords enabled: Default
Aborting tracing for sessions 'NT Kernel Logger' and 'PerfViewSession'.
Insuring .NET Allocation profiler not installed.
Detected 64 bit system, removing 64 bit keys
Completed: Collecting data C:\Tools\PerfViewData.etl (Elapsed Time: 1.098 sec)
Exception Occurred: System.Runtime.InteropServices.COMException (0x800700B7): Cannot create a file when that file already exists. (Exception from HRESULT: 0x800700B7)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at Microsoft.Diagnostics.Tracing.Session.TraceEventSession.EnableKernelProvider(Keywords flags, Keywords stackCapture)
at PerfView.CommandProcessor.Start(CommandLineArgs parsedArgs)
at PerfView.CommandProcessor.Collect(CommandLineArgs parsedArgs)
at PerfView.MainWindow.<>c__DisplayClass13_0.<ExecuteCommand>b__0()
at PerfView.StatusBar.<>c__DisplayClass22_0.<StartWork>b__0()
An exceptional condition occurred, see log for details.
I have never seen this error before.
Certainly I would try running PerfView from a different directory (make a new one).
Something else worth trying is running 'PerfView abort', and if that does not work reboot the machine (which basically insures that there are no existing sessions around to interfere).
If that does not work, feel free to reopen with what happened.
I've encountered this problem as well and I tried both of your recommendations but still doesn't work.
Started: Running: Tutorial.exe... See log for output.
[Kernel Log: D:\PerfViewData.kernel.etl]
Kernel keywords enabled: Default
Completed: Running: Tutorial.exe... See log for output. (Elapsed Time: 0.530 sec)
Exception Occurred: System.Runtime.InteropServices.COMException (0x800700B7): Cannot create a file when that file already exists. (Exception from HRESULT: 0x800700B7)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at Microsoft.Diagnostics.Tracing.Session.TraceEventSession.EnableKernelProvider(Keywords flags, Keywords stackCapture)
at PerfView.CommandProcessor.Start(CommandLineArgs parsedArgs)
at PerfView.CommandProcessor.Run(CommandLineArgs parsedArgs)
at PerfView.MainWindow.<>c__DisplayClass13_0.<ExecuteCommand>b__0()
at PerfView.StatusBar.<>c__DisplayClass22_0.<StartWork>b__0()
An exceptional condition occurred, see log for details.
Hmm, this is very surprising, and certainly does not reproduce for me. Obviously something is differnet about your envinonment and my environment, and until we can figure out what it is that provokes the error, it will be hard to fix.
From the stack trace and error code, it is asking the Kernel to log information to the file D:\PerfViewData.kernel.etl and the API returns a HR code that says the file already exists (note that HR results sometimes are used for things that are 'related', it also had to create a 'session' for the logging and it is possible that is what already exist, and it is complaining about.
Anything you can do to characterize when it happens would be helpful. Does it happen all the time? Presumably after reboot. Does it happen on every machine you tried? Is there anything special about the machine where it fails? What version of the operating system are you using? Have you tried launching it in different places (not the root of a drive). Basically anything that might be different between your case and 'everybody else'.
I was able to reproduce this consistently (across reboots over multiple weeks) on a previous win 7 work laptop. I was never able to confirm, but I did notice that some of the security software on that machine used a kernel ETW session even before starting perfview - I suspect that this and perfview were fighting, but was not able to confirm as I got a replacement laptop which didn't reproduce the problem.
The Win7 part of the environment likely has something to do with it. We use a different code to call the ENableKernelProvider for that case, and maybe there is a versioning issue of some sort or another.
One last thing you can try is to do
PerfView /kernelEvents=default+ThreadPriority collect
It turns out that trying to collect kernel information on ThreadPriority (and a few others), forces us to use a different way of starting the kernel provider, and thus it may not hit this bug.
But otherwise I am afraid that this looks like some win7 specific OS-PerfView version mismatch that is frankly not worth resolving. I think you can still get xperf for Win7, but I have not actually tried.
Is there a workaround for this? I also have this issue.
/kernelEvents=default+ThreadPriority worked for me, im using a corporate pc so there could be something monitoring actively, thanks