Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
System.Diagnostics-带有空消息的Eventsource_Events_Logging_Trace_System.diagnostics_Etw Eventsource - Fatal编程技术网

System.Diagnostics-带有空消息的Eventsource

System.Diagnostics-带有空消息的Eventsource,events,logging,trace,system.diagnostics,etw-eventsource,Events,Logging,Trace,System.diagnostics,Etw Eventsource,我正在使用System.Diagnostics使用EventSource获取一些消息,并将它们作为日志进行跟踪。似乎缺少一些信息,例如EventMessage和Message(它们为空),而EventId和级别设置正确。WriteEvent方法正确(传递给每个事件方法的参数数量和类型与传递给WriteEvent()的参数完全匹配)。 特别是,我在ServiceFabric集群上使用WAD在Azure表存储上收集跟踪。 有什么想法吗 谢谢 事件的参数必须与调用的方法的参数匹配。Eventsourc

我正在使用System.Diagnostics使用EventSource获取一些消息,并将它们作为日志进行跟踪。似乎缺少一些信息,例如EventMessage和Message(它们为空),而EventId和级别设置正确。WriteEvent方法正确(传递给每个事件方法的参数数量和类型与传递给WriteEvent()的参数完全匹配)。 特别是,我在ServiceFabric集群上使用WAD在Azure表存储上收集跟踪。 有什么想法吗


谢谢

事件的参数必须与调用的方法的参数匹配。Eventsource基于方法的参数构建清单

事件方法必须完全匹配它调用的WriteEvent重载的类型,特别是应该避免隐式标量转换;它们是危险的,因为清单是基于ETW事件方法的签名生成的,但传递给ETW的值是基于WriteEvent重载的签名


事件的参数必须与调用的方法的参数匹配。Eventsource基于方法的参数构建清单

事件方法必须完全匹配它调用的WriteEvent重载的类型,特别是应该避免隐式标量转换;它们是危险的,因为清单是基于ETW事件方法的签名生成的,但传递给ETW的值是基于WriteEvent重载的签名


自从我们升级到任何大于4.5.2的.NET Framework版本后,我就遇到了这个问题。我终于解决了我的问题,希望这也能帮助你。我知道这是一个老帖子,但也许它也会帮助其他人

Windows事件跟踪(ETW)似乎可以处理错误,您得到的唯一指示是您看到的日志消息为null的位置。我正在使用从IEventTextFormatter派生的自定义格式化程序。(EventData.FormattedMessage为空)。在此方法中设置断点显示EventData.FormattedMessage为null。我还注意到Visual Studio的“输出/调试”窗口中有以下消息:

The parameters to the Event method do not match the parameters to the WriteEvent method. This may cause the event to be displayed incorrectly.
EventSourceException while processing event "WriteLogDefault": System.IndexOutOfRangeException:Index was outside the bounds of the array.
A first chance exception of type 'System.NullReferenceException' occurred in NEAM.App.ProfileDataMart.BL.dll
我将我的问题追溯到以下方法:

[Event(1, Message = "{2}", Level = EventLevel.Informational, Keywords = Keywords.Informational)]
private void WriteLogDefault(int p_EventId, string p_AssemblyName, int p_Key, string p_Message)
{
    WriteEvent(p_EventId, p_AssemblyName, p_Key, p_Message);
}
根据上的文档中的注释,对WriteEvent的调用应该包括EventId,后跟传递给方法的所有参数。显然,上述代码没有在.NETFramework 4.5.2或更早版本中引发任何异常

在EventSource派生类中实现标识为ETW事件的方法时。必须调用基类WriteEvent方法,传递EventId和与实现方法相同的参数

我的代码现在看起来像这样,并按预期工作。祝你好运

    [Event(1, Message = "{2}", Level = EventLevel.Informational, Keywords = Keywords.Informational)]
    public void WriteLogDefault(string p_AssemblyName, int p_Key, string p_Message)
    {
        WriteEvent(1, p_AssemblyName, p_Key, p_Message);
    }

自从我们升级到任何大于4.5.2的.NET Framework版本后,我就遇到了这个问题。我终于解决了我的问题,希望这也能帮助你。我知道这是一个老帖子,但也许它也会帮助其他人

Windows事件跟踪(ETW)似乎可以处理错误,您得到的唯一指示是您看到的日志消息为null的位置。我正在使用从IEventTextFormatter派生的自定义格式化程序。(EventData.FormattedMessage为空)。在此方法中设置断点显示EventData.FormattedMessage为null。我还注意到Visual Studio的“输出/调试”窗口中有以下消息:

The parameters to the Event method do not match the parameters to the WriteEvent method. This may cause the event to be displayed incorrectly.
EventSourceException while processing event "WriteLogDefault": System.IndexOutOfRangeException:Index was outside the bounds of the array.
A first chance exception of type 'System.NullReferenceException' occurred in NEAM.App.ProfileDataMart.BL.dll
我将我的问题追溯到以下方法:

[Event(1, Message = "{2}", Level = EventLevel.Informational, Keywords = Keywords.Informational)]
private void WriteLogDefault(int p_EventId, string p_AssemblyName, int p_Key, string p_Message)
{
    WriteEvent(p_EventId, p_AssemblyName, p_Key, p_Message);
}
根据上的文档中的注释,对WriteEvent的调用应该包括EventId,后跟传递给方法的所有参数。显然,上述代码没有在.NETFramework 4.5.2或更早版本中引发任何异常

在EventSource派生类中实现标识为ETW事件的方法时。必须调用基类WriteEvent方法,传递EventId和与实现方法相同的参数

我的代码现在看起来像这样,并按预期工作。祝你好运

    [Event(1, Message = "{2}", Level = EventLevel.Informational, Keywords = Keywords.Informational)]
    public void WriteLogDefault(string p_AssemblyName, int p_Key, string p_Message)
    {
        WriteEvent(1, p_AssemblyName, p_Key, p_Message);
    }

我这样做了,我传递的是相同类型的确切数量的参数。请尝试我尝试的EventSource的NuGet版本,但似乎并不是所有消息都得到了处理。WAD或EventSource是否只能发送使用特定关键字或特定级别分类的事件?我只能通过WPR.exe将数据收集到ETL文件中,因此,我不知道其他收集工具是否有问题。这似乎取决于进程正在运行的机器:如果我通过分区到不同机器的同一个应用程序在5台机器上收集数据,只有在重新启动后,它似乎才能工作。我这样做,我正在传递相同类型的确切数量的参数。请尝试尝试尝试使用EventSource的NuGet版本,但似乎并不是所有消息都得到了处理。WAD或EventSource是否只能发送使用特定关键字或特定级别分类的事件?我只能通过WPR.exe将数据收集到ETL文件中,因此,我不知道其他收集工具是否有问题。这似乎取决于进程正在运行的机器:如果我通过分区到不同机器的同一应用程序在5台机器上收集数据,只有在重新启动后才能正常工作。有更新吗?您是否尝试通过Perfview将事件记录到ETL中?是否有更新?您是否尝试过通过Perfview将事件记录到ETL中?