Skip to content

Commit

Permalink
Move DiagnosticsHandler.IsGloballyEnabled back to a method (#55351)
Browse files Browse the repository at this point in the history
Intent is to make linker substitutions happy and try to unblock dotnet/sdk#18801
  • Loading branch information
steveisok authored Jul 9, 2021
1 parent b2a5499 commit 03cb946
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ internal static bool IsEnabled()
{
// 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public partial class HttpClientHandler : HttpMessageHandler
public HttpClientHandler()
{
_underlyingHandler = new HttpHandlerType();
if (DiagnosticsHandler.IsGloballyEnabled)
if (DiagnosticsHandler.IsGloballyEnabled())
{
_diagnosticsHandler = new DiagnosticsHandler(_underlyingHandler);
}
Expand Down

0 comments on commit 03cb946

Please sign in to comment.