66 instantiations of AsyncLocal
Aspire.Dashboard.Tests (1)
TelemetryRepositoryTests\LogTests.cs (1)
571var asyncLocal = new AsyncLocal<string>();
Aspire.Hosting.Testing (1)
DistributedApplicationEntryPointInvoker.cs (1)
45private static readonly AsyncLocal<EntryPointInvoker> s_currentListener = new();
GetDocument.Insider (1)
.packages\microsoft.extensions.hostfactoryresolver.sources\10.0.0-preview.3.25155.12\contentFiles\cs\netstandard2.0\HostFactoryResolver.cs (1)
207private static readonly AsyncLocal<HostingListener> _currentListener = new();
InMemory.FunctionalTests (6)
RequestTests.cs (6)
316var local = new AsyncLocal<int>(); 350var local = new AsyncLocal<IntAsClass>(); 388var local = new AsyncLocal<int>(); 421var local = new AsyncLocal<int>(); 459var local = new AsyncLocal<IntAsClass>(); 501var local = new AsyncLocal<int>();
Microsoft.AspNetCore.Components.Server.Tests (2)
Circuits\CircuitHostTest.cs (2)
343var asyncLocal1 = new AsyncLocal<bool>(); 344var asyncLocal3 = new AsyncLocal<bool>();
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore (1)
DatabaseErrorPageMiddleware.cs (1)
24private static readonly AsyncLocal<DiagnosticHolder> _localDiagnostic = new AsyncLocal<DiagnosticHolder>();
Microsoft.AspNetCore.HeaderPropagation (1)
HeaderPropagationValues.cs (1)
13private static readonly AsyncLocal<IDictionary<string, StringValues>?> _headers = new AsyncLocal<IDictionary<string, StringValues>?>();
Microsoft.AspNetCore.Http (1)
HttpContextAccessor.cs (1)
14private static readonly AsyncLocal<HttpContextHolder> _httpContextCurrent = new AsyncLocal<HttpContextHolder>();
Microsoft.AspNetCore.Http.Extensions.Tests (1)
ValidationsGenerator\ValidationsGeneratorTestBase.cs (1)
350private static readonly AsyncLocal<HostingListener> _currentListener = new();
Microsoft.AspNetCore.InternalTesting (1)
RepeatContext.cs (1)
10private static readonly AsyncLocal<RepeatContext> _current = new AsyncLocal<RepeatContext>();
Microsoft.AspNetCore.Mvc.Core (1)
Infrastructure\ActionContextAccessor.cs (1)
17private static readonly AsyncLocal<ActionContext> _storage = new AsyncLocal<ActionContext>();
Microsoft.AspNetCore.Mvc.Testing (1)
.packages\microsoft.extensions.hostfactoryresolver.sources\10.0.0-preview.3.25155.12\contentFiles\cs\netstandard2.0\HostFactoryResolver.cs (1)
207private static readonly AsyncLocal<HostingListener> _currentListener = new();
Microsoft.AspNetCore.OpenApi.SourceGenerators.Tests (1)
SnapshotTestHelper.cs (1)
398private static readonly AsyncLocal<HostingListener> _currentListener = new();
Microsoft.AspNetCore.Shared.Tests (1)
NonCapturingTimerTest.cs (1)
17var message = new AsyncLocal<string>();
Microsoft.AspNetCore.TestHost (1)
.packages\microsoft.extensions.hostfactoryresolver.sources\10.0.0-preview.3.25155.12\contentFiles\cs\netstandard2.0\HostFactoryResolver.cs (1)
207private static readonly AsyncLocal<HostingListener> _currentListener = new();
Microsoft.AspNetCore.TestHost.Tests (2)
TestClientTests.cs (2)
888var asyncLocal = new AsyncLocal<object>(); 913var asyncLocal = new AsyncLocal<object>();
Microsoft.AspNetCore.Tests (1)
WebApplicationTests.cs (1)
2972private static readonly AsyncLocal<HostingListener> _currentListener = new();
Microsoft.Build (1)
ElementLocation\XmlDocumentWithLocation.cs (1)
59private readonly AsyncLocal<ElementLocation> _elementLocation = new AsyncLocal<ElementLocation>();
Microsoft.DotNet.Helix.Sdk (1)
LoggerExtensions.cs (1)
17private static readonly AsyncLocal<ImmutableStack<string>> s_localCategoryStack = new AsyncLocal<ImmutableStack<string>>();
Microsoft.DotNet.SwaggerGenerator.CodeGenerator (4)
Modeler\ServiceClientModelFactory.cs (4)
40private readonly AsyncLocal<Stack<string>> _propertyNameStack = new AsyncLocal<Stack<string>>(); 41private readonly AsyncLocal<Stack<string>> _typeNameStack = new AsyncLocal<Stack<string>>(); 42private readonly AsyncLocal<Stack<string>> _parameterNameStack = new AsyncLocal<Stack<string>>(); 43private readonly AsyncLocal<Stack<string>> _methodNameStack = new AsyncLocal<Stack<string>>();
Microsoft.Extensions.AI (1)
ChatCompletion\FunctionInvokingChatClient.cs (1)
49private static readonly AsyncLocal<FunctionInvocationContext?> _currentContext = new();
Microsoft.Extensions.AI.Tests (5)
ChatCompletion\UseDelegateChatClientTests.cs (4)
32AsyncLocal<int> asyncLocal = new(); 81AsyncLocal<int> asyncLocal = new(); 123AsyncLocal<int> asyncLocal = new(); 174AsyncLocal<int> asyncLocal = new();
Embeddings\UseDelegateEmbeddingGeneratorTests.cs (1)
31AsyncLocal<int> asyncLocal = new();
Microsoft.Extensions.AsyncState (1)
AsyncState.cs (1)
15private static readonly AsyncLocal<AsyncStateHolder> _asyncContextCurrent = new();
Microsoft.Extensions.Caching.Memory (1)
CacheEntry.cs (1)
18private static readonly AsyncLocal<CacheEntry?> _current = new AsyncLocal<CacheEntry?>();
Microsoft.Extensions.Http.Diagnostics (2)
Latency\Internal\HttpClientLatencyContext.cs (1)
11private readonly AsyncLocal<ILatencyContext?> _latencyContext = new();
Logging\Internal\OutgoingRequestContext.cs (1)
11private static readonly AsyncLocal<RequestMetadata> _asyncLocal = new();
Microsoft.Extensions.Logging (1)
LoggerFactoryScopeProvider.cs (1)
18private readonly AsyncLocal<Scope?> _currentScope = new AsyncLocal<Scope?>();
Microsoft.Extensions.Logging.Abstractions (1)
LoggerExternalScopeProvider.cs (1)
14private readonly AsyncLocal<Scope?> _currentScope = new AsyncLocal<Scope?>();
Microsoft.Extensions.Telemetry (1)
Logging\Import\LoggerFactoryScopeProvider.cs (1)
37private readonly AsyncLocal<Scope?> _currentScope = new AsyncLocal<Scope?>();
System.Diagnostics.DiagnosticSource (1)
System\Diagnostics\Activity.cs (1)
65private static readonly AsyncLocal<Activity?> s_current = new AsyncLocal<Activity?>();
System.Diagnostics.TraceSource (2)
System\Diagnostics\CorrelationManager.cs (2)
13private readonly AsyncLocal<Guid> _activityId = new AsyncLocal<Guid>(); 14private readonly AsyncLocal<StackNode?> _stack = new AsyncLocal<StackNode?>();
System.Private.CoreLib (6)
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\ActivityTracker.cs (1)
216m_current = new AsyncLocal<ActivityInfo?>(ActivityChanging);
src\libraries\System.Private.CoreLib\src\System\Globalization\CultureInfo.cs (2)
378Interlocked.CompareExchange(ref s_asyncLocalCurrentCulture, new AsyncLocal<CultureInfo>(AsyncLocalSetCurrentCulture), null); 400Interlocked.CompareExchange(ref s_asyncLocalCurrentUICulture, new AsyncLocal<CultureInfo>(AsyncLocalSetCurrentUICulture), null);
src\libraries\System.Private.CoreLib\src\System\Runtime\Loader\AssemblyLoadContext.cs (1)
531Interlocked.CompareExchange<AsyncLocal<AssemblyLoadContext?>?>(ref s_asyncLocalCurrent, new AsyncLocal<AssemblyLoadContext?>(), null);
src\libraries\System.Private.CoreLib\src\System\Runtime\Serialization\SerializationInfo.SerializationGuard.cs (1)
13internal static AsyncLocal<bool> AsyncDeserializationInProgress { get; } = new AsyncLocal<bool>();
src\libraries\System.Private.CoreLib\src\System\Threading\Thread.cs (1)
350Interlocked.CompareExchange(ref s_asyncLocalPrincipal, new AsyncLocal<IPrincipal?>(), null);
System.Threading (1)
System\Threading\HostExecutionContextManager.cs (1)
65_asyncLocal = new AsyncLocal<bool>();
System.Transactions.Local (1)
System\Transactions\Transaction.cs (1)
1061private static readonly AsyncLocal<ContextKey?> s_currentTransaction = new AsyncLocal<ContextKey?>();
Templates.Blazor.WebAssembly.Auth.Tests (3)
src\Shared\E2ETesting\BrowserTestBase.cs (3)
13private static readonly AsyncLocal<IWebDriver> _asyncBrowser = new AsyncLocal<IWebDriver>(); 14private static readonly AsyncLocal<ILogs> _logs = new AsyncLocal<ILogs>(); 15private static readonly AsyncLocal<ITestOutputHelper> _output = new AsyncLocal<ITestOutputHelper>();
Templates.Blazor.WebAssembly.Tests (3)
src\Shared\E2ETesting\BrowserTestBase.cs (3)
13private static readonly AsyncLocal<IWebDriver> _asyncBrowser = new AsyncLocal<IWebDriver>(); 14private static readonly AsyncLocal<ILogs> _logs = new AsyncLocal<ILogs>(); 15private static readonly AsyncLocal<ITestOutputHelper> _output = new AsyncLocal<ITestOutputHelper>();
Templates.Mvc.Tests (3)
src\Shared\E2ETesting\BrowserTestBase.cs (3)
13private static readonly AsyncLocal<IWebDriver> _asyncBrowser = new AsyncLocal<IWebDriver>(); 14private static readonly AsyncLocal<ILogs> _logs = new AsyncLocal<ILogs>(); 15private static readonly AsyncLocal<ITestOutputHelper> _output = new AsyncLocal<ITestOutputHelper>();
Templates.Tests (3)
src\Shared\E2ETesting\BrowserTestBase.cs (3)
13private static readonly AsyncLocal<IWebDriver> _asyncBrowser = new AsyncLocal<IWebDriver>(); 14private static readonly AsyncLocal<ILogs> _logs = new AsyncLocal<ILogs>(); 15private static readonly AsyncLocal<ITestOutputHelper> _output = new AsyncLocal<ITestOutputHelper>();
82 references to AsyncLocal
Aspire.Dashboard.Tests (1)
TelemetryRepositoryTests\LogTests.cs (1)
571var asyncLocal = new AsyncLocal<string>();
Aspire.Hosting.Testing (1)
DistributedApplicationEntryPointInvoker.cs (1)
45private static readonly AsyncLocal<EntryPointInvoker> s_currentListener = new();
GetDocument.Insider (1)
.packages\microsoft.extensions.hostfactoryresolver.sources\10.0.0-preview.3.25155.12\contentFiles\cs\netstandard2.0\HostFactoryResolver.cs (1)
207private static readonly AsyncLocal<HostingListener> _currentListener = new();
InMemory.FunctionalTests (6)
RequestTests.cs (6)
316var local = new AsyncLocal<int>(); 350var local = new AsyncLocal<IntAsClass>(); 388var local = new AsyncLocal<int>(); 421var local = new AsyncLocal<int>(); 459var local = new AsyncLocal<IntAsClass>(); 501var local = new AsyncLocal<int>();
Microsoft.AspNetCore.Components.Server.Tests (2)
Circuits\CircuitHostTest.cs (2)
343var asyncLocal1 = new AsyncLocal<bool>(); 344var asyncLocal3 = new AsyncLocal<bool>();
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore (1)
DatabaseErrorPageMiddleware.cs (1)
24private static readonly AsyncLocal<DiagnosticHolder> _localDiagnostic = new AsyncLocal<DiagnosticHolder>();
Microsoft.AspNetCore.HeaderPropagation (2)
HeaderPropagationMiddleware.cs (1)
26/// The <see cref="HeaderPropagationValues"/> that stores the request headers to be propagated in an <see cref="System.Threading.AsyncLocal{T}"/>
HeaderPropagationValues.cs (1)
13private static readonly AsyncLocal<IDictionary<string, StringValues>?> _headers = new AsyncLocal<IDictionary<string, StringValues>?>();
Microsoft.AspNetCore.Http (1)
HttpContextAccessor.cs (1)
14private static readonly AsyncLocal<HttpContextHolder> _httpContextCurrent = new AsyncLocal<HttpContextHolder>();
Microsoft.AspNetCore.Http.Abstractions (1)
IHttpContextAccessor.cs (1)
10/// This interface should be used with caution. It relies on <see cref="System.Threading.AsyncLocal{T}" /> which can have a negative performance impact on async calls.
Microsoft.AspNetCore.Http.Extensions.Tests (1)
ValidationsGenerator\ValidationsGeneratorTestBase.cs (1)
350private static readonly AsyncLocal<HostingListener> _currentListener = new();
Microsoft.AspNetCore.InternalTesting (1)
RepeatContext.cs (1)
10private static readonly AsyncLocal<RepeatContext> _current = new AsyncLocal<RepeatContext>();
Microsoft.AspNetCore.Mvc.Core (1)
Infrastructure\ActionContextAccessor.cs (1)
17private static readonly AsyncLocal<ActionContext> _storage = new AsyncLocal<ActionContext>();
Microsoft.AspNetCore.Mvc.Testing (1)
.packages\microsoft.extensions.hostfactoryresolver.sources\10.0.0-preview.3.25155.12\contentFiles\cs\netstandard2.0\HostFactoryResolver.cs (1)
207private static readonly AsyncLocal<HostingListener> _currentListener = new();
Microsoft.AspNetCore.OpenApi.SourceGenerators.Tests (1)
SnapshotTestHelper.cs (1)
398private static readonly AsyncLocal<HostingListener> _currentListener = new();
Microsoft.AspNetCore.Shared.Tests (1)
NonCapturingTimerTest.cs (1)
17var message = new AsyncLocal<string>();
Microsoft.AspNetCore.TestHost (3)
.packages\microsoft.extensions.hostfactoryresolver.sources\10.0.0-preview.3.25155.12\contentFiles\cs\netstandard2.0\HostFactoryResolver.cs (1)
207private static readonly AsyncLocal<HostingListener> _currentListener = new();
TestServer.cs (1)
137/// Gets or sets a value that controls if <see cref="ExecutionContext"/> and <see cref="AsyncLocal{T}"/> values are preserved from the client to the server. The default value is <see langword="false" />.
TestServerOptions.cs (1)
19/// Gets or sets a value that controls if <see cref="ExecutionContext"/> and <see cref="AsyncLocal{T}"/> values are preserved from the client to the server. The default value is <see langword="false" />.
Microsoft.AspNetCore.TestHost.Tests (2)
TestClientTests.cs (2)
888var asyncLocal = new AsyncLocal<object>(); 913var asyncLocal = new AsyncLocal<object>();
Microsoft.AspNetCore.Tests (1)
WebApplicationTests.cs (1)
2972private static readonly AsyncLocal<HostingListener> _currentListener = new();
Microsoft.Build (1)
ElementLocation\XmlDocumentWithLocation.cs (1)
59private readonly AsyncLocal<ElementLocation> _elementLocation = new AsyncLocal<ElementLocation>();
Microsoft.DotNet.Helix.Sdk (1)
LoggerExtensions.cs (1)
17private static readonly AsyncLocal<ImmutableStack<string>> s_localCategoryStack = new AsyncLocal<ImmutableStack<string>>();
Microsoft.DotNet.SwaggerGenerator.CodeGenerator (4)
Modeler\ServiceClientModelFactory.cs (4)
40private readonly AsyncLocal<Stack<string>> _propertyNameStack = new AsyncLocal<Stack<string>>(); 41private readonly AsyncLocal<Stack<string>> _typeNameStack = new AsyncLocal<Stack<string>>(); 42private readonly AsyncLocal<Stack<string>> _parameterNameStack = new AsyncLocal<Stack<string>>(); 43private readonly AsyncLocal<Stack<string>> _methodNameStack = new AsyncLocal<Stack<string>>();
Microsoft.Extensions.AI (1)
ChatCompletion\FunctionInvokingChatClient.cs (1)
49private static readonly AsyncLocal<FunctionInvocationContext?> _currentContext = new();
Microsoft.Extensions.AI.Tests (5)
ChatCompletion\UseDelegateChatClientTests.cs (4)
32AsyncLocal<int> asyncLocal = new(); 81AsyncLocal<int> asyncLocal = new(); 123AsyncLocal<int> asyncLocal = new(); 174AsyncLocal<int> asyncLocal = new();
Embeddings\UseDelegateEmbeddingGeneratorTests.cs (1)
31AsyncLocal<int> asyncLocal = new();
Microsoft.Extensions.AsyncState (2)
AsyncState.cs (1)
15private static readonly AsyncLocal<AsyncStateHolder> _asyncContextCurrent = new();
IAsyncState.cs (1)
11/// Encapsulates all information within the asynchronous flow in an <see cref="AsyncLocal{T}"/> variable.
Microsoft.Extensions.Caching.Memory (2)
CacheEntry.cs (2)
18private static readonly AsyncLocal<CacheEntry?> _current = new AsyncLocal<CacheEntry?>(); 47AsyncLocal<CacheEntry?> holder = _current;
Microsoft.Extensions.Http.Diagnostics (2)
Latency\Internal\HttpClientLatencyContext.cs (1)
11private readonly AsyncLocal<ILatencyContext?> _latencyContext = new();
Logging\Internal\OutgoingRequestContext.cs (1)
11private static readonly AsyncLocal<RequestMetadata> _asyncLocal = new();
Microsoft.Extensions.Logging (1)
LoggerFactoryScopeProvider.cs (1)
18private readonly AsyncLocal<Scope?> _currentScope = new AsyncLocal<Scope?>();
Microsoft.Extensions.Logging.Abstractions (1)
LoggerExternalScopeProvider.cs (1)
14private readonly AsyncLocal<Scope?> _currentScope = new AsyncLocal<Scope?>();
Microsoft.Extensions.Telemetry (1)
Logging\Import\LoggerFactoryScopeProvider.cs (1)
37private readonly AsyncLocal<Scope?> _currentScope = new AsyncLocal<Scope?>();
mscorlib (1)
src\libraries\shims\mscorlib\ref\mscorlib.cs (1)
1118[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Threading.AsyncLocal<>))]
netstandard (1)
netstandard.cs (1)
2065[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Threading.AsyncLocal<>))]
System.Diagnostics.DiagnosticSource (1)
System\Diagnostics\Activity.cs (1)
65private static readonly AsyncLocal<Activity?> s_current = new AsyncLocal<Activity?>();
System.Diagnostics.TraceSource (4)
System\Diagnostics\CorrelationManager.cs (4)
13private readonly AsyncLocal<Guid> _activityId = new AsyncLocal<Guid>(); 14private readonly AsyncLocal<StackNode?> _stack = new AsyncLocal<StackNode?>(); 53private readonly AsyncLocal<StackNode?> _stack; 55internal AsyncLocalStackWrapper(AsyncLocal<StackNode?> stack)
System.Private.CoreLib (11)
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\ActivityTracker.cs (1)
601private AsyncLocal<ActivityInfo?>? m_current;
src\libraries\System.Private.CoreLib\src\System\Globalization\CultureInfo.cs (2)
116private static AsyncLocal<CultureInfo>? s_asyncLocalCurrentCulture; 117private static AsyncLocal<CultureInfo>? s_asyncLocalCurrentUICulture;
src\libraries\System.Private.CoreLib\src\System\Runtime\Loader\AssemblyLoadContext.cs (2)
499private static AsyncLocal<AssemblyLoadContext?>? s_asyncLocalCurrent; 531Interlocked.CompareExchange<AsyncLocal<AssemblyLoadContext?>?>(ref s_asyncLocalCurrent, new AsyncLocal<AssemblyLoadContext?>(), null);
src\libraries\System.Private.CoreLib\src\System\Runtime\Serialization\SerializationInfo.SerializationGuard.cs (1)
13internal static AsyncLocal<bool> AsyncDeserializationInProgress { get; } = new AsyncLocal<bool>();
src\libraries\System.Private.CoreLib\src\System\Threading\AsyncLocal.cs (4)
16/// <summary>Instantiates an <see cref="AsyncLocal{T}"/> instance that does not receive change notifications.</summary> 21/// <summary>Instantiates an <see cref="AsyncLocal{T}"/> instance that receives change notifications.</summary> 58/// <summary>Interface to allow non-generic code in ExecutionContext to call into the generic <see cref="AsyncLocal{T}"/> type.</summary> 64/// <summary>The class that provides data change information to <see cref="AsyncLocal{T}"/> instances that register for change notifications.</summary>
src\libraries\System.Private.CoreLib\src\System\Threading\Thread.cs (1)
19private static AsyncLocal<IPrincipal?>? s_asyncLocalPrincipal;
System.Threading (2)
artifacts\obj\System.Threading\Debug\net10.0\System.Threading.Forwards.cs (1)
5[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Threading.AsyncLocal<>))]
System\Threading\HostExecutionContextManager.cs (1)
57public AsyncLocal<bool>? _asyncLocal;
System.Transactions.Local (1)
System\Transactions\Transaction.cs (1)
1061private static readonly AsyncLocal<ContextKey?> s_currentTransaction = new AsyncLocal<ContextKey?>();
Templates.Blazor.WebAssembly.Auth.Tests (3)
src\Shared\E2ETesting\BrowserTestBase.cs (3)
13private static readonly AsyncLocal<IWebDriver> _asyncBrowser = new AsyncLocal<IWebDriver>(); 14private static readonly AsyncLocal<ILogs> _logs = new AsyncLocal<ILogs>(); 15private static readonly AsyncLocal<ITestOutputHelper> _output = new AsyncLocal<ITestOutputHelper>();
Templates.Blazor.WebAssembly.Tests (3)
src\Shared\E2ETesting\BrowserTestBase.cs (3)
13private static readonly AsyncLocal<IWebDriver> _asyncBrowser = new AsyncLocal<IWebDriver>(); 14private static readonly AsyncLocal<ILogs> _logs = new AsyncLocal<ILogs>(); 15private static readonly AsyncLocal<ITestOutputHelper> _output = new AsyncLocal<ITestOutputHelper>();
Templates.Mvc.Tests (3)
src\Shared\E2ETesting\BrowserTestBase.cs (3)
13private static readonly AsyncLocal<IWebDriver> _asyncBrowser = new AsyncLocal<IWebDriver>(); 14private static readonly AsyncLocal<ILogs> _logs = new AsyncLocal<ILogs>(); 15private static readonly AsyncLocal<ITestOutputHelper> _output = new AsyncLocal<ITestOutputHelper>();
Templates.Tests (3)
src\Shared\E2ETesting\BrowserTestBase.cs (3)
13private static readonly AsyncLocal<IWebDriver> _asyncBrowser = new AsyncLocal<IWebDriver>(); 14private static readonly AsyncLocal<ILogs> _logs = new AsyncLocal<ILogs>(); 15private static readonly AsyncLocal<ITestOutputHelper> _output = new AsyncLocal<ITestOutputHelper>();