19 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;
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;
126 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)
201measurementActivity = Activity.Current; 487Assert.Null(Activity.Current); 527Assert.Null(Activity.Current); 558Assert.Null(Activity.Current); 595Assert.NotNull(Activity.Current); 615Assert.NotNull(Activity.Current); 616Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 622Assert.NotNull(Activity.Current); 639Assert.NotNull(Activity.Current); 640Assert.True(Activity.Current.Duration > TimeSpan.Zero); 641Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 663Assert.NotNull(Activity.Current); 664Assert.True(Activity.Current.Duration > TimeSpan.Zero); 665Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 687Assert.NotNull(Activity.Current); 688Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 715Assert.NotNull(Activity.Current); 716Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 744Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 745Assert.Equal("ParentId1", Activity.Current.ParentId); 746Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key1" && pair.Value == "value1"); 747Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key2" && pair.Value == "value2"); 774Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 775Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key1" && pair.Value == "value1"); 776Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key2" && pair.Value == "value2"); 804Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 805Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key1" && pair.Value == "value1"); 806Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key2" && pair.Value == "value2"); 835Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 836Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key1" && pair.Value == "value3"); 837Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key2" && pair.Value == "value4"); 865Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 874Assert.Equal(expectedBaggage, Activity.Current.Baggage.ToArray()); 902Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 903Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key1" && pair.Value == "value1/1"); 932Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 933Assert.Equal(ActivityIdFormat.W3C, Activity.Current.IdFormat); 934Assert.Equal("0123456789abcdef0123456789abcdef", Activity.Current.TraceId.ToHexString()); 935Assert.Equal("0123456789abcdef", Activity.Current.ParentSpanId.ToHexString()); 936Assert.Equal("TraceState1", Activity.Current.TraceStateString); 938Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key1" && pair.Value == "value1"); 939Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key2" && pair.Value == "value2"); 999Assert.Null(Activity.Current); 1010Assert.NotNull(Activity.Current); 1011Assert.True(Activity.Current.Recorded); 1026parentSpanId = 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 (14)
ProblemDetailsDefaultWriterTest.cs (14)
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;
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)
1105if (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)
67Activity.Current?.AddTag("order-id", order.Id); 68Activity.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;