When using System.Diagnostics.Eventing.Reader.EventLogQuery
to read events from the Windows Event Log, the EventRecord.FormatDescription()
method sometimes returns null. Why is this? In the Event Viewer there are messages on the events which return null.
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Generic Generics in Managed C++
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
This is due to a bug in the .NET framework.
Basically what you need to do to work around this bug is to set the CurrentCulture to "en-US".
Example:
This workaround
iswas very hard to find, so I thought I would document it a place where it will be indexed by Google. I found it in an old MS Connect case, but it has been closed with a status of "wont fix".UPDATE: The bug has been reported for .NET 4 as well and the status is "Sent to Engineering Team for consideration" and comment alluding that the bug might be fixed in the next major .NET framework release (v5).
so i've been struggling with this for a few days too. I couldn't get it to work by changing the culture. In the end, i just used the raw data in the Properties property of the event record. The message data is in there, it's just not pretty. (just about good enough for my audit needs though :-))