Consider this repro:
usingSystem.Diagnostics.Tracing;usingvar_=newMyListener();DateTimeend=DateTime.UtcNow.AddSeconds(5);while(DateTime.UtcNow<end)awaitTask.Run(()=>{});internalclassMyListener:EventListener{protectedoverridevoidOnEventSourceCreated(EventSourceeventSource){//// BLOCK 1//if (eventSource.Name == "System.Threading.Tasks.TplEventSource")// EnableEvents(eventSource, EventLevel.Informational, EventKeywords.All);//// BLOCK 2//if (eventSource.Name == "System.Threading.Tasks.TplEventSource")// EnableEvents(eventSource, EventLevel.LogAlways, EventKeywords.All);//// BLOCK 3//if (eventSource.Name == "Microsoft-Windows-DotNETRuntime")// EnableEvents(eventSource, EventLevel.Informational, EventKeywords.All);//// BLOCK 4//if (eventSource.Name == "Microsoft-Windows-DotNETRuntime")// EnableEvents(eventSource, EventLevel.LogAlways, EventKeywords.All);}protectedoverridevoidOnEventWritten(EventWrittenEventArgseventData)=>Console.WriteLine(string.Create(null,stackallocchar[1024],$"{eventData.EventSource.Name}{eventData.EventName}{eventData.EventId} => {eventData.Payload?.Count.ToString()??"(null)"}"));}Uncomment just block 1, 2, or 3, and all of them output events. But uncomment block 4... nothing.
EnableEvents(..., LogAlways, ...) is documented to log all events regardless of log level, but it doesn't appear to do that for events coming from NativeRuntimeEventSource.
cc: @noahfalk, @brianrob
Consider this repro:
Uncomment just block 1, 2, or 3, and all of them output events. But uncomment block 4... nothing.
EnableEvents(..., LogAlways, ...)is documented to log all events regardless of log level, but it doesn't appear to do that for events coming from NativeRuntimeEventSource.cc: @noahfalk, @brianrob