File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
src/coreclr/System.Private.CoreLib/src/System Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 3
3
4
4
using System ;
5
5
using System . Diagnostics ;
6
+ using System . Diagnostics . Tracing ;
6
7
using System . Diagnostics . CodeAnalysis ;
7
8
using System . IO ;
8
9
using System . Reflection ;
@@ -31,8 +32,11 @@ private static void ProcessStartupHooks()
31
32
if ( ! IsSupported )
32
33
return ;
33
34
34
- // Initialize tracing before any user code can be called.
35
- System . Diagnostics . Tracing . RuntimeEventSource . Initialize ( ) ;
35
+ // Initialize tracing before any user code can be called if EventSource is enabled.
36
+ if ( EventSource . IsSupported )
37
+ {
38
+ System . Diagnostics . Tracing . RuntimeEventSource . Initialize ( ) ;
39
+ }
36
40
37
41
string ? startupHooksVariable = AppContext . GetData ( "STARTUP_HOOKS" ) as string ;
38
42
if ( startupHooksVariable == null )
You can’t perform that action at this time.
0 commit comments