diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs index 2761e0037e20a9..feabfae3e18835 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs @@ -3896,10 +3896,14 @@ internal static void InitializeDefaultEventSources() return; } -// NOTE: this define is being used inconsistently. Most places mean just EventPipe support, but then a few places use -// it to mean other aspects of tracing such as these EventSources. + // NOTE: this define is being used inconsistently. Most places mean just EventPipe support, but then a few places use + // it to mean other aspects of tracing such as these EventSources. #if FEATURE_PERFTRACING _ = NativeRuntimeEventSource.Log; + // ThreadPoolWorkQueue uses FrameworkEventSource during ThreadPool initialization. If that is the first time + // the FrameworkEventSource is being used, creating it on-demand will acquire the EventListener lock which can deadlock. + // See https://github.com/dotnet/runtime/issues/126591. We avoid that by pre-creating the FrameworkEventSource here. + _ = FrameworkEventSource.Log; #if !TARGET_BROWSER _ = RuntimeEventSource.Log; #endif