21 writes to Current
Microsoft.AspNetCore.SignalR.Core (4)
Internal\DefaultHubDispatcher.cs (4)
402Activity.Current = null; 430Activity.Current = previousActivity; 522Activity.Current = null; 594Activity.Current = previousActivity;
Microsoft.AspNetCore.SignalR.Tests (8)
HubConnectionHandlerTests.Activity.cs (8)
46Activity.Current = mockHttpRequestActivity; 121Activity.Current = mockHttpRequestActivity; 190Activity.Current = mockHttpRequestActivity; 249Activity.Current = mockHttpRequestActivity; 322Activity.Current = mockHttpRequestActivity; 369Activity.Current = mockHttpRequestActivity; 421Activity.Current = mockHttpRequestActivity; 472Activity.Current = mockHttpRequestActivity;
Microsoft.Extensions.AI (2)
ChatCompletion\FunctionInvokingChatClient.cs (1)
375Activity.Current = activity; // workaround for https://github.com/dotnet/runtime/issues/47802
ChatCompletion\OpenTelemetryChatClient.cs (1)
200Activity.Current = activity; // workaround for https://github.com/dotnet/runtime/issues/47802
Stress.ApiService (4)
Program.cs (4)
75Activity.Current = null; 83Activity.Current = current; 254Activity.Current = null; 261Activity.Current = current;
System.Net.Http (1)
System\Net\Http\SocketsHttpHandler\ConnectionPool\ConnectionSetupDistributedTracing.cs (1)
22Activity.Current = null;
System.Net.NameResolution (1)
System\Net\Dns.cs (1)
685Activity.Current = activityToRestore;
System.Net.Sockets (1)
System\Net\Sockets\SocketsTelemetry.cs (1)
101Activity.Current = activityToReset;
127 references to Current
Aspire.Dashboard (1)
Components\Pages\Error.razor.cs (1)
18RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier;
Aspire.Microsoft.Data.SqlClient (2)
src\Vendoring\OpenTelemetry.Instrumentation.SqlClient\Implementation\SqlClientDiagnosticListener.cs (1)
49var activity = Activity.Current;
src\Vendoring\OpenTelemetry.Instrumentation.SqlClient\Shared\DiagnosticSourceInstrumentation\DiagnosticSourceListener.cs (1)
35if (!this.handler.SupportsNullActivity && Activity.Current == null)
Aspire.Microsoft.EntityFrameworkCore.SqlServer (2)
src\Vendoring\OpenTelemetry.Instrumentation.SqlClient\Implementation\SqlClientDiagnosticListener.cs (1)
49var activity = Activity.Current;
src\Vendoring\OpenTelemetry.Instrumentation.SqlClient\Shared\DiagnosticSourceInstrumentation\DiagnosticSourceListener.cs (1)
35if (!this.handler.SupportsNullActivity && Activity.Current == null)
Aspire.StackExchange.Redis (1)
src\Vendoring\OpenTelemetry.Instrumentation.StackExchangeRedis\StackExchangeRedisConnectionInstrumentation.cs (1)
77var parent = Activity.Current;
ClaimsTransformation (1)
Controllers\HomeController.cs (1)
26return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
Cookies (1)
Controllers\HomeController.cs (1)
26return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
DynamicSchemes (1)
Pages\Error.cshtml.cs (1)
21RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
HostedBlazorWebassemblyApp.Server (1)
Pages\Error.cshtml.cs (1)
32RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
Identity.DefaultUI.WebSite (1)
Pages\Error.cshtml.cs (1)
19RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
Identity.ExternalClaims (1)
Pages\Error.cshtml.cs (1)
21RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
Microsoft.AspNetCore.Hosting.Tests (50)
HostingApplicationDiagnosticsTests.cs (46)
206measurementActivity = Activity.Current; 492Assert.Null(Activity.Current); 532Assert.Null(Activity.Current); 563Assert.Null(Activity.Current); 600Assert.NotNull(Activity.Current); 620Assert.NotNull(Activity.Current); 621Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 627Assert.NotNull(Activity.Current); 644Assert.NotNull(Activity.Current); 645Assert.True(Activity.Current.Duration > TimeSpan.Zero); 646Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 668Assert.NotNull(Activity.Current); 669Assert.True(Activity.Current.Duration > TimeSpan.Zero); 670Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 692Assert.NotNull(Activity.Current); 693Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 720Assert.NotNull(Activity.Current); 721Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 749Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 750Assert.Equal("ParentId1", Activity.Current.ParentId); 751Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key1" && pair.Value == "value1"); 752Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key2" && pair.Value == "value2"); 779Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 780Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key1" && pair.Value == "value1"); 781Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key2" && pair.Value == "value2"); 809Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 810Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key1" && pair.Value == "value1"); 811Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key2" && pair.Value == "value2"); 840Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 841Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key1" && pair.Value == "value3"); 842Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key2" && pair.Value == "value4"); 870Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 879Assert.Equal(expectedBaggage, Activity.Current.Baggage.ToArray()); 907Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 908Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key1" && pair.Value == "value1/1"); 937Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 938Assert.Equal(ActivityIdFormat.W3C, Activity.Current.IdFormat); 939Assert.Equal("0123456789abcdef0123456789abcdef", Activity.Current.TraceId.ToHexString()); 940Assert.Equal("0123456789abcdef", Activity.Current.ParentSpanId.ToHexString()); 941Assert.Equal("TraceState1", Activity.Current.TraceStateString); 943Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key1" && pair.Value == "value1"); 944Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key2" && pair.Value == "value2"); 1004Assert.Null(Activity.Current); 1015Assert.NotNull(Activity.Current); 1016Assert.True(Activity.Current.Recorded); 1031parentSpanId = Activity.Current.ParentSpanId.ToHexString();
HostingApplicationTests.cs (4)
113var initialActivity = Activity.Current; 118Assert.Equal(Activity.Current, dummyActivity); 122Assert.Equal(activityFeature.Activity.Id, Activity.Current.ParentId); 123Assert.NotEqual(Activity.Current, activityFeature.Activity);
Microsoft.AspNetCore.Http.Connections.Tests (1)
HttpConnectionDispatcherTests.cs (1)
3129Assert.Equal("true", Activity.Current.GetTagItem("http.long_running"));
Microsoft.AspNetCore.Http.Extensions (1)
DefaultProblemDetailsWriter.cs (1)
58var traceId = Activity.Current?.Id ?? httpContext.TraceIdentifier;
Microsoft.AspNetCore.Http.Extensions.Tests (15)
ProblemDetailsDefaultWriterTest.cs (15)
29var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier; 66var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier; 98var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier; 132var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier; 174var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier; 214var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier; 251var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier; 294var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier; 337var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier; 380var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier; 423var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier; 464var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier; 511var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier; 552var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier; 718var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier;
Microsoft.AspNetCore.Identity.UI (2)
Areas\Identity\Pages\V4\Error.cshtml.cs (1)
37RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
Areas\Identity\Pages\V5\Error.cshtml.cs (1)
37RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
Microsoft.AspNetCore.Mvc.Core (1)
Infrastructure\DefaultProblemDetailsFactory.cs (1)
105var traceId = Activity.Current?.Id ?? httpContext?.TraceIdentifier;
Microsoft.AspNetCore.Mvc.Core.Test (2)
DependencyInjection\ApiBehaviorOptionsSetupTest.cs (1)
110Assert.Equal(Activity.Current.Id, problemDetails.Extensions["traceId"]);
Infrastructure\ProblemDetalsClientErrorFactoryTest.cs (1)
91Assert.Equal(Activity.Current.Id, problemDetails.Extensions["traceId"]);
Microsoft.AspNetCore.Mvc.Core.TestCommon (1)
ActivityReplacer.cs (1)
20Debug.Assert(Activity.Current == _activity);
Microsoft.AspNetCore.Mvc.FunctionalTests (1)
XmlSerializerFormattersWrappingTest.cs (1)
211$"<traceId>{Activity.Current.Id}</traceId>" +
Microsoft.AspNetCore.SignalR.Client.Core (1)
HubConnection.cs (1)
1111if (activity is null && Activity.Current is not null && _logger.IsEnabled(LogLevel.Critical))
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (4)
HubConnectionTests.Tracing.cs (4)
86Assert.Equal(clientParentActivity1, Activity.Current); 108Assert.Equal(clientParentActivity2, Activity.Current); 280Assert.Equal(clientParentActivity, Activity.Current); 704Assert.Null(Activity.Current);
Microsoft.AspNetCore.SignalR.Core (5)
HubConnectionHandler.cs (1)
136OriginalActivity = Activity.Current,
Internal\DefaultHubDispatcher.cs (4)
399var previousActivity = Activity.Current; 428if (Activity.Current != previousActivity) 519var previousActivity = Activity.Current; 592if (Activity.Current != previousActivity)
Microsoft.Extensions.Logging (1)
LoggerFactoryScopeProvider.cs (1)
37Activity? activity = Activity.Current;
Microsoft.Extensions.Logging.EventSource (1)
EventSourceLogger.cs (1)
75Activity? activity = Activity.Current;
Microsoft.Extensions.Telemetry (1)
Logging\Import\LoggerFactoryScopeProvider.cs (1)
56Activity? activity = Activity.Current;
Microsoft.Extensions.Telemetry.Tests (1)
Logging\ExtendedLoggerFactoryTests.cs (1)
128Activity activity = Activity.Current!;
MvcFormSample (1)
Controllers\HomeController.cs (1)
48return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
OrderProcessor (2)
OrderProcessingWorker.cs (2)
68Activity.Current?.AddTag("order-id", order.Id); 69Activity.Current?.AddTag("product-count", order.Items.Count);
PathSchemeSelection (1)
Controllers\HomeController.cs (1)
26return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
StaticFilesAuth (1)
Controllers\HomeController.cs (1)
24return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
Stress.ApiService (2)
Program.cs (2)
74var current = Activity.Current; 253var current = Activity.Current;
System.Diagnostics.DiagnosticSource (14)
System\Diagnostics\Activity.cs (6)
18/// Carries the <see cref="Activity.Current"/> changed event data. 79/// Event occur when the <see cref="Activity.Current"/> value changes. 783/// <item>Sets <see cref="Parent"/> to hold <see cref="Current"/>.</item> 784/// <item>Sets <see cref="Current"/> to this activity.</item> 801_previousActiveActivity = Current; 842/// Stops activity: sets <see cref="Current"/> to <see cref="Parent"/>.
System\Diagnostics\ActivityCreationOptions.cs (2)
80IdFormat = Activity.Current != null ? Activity.Current.IdFormat : Activity.DefaultIdFormat;
System\Diagnostics\ActivitySource.cs (2)
288bool useCurrentActivityContext = context == default && Activity.Current != null; 289var aco = new ActivityCreationOptions<ActivityContext>(this, name, useCurrentActivityContext ? Activity.Current!.Context : context, kind, tags, links, idFormat);
System\Diagnostics\DiagnosticSourceActivity.cs (2)
19/// was started. Consumers could access <see cref="Activity.Current"/> 44/// that Activity was stopped. Consumers could access <see cref="Activity.Current"/>
System\Diagnostics\DsesFilterAndTransform.cs (1)
929return Activity.Current;
System\Diagnostics\PassThroughPropagator.cs (1)
46Activity? activity = Activity.Current;
System.Net.Http (4)
System\Net\Http\DiagnosticsHandler.cs (2)
51return Activity.Current != null || 65(Activity.Current is not null ||
System\Net\Http\SocketsHttpHandler\ConnectionPool\ConnectionSetupDistributedTracing.cs (1)
90Activity? requestActivity = Activity.Current;
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionWaiter.cs (1)
22return HttpTelemetry.Log.IsEnabled() || pool.Settings._metrics!.RequestsQueueDuration.Enabled || Activity.Current?.Source == DiagnosticsHandler.s_activitySource
System.Net.NameResolution (1)
System\Net\Dns.cs (1)
680Activity? activityToRestore = tracingEnabled ? Activity.Current : null;
System.Net.Sockets (1)
System\Net\Sockets\SocketsTelemetry.cs (1)
96Activity? activityToReset = keepActivityCurrent ? Activity.Current : null;