I've had some ETW code in a PCL that's referenced and being used in a Windows 8.1 app that's been working for months. Specifically, this line of code:
WriteEvent((int)errorId, message, (useSysLog ? sysLogErrorId : SysLogSeverity.NotSpecified));
has been sending an array of objects to the Payload
property of the EventWrittenEventArgs
in my OnEventWritten
function of my EventListener
.
I would get a Payload
with a Count
of 2 and it would contain a string
and a SysLogSeverity
instance.
I've recently upgraded my Visual Studio to 2015 and now, my Payload
only contains a single property - the string
. The SysLogSeverity
is no longer coming through in OnEventWritten
.
Could upgrading to VS2015 be my problem? The library the ETW code is in didn't change when the upgrade took place. I've checked the git history of my project and no assembly versions have changed.
I'm at a loss for why this is happening and would really appreciate any ideas on how to debug this/what could be going on.
Update:
Here's what my helper method looks like that's calling the WriteEvent
function:
[NonEvent]
private void _WriteEvent(int errorId, string message, SysLogSeverity sysLogSeverity)
{
if (_errorLevelsMap.ContainsKey((ErrorIds)errorId))
{
sysLogSeverity = _errorLevelsMap[(ErrorIds)errorId];
}
if (this.IsEnabled())
{
WriteEvent((int)errorId, message, sysLogSeverity);
}
}
Here's the definition of _errorLevelsMap:
private readonly Dictionary<ErrorIds, SysLogSeverity> _errorLevelsMap = new Dictionary<ErrorIds, SysLogSeverity>
{
{ ErrorIds.Critical, SysLogSeverity.Critical },
{ ErrorIds.Error, SysLogSeverity.Error },
{ ErrorIds.Informational, SysLogSeverity.Informational },
{ ErrorIds.Verbose, SysLogSeverity.Debug },
{ ErrorIds.Warning, SysLogSeverity.Warning }
};
The signatures match and still, the Payload
only contains the message
; not the sysLogErrorId
.
Thanks!