When complex types were added to EventSource (in V4.6) there was a latent bug where if the event had specified keywords
the event would not be emitted to TraceEvent-style ETW controlers (e.g. PerfVIew). Basically there was confusion
between a session bitmask (where the bits were 0, 1, 2, and 3), and the ETW keywords bitmask (which the 'ToEventKeywords()
morphs them to a Keywords Bitmask.)
This bug has existed foa a while, but we are now using both of those features (keywords and complex types), in the
DiagnosticEventSource and when we started to really use it we found the problem.
You will see in lines 1221 and 1242 is another code path that was already fixed, but we missed the cose path at 1977 and 1998.
This needs to be back-ported to the Desktop framework as well.
Commit migrated from https://github.com/dotnet/coreclr/commit/
42e6d1acf462c91ef8fa99b0953bee8ffd608240
m_eventData[eventId].Descriptor.Level,
m_eventData[eventId].Descriptor.Opcode,
m_eventData[eventId].Descriptor.Task,
- unchecked((long)(ulong)etwSessions | origKwd));
+ unchecked((long)etwSessions.ToEventKeywords() | origKwd));
if (!m_provider.WriteEvent(ref desc, pActivityId, childActivityID, args))
ThrowEventSourceException(m_eventData[eventId].Name);
// TODO: activity ID support
EventSourceOptions opt = new EventSourceOptions
{
- Keywords = (EventKeywords)unchecked((long)(ulong)etwSessions | origKwd),
+ Keywords = (EventKeywords)unchecked((long)etwSessions.ToEventKeywords() | origKwd),
Level = (EventLevel)m_eventData[eventId].Descriptor.Level,
Opcode = (EventOpcode)m_eventData[eventId].Descriptor.Opcode
};