diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventProvider.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventProvider.cs index 620634893fdef..81a768f3b9b23 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventProvider.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventProvider.cs @@ -800,11 +800,6 @@ protected override unsafe void HandleEnableNotification( // change that needs more careful staging. List> sessionsChanged = GetChangedSessions(); - if (sessionsChanged.Count == 0) - { - sessionsChanged.Add(new KeyValuePair(new SessionInfo(0, 0), true)); - } - foreach (KeyValuePair session in sessionsChanged) { int sessionChanged = session.Key.sessionIdBit; @@ -858,7 +853,8 @@ internal override unsafe void Register(EventSource eventSource) _gcHandle = GCHandle.Alloc(this); long registrationHandle = 0; - Guid providerId = eventSource.Guid; + _providerId = eventSource.Guid; + Guid providerId = _providerId; uint status = Interop.Advapi32.EventRegister( &providerId, &Callback, @@ -872,7 +868,6 @@ internal override unsafe void Register(EventSource eventSource) Debug.Assert(_registrationHandle == 0); _registrationHandle = registrationHandle; - _providerId = providerId; } // Unregister an event provider.