diff --git a/src/coreclr/vm/eventpipeinternal.cpp b/src/coreclr/vm/eventpipeinternal.cpp index 9e7f79598264a..9d00e84800151 100644 --- a/src/coreclr/vm/eventpipeinternal.cpp +++ b/src/coreclr/vm/eventpipeinternal.cpp @@ -44,7 +44,10 @@ extern "C" UINT64 QCALLTYPE EventPipeInternal_Enable( nullptr, nullptr, nullptr); - EventPipeAdapter::StartStreaming(sessionID); + if (sessionID != 0) + { + EventPipeAdapter::StartStreaming(sessionID); + } } END_QCALL; diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventPipeEventDispatcher.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventPipeEventDispatcher.cs index c53bb2517927d..ee720c4798b72 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventPipeEventDispatcher.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventPipeEventDispatcher.cs @@ -104,7 +104,7 @@ private void CommitDispatchConfiguration() ulong sessionID = EventPipeInternal.Enable(null, EventPipeSerializationFormat.NetTrace, DefaultEventListenerCircularMBSize, providerConfiguration); if (sessionID == 0) { - throw new EventSourceException(SR.EventSource_CouldNotEnableEventPipe); + return; } // Get the session information that is required to properly dispatch events.