You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Static field initialization order bug in LoggingEventSource causes ParseFilterSpec to silently produce wrong rules #127681
LoggingEventSource.ParseFilterSpec silently produces incorrect filter rules when OnEventCommand is invoked during the type's static initialization. s_semicolon and s_colon static fields are declared after the Instance field, so they are still null when the constructor runs and OnEventCommand fires re-entrantly due to a deferred event during the EventSource initialization. See:
Error callstack
LoggingEventSource.<cctor>() // Something ends up calling LoggingEventSource.Instance (probably on a log statement) which triggers static .
LoggingEventSource.Instance = new LoggingEventSource()
EventSource(EventSourceSettings.EtwSelfDescribingEventFormat) // base ctor
Initialize(guid, name, traits)
eventPipeProvider.Register(guid, name)
EventPipeInternal.CreateProvider(name, &Callback, ctx)
[native: EventPipe already has this provider enabled in active session]
[native: calls Callback synchronously]
// This callback sets the HandleEnableNotification as a deferred command.
[back in Initialize()]
EventListener.AddEventSource(this)
lock (EventListenersLock) {
deferredCommands = m_deferredCommands
DoCommand(deferredCommands)
OnEventCommand(args)
LoggingEventSource.OnEventCommand(args) // OVERRIDE
SetFilterSpec(value)
ParseFilterSpec(filterSpec, defaultLevel)
filterSpec.Split(s_semicolon, ...) // s_semicolon is null. splits on whitespace instead of ';'
}
m_completelyInited = true
[constructor finishes]
s_semicolon = new char[] { ';' } // TOO LATE
s_colon = new char[] { ':' }
// .cctor finishes
This silently drops events and registers the wrong FilterSpec. This regressed in the 8.0 package timeframe.
Activity
dotnet-policy-service commentedon May 2, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.
Add workaround for dotnet/runtime#127681
dotnet-policy-service commentedon May 2, 2026
Tagging subscribers to this area: @dotnet/area-extensions-logging
See info in area-owners.md if you want to be subscribed.
Reorder static fields in LoggingEventSource to prevent reentrant bug …
Simplify workaround for dotnet/runtime#127681
Reorder static fields in LoggingEventSource to prevent reentrant bug …