c# – 为什么限制参数类型和对EventSource方法的计数

我现在正在用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重载支持的其他类型).

您唯一能决定的是方法名称以及反映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.

相关文章

在要实现单例模式的类当中添加如下代码:实例化的时候:frmC...
1、如果制作圆角窗体,窗体先继承DOTNETBAR的:public parti...
根据网上资料,自己很粗略的实现了一个winform搜索提示,但是...
近期在做DSOFramer这个控件,打算自己弄一个自定义控件来封装...
今天玩了一把WMI,查询了一下电脑的硬件信息,感觉很多代码都...
最近在研究WinWordControl这个控件,因为上级要求在系统里,...