我现在正在用C#中的Microsoft EventSources进行实验.
一个限制如下
一个限制如下
…The number and types of arguments passed to the ETW method must
exactly match the types passed to the WriteEvent overload it calls.
For example:
[Event(2,Level = EventLevel.Informational)] public void Info(string message,int count) { base.WriteEvent(2,message,count); }
这基本上限制了您在EventSource类中编写更丰富的API.这基本上意味着您无法创建接收自定义对象的方法,并且在方法体内可以将其序列化为字符串(或WriteEvent重载支持的其他类型).
解决方法
这是构建清单文件所必需的. The_EventSourceUsersGuide.docx解释了它:
Event methods must match exactly the types of the WriteEvent overload it calls,in particular you should avoid implicit scalar conversions; they are dangerous because the manifest is generated based on the signature of the ETW event method,but the values passed to ETW are based on the signature of the WriteEvent overload.