Move DiagnosticsHandler.IsGloballyEnabled back to a method (#55351)
authorSteve Pfister <steveisok@users.noreply.github.com>
Fri, 9 Jul 2021 03:17:47 +0000 (23:17 -0400)
committerGitHub <noreply@github.com>
Fri, 9 Jul 2021 03:17:47 +0000 (23:17 -0400)
Intent is to make linker substitutions happy and try to unblock dotnet/sdk#18801

src/libraries/System.Net.Http/src/System/Net/Http/DiagnosticsHandler.cs
src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.cs

index f3de5028d911c8ca2521dc3b559773a67be8b165..21b161f9fbb4a083859957eb8284318a9a58f4e5 100644 (file)
@@ -31,10 +31,10 @@ namespace System.Net.Http
         {
             // check if there is a parent Activity (and propagation is not suppressed)
             // or if someone listens to HttpHandlerDiagnosticListener
-            return IsGloballyEnabled && (Activity.Current != null || s_diagnosticListener.IsEnabled());
+            return IsGloballyEnabled() && (Activity.Current != null || s_diagnosticListener.IsEnabled());
         }
 
-        internal static bool IsGloballyEnabled => GlobalHttpSettings.DiagnosticsHandler.EnableActivityPropagation;
+        internal static bool IsGloballyEnabled() => GlobalHttpSettings.DiagnosticsHandler.EnableActivityPropagation;
 
         // SendAsyncCore returns already completed ValueTask for when async: false is passed.
         // Internally, it calls the synchronous Send method of the base class.
index 89cb508d220e40ac220006b95238d830fb35a5dd..2e3289643cfbed5cebfcfbfc79ba3c9da08e752a 100644 (file)
@@ -28,7 +28,7 @@ namespace System.Net.Http
         public HttpClientHandler()
         {
             _underlyingHandler = new HttpHandlerType();
-            if (DiagnosticsHandler.IsGloballyEnabled)
+            if (DiagnosticsHandler.IsGloballyEnabled())
             {
                 _diagnosticsHandler = new DiagnosticsHandler(_underlyingHandler);
             }