我试图使用新的语义应用程序块进行日志记录.根据MSDN,我有测试方法,用于检查EventSource
EventSourceAnalyzer.InspectAll(MyEventSource.Log);
Run Code Online (Sandbox Code Playgroud)
但是当我运行这个测试时,我得到了错误
An item with the same key has already been added
Run Code Online (Sandbox Code Playgroud)
通常,如果我们使用相同的事件ID,我们会收到此错误,但我为每个方法使用不同的EventID.下面是我的事件源类
EventSource(Name = "SLAB_1.1.1403.1")]
public class MyEventSource : EventSource
{
public class Keywords
{
public const EventKeywords Page = (EventKeywords)1;
public const EventKeywords DataBase = (EventKeywords)2;
public const EventKeywords Diagnostic = (EventKeywords)4;
public const EventKeywords Perf = (EventKeywords)8;
}
public class Tasks
{
public const EventTask Page = (EventTask)1;
public const EventTask DBQuery = (EventTask)2;
}
private static MyEventSource _log = new MyEventSource();
private MyEventSource() { } …Run Code Online (Sandbox Code Playgroud)