.Net 4.5 EventSource ETW provider not showing up in provider list

你离开我真会死。 提交于 2019-12-03 15:33:37

MS released a Nuget package which registers the EventSource class after build:

http://blogs.msdn.com/b/dotnet/archive/2013/08/09/announcing-the-eventsource-nuget-package-write-to-the-windows-event-log.aspx

Registering your EventSource

When you install the EventSource NuGet package, the build step previously mentioned generates the following files for each EventSource in your application:

<AssemblyName>.<EventSourceTypeName>.etwManifest.man
<AssemblyName>.<EventSourceTypeName>.etwManifest.dll.

These files need to be registered with the operating system to enable channel support. To do this you run the following command after the files are in their final deployed location:

wevtutil.exe im <EtwManifestManFile> /rf:"<EtwManifestDllFile>" /mf:"<EtwManifestDllFile>"

Once this registration command is executed, all subsequent calls to MinimalEventSource.Log.Load(), from any process on that machine, will automatically result in events in the Windows Event log.

After registering it you should see it in all tools which read the installed providers.

Lars Skovslund

The EventSource implementation prevents you from specifying the channel even if you do modify the manifest. When writing an event to ETW you pass a descriptor block where in the channel id is specified. Unfortunately EventSource does not offer a way to set this through an attribute or otherwise and is always setting this to zero, meaning no channel is used.

EventSource is behaving a bit differently from a normal ETW providers as it does not expose its manifest through a win32 resource but rather sends a "known" ETW event with the manifest as its payload. This is why perfmon is the only ETW enabled tool that recognizes* events send from .NET 4.5 EventSource.

*You can always receive events using perfmon or other tools like it but they wont be able to decode the payload e.g. parameters passed to WriteEvent.

EDIT: See answer to a similar question

Cheers Lars

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!