When I run "Anu CPU" or "x86" builds of TraceEvent project on a 64-bit box, at
...\TraceEvent\TraceEvent\30_MonitorLoads.cs:100
which is
session.EnableKernelProvider(KernelTraceEventParser.Keywords.ImageLoad | KernelTraceEventParser.Keywords.Process);
I get
System.Runtime.InteropServices.COMException was unhandled
_HResult=-2147024713
_message=Cannot create a file when that file already exists. (Exception from HRESULT: 0x800700B7)
HResult=-2147024713
IsTransient=false
Message=Cannot create a file when that file already exists. (Exception from HRESULT: 0x800700B7)
Source=mscorlib
ErrorCode=-2147024713
StackTrace:
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
at Microsoft.Diagnostics.Tracing.Session.TraceEventSession.EnableKernelProvider(Keywords flags, Keywords stackCapture)
at TraceEventSamples.ModuleLoadMonitor.Run() in e:_Setups\dotnetsamples\dotnetsamples-master\dotnetsamples-master\Microsoft.Diagnostics.Tracing\TraceEvent\TraceEvent\30_MonitorLoads.cs:line 100
at TraceEventSamples.AllSamples.Run() in e:_Setups\dotnetsamples\dotnetsamples-master\dotnetsamples-master\Microsoft.Diagnostics.Tracing\TraceEvent\TraceEvent\00_AllSamples.cs:line 30
at TraceEventSamples.Program.Main(String[] args) in e:_Setups\dotnetsamples\dotnetsamples-master\dotnetsamples-master\Microsoft.Diagnostics.Tracing\TraceEvent\TraceEvent\Program.cs:line 9
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
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 System.Threading.ThreadHelper.ThreadStart()
InnerException:
An attempt to continue execution (F11) brings
System.Exception was unhandled
_HResult=-2146233088
_message=The kernel provider must be enabled as the only provider and enabled only once.
HResult=-2146233088
IsTransient=false
Message=The kernel provider must be enabled as the only provider and enabled only once.
Source=Microsoft.Diagnostics.Tracing.TraceEvent
StackTrace:
at Microsoft.Diagnostics.Tracing.Session.TraceEventSession.EnableKernelProvider(Keywords flags, Keywords stackCapture)
at TraceEventSamples.ModuleLoadMonitor.Run() in e:_Setups\dotnetsamples\dotnetsamples-master\dotnetsamples-master\Microsoft.Diagnostics.Tracing\TraceEvent\TraceEvent\30_MonitorLoads.cs:line 100
at TraceEventSamples.AllSamples.Run() in e:_Setups\dotnetsamples\dotnetsamples-master\dotnetsamples-master\Microsoft.Diagnostics.Tracing\TraceEvent\TraceEvent\00_AllSamples.cs:line 30
at TraceEventSamples.Program.Main(String[] args) in e:_Setups\dotnetsamples\dotnetsamples-master\dotnetsamples-master\Microsoft.Diagnostics.Tracing\TraceEvent\TraceEvent\Program.cs:line 9
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
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 System.Threading.ThreadHelper.ThreadStart()
InnerException:
I tried to figure out what is that file that "already exists" using procmon and filtering for both TraceEvent.exe and svchost.exe (in case it is an out-of-proc COM object) and found nothing: all CreateFile calls were with disposition "Open" (as opposed to create new)...
Any ideas?