1 type derived from AsyncLazy
Microsoft.CodeAnalysis.Workspaces (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
42private sealed class AsyncLazyImpl<TData> : AsyncLazy<T>
88 references to AsyncLazy
Microsoft.CodeAnalysis.Workspaces (88)
FindSymbols\Declarations\DeclarationFinder.cs (1)
69AsyncLazy<IAssemblySymbol?> lazyAssembly,
FindSymbols\Declarations\DeclarationFinder_AllDeclarations.cs (1)
66var lazyCompilation = AsyncLazy.Create(static (project, cancellationToken) =>
FindSymbols\FindReferences\DependentTypeFinder_ProjectIndex.cs (2)
24private static readonly ConditionalWeakTable<ProjectState, AsyncLazy<ProjectIndex>> s_projectToIndex = new(); 35if (!s_projectToIndex.TryGetValue(project.State, out var lazyIndex))
FindSymbols\FindReferences\FindReferenceCache.cs (2)
26private static readonly ConditionalWeakTable<Document, AsyncLazy<FindReferenceCache>> s_cache = new(); 30var lazy = s_cache.GetValue(document, static document => AsyncLazy.Create(ComputeCacheAsync, document));
FindSymbols\SymbolTree\SymbolTreeInfo.cs (4)
130SearchQuery query, AsyncLazy<IAssemblySymbol?> lazyAssembly, 143SearchQuery query, AsyncLazy<IAssemblySymbol?> lazyAssembly, CancellationToken cancellationToken) 168AsyncLazy<IAssemblySymbol?> lazyAssembly, string name, CancellationToken cancellationToken) 214AsyncLazy<IAssemblySymbol?> lazyAssembly,
FindSymbols\SymbolTree\SymbolTreeInfo_Metadata.cs (6)
40private static readonly ConditionalWeakTable<PortableExecutableReference, AsyncLazy<SymbolTreeInfo>> s_peReferenceToInfo = new(); 52private static readonly ConditionalWeakTable<MetadataId, AsyncLazy<SymbolTreeInfo>> s_metadataIdToSymbolTreeInfo = new(); 133if (s_peReferenceToInfo.TryGetValue(reference, out var infoTask)) 159var asyncLazy = s_peReferenceToInfo.GetValue( 179var asyncLazy = s_metadataIdToSymbolTreeInfo.GetValue( 203if (!s_peReferenceToInfo.TryGetValue(reference, out var infoTask))
FindSymbols\SymbolTree\SymbolTreeInfo_Source.cs (2)
68private static readonly ConditionalWeakTable<ProjectState, AsyncLazy<Checksum>> s_projectToSourceChecksum = new(); 72var lazy = s_projectToSourceChecksum.GetValue(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy.cs (9)
13public static AsyncLazy<T> Create<T, TArg>(Func<TArg, CancellationToken, Task<T>> asynchronousComputeFunction, Func<TArg, CancellationToken, T>? synchronousComputeFunction, TArg arg) 14=> AsyncLazy<T>.Create(asynchronousComputeFunction, synchronousComputeFunction, arg); 16public static AsyncLazy<T> Create<T, TArg>(Func<TArg, CancellationToken, Task<T>> asynchronousComputeFunction, TArg arg) 22public static AsyncLazy<T> Create<T, TArg>(Func<TArg, CancellationToken, T> synchronousComputeFunction, TArg arg) 28public static AsyncLazy<T> Create<T>(Func<CancellationToken, Task<T>> asynchronousComputeFunction) 33public static AsyncLazy<T> Create<T>(Func<CancellationToken, T> synchronousComputeFunction) 38public static AsyncLazy<T> Create<T>(Func<CancellationToken, Task<T>> asynchronousComputeFunction, Func<CancellationToken, T> synchronousComputeFunction) 44public static AsyncLazy<T> Create<T>(T value) 45=> AsyncLazy<T>.Create<T>(value);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (5)
20public static AsyncLazy<T> Create<TData>( 28public static AsyncLazy<T> Create<TData>(T value) 38/// Creators of an <see cref="AsyncLazy{T}" /> can specify whether the result of the computation is 121public static AsyncLazy<T> CreateImpl(T value) 124public static AsyncLazy<T> CreateImpl(
Workspace\Solution\AnalyzerConfigDocumentState.cs (2)
15private readonly AsyncLazy<AnalyzerConfig> _lazyAnalyzerConfig; 23AsyncLazy<AnalyzerConfig>? lazyAnalyzerConfig = null)
Workspace\Solution\Document.cs (2)
560private AsyncLazy<DocumentOptionSet>? _cachedOptions; 583var newAsyncLazy = AsyncLazy.Create(static async (arg, cancellationToken) =>
Workspace\Solution\DocumentState_LinkedFileReuse.cs (2)
25AsyncLazy<TreeAndVersion> lazyComputation) : ITreeAndVersionSource 117var lazyComputation = AsyncLazy.Create(
Workspace\Solution\DocumentState_TreeTextSource.cs (1)
18private sealed class TreeTextSource(AsyncLazy<SourceText> textSource, VersionStamp version) : ITextAndVersionSource
Workspace\Solution\ProjectState.AnalyzerConfigOptionsCache.cs (1)
37public readonly AsyncLazy<Value> Lazy = AsyncLazy.Create(
Workspace\Solution\ProjectState.cs (17)
47private readonly AsyncLazy<VersionStamp> _lazyLatestDocumentVersion; 48private readonly AsyncLazy<VersionStamp> _lazyLatestDocumentTopLevelChangeVersion; 51private AsyncLazy<ProjectStateChecksums>? _lazyChecksums; 54private AsyncLazy<Dictionary<ImmutableArray<byte>, DocumentId>>? _lazyContentHashToDocumentId; 73AsyncLazy<VersionStamp> lazyLatestDocumentVersion, 74AsyncLazy<VersionStamp> lazyLatestDocumentTopLevelChangeVersion, 154private AsyncLazy<ProjectStateChecksums> LazyChecksums 170private AsyncLazy<Dictionary<ImmutableArray<byte>, DocumentId>> LazyContentHashToDocumentId 249private AsyncLazy<VersionStamp> CreateLazyLatestDocumentTopLevelChangeVersion( 711AsyncLazy<VersionStamp>? latestDocumentVersion = null, 712AsyncLazy<VersionStamp>? latestDocumentTopLevelChangeVersion = null, 1002out var dependentDocumentVersion, 1003out var dependentSemanticVersion); 1027out var dependentDocumentVersion, 1028out var dependentSemanticVersion); 1063out AsyncLazy<VersionStamp> dependentDocumentVersion, 1064out AsyncLazy<VersionStamp> dependentSemanticVersion)
Workspace\Solution\Solution.cs (6)
37private readonly AsyncLazy<Solution> _cachedFrozenSolution; 43private readonly Dictionary<DocumentId, AsyncLazy<Solution>> _documentIdToFrozenSolution = []; 47AsyncLazy<Solution>? cachedFrozenSolution = null) 1516AsyncLazy<Solution> GetLazySolution() 1520if (!_documentIdToFrozenSolution.TryGetValue(documentId, out var lazySolution)) 1531static AsyncLazy<Solution> CreateLazyFrozenSolution(SolutionCompilationState compilationState, DocumentId documentId)
Workspace\Solution\SolutionCompilationState.cs (3)
57private readonly AsyncLazy<SolutionCompilationState> _cachedFrozenSnapshot; 65AsyncLazy<SolutionCompilationState>? cachedFrozenSnapshot = null) 120AsyncLazy<SolutionCompilationState>? cachedFrozenSnapshot = null)
Workspace\Solution\SolutionCompilationState.RegularCompilationTracker.cs (3)
1008private AsyncLazy<VersionStamp>? _lazyDependentVersion; 1009private AsyncLazy<VersionStamp>? _lazyDependentSemanticVersion; 1010private AsyncLazy<Checksum>? _lazyDependentChecksum;
Workspace\Solution\SolutionCompilationState.SkeletonReferenceCache.cs (2)
101private static readonly ConditionalWeakTable<Compilation, AsyncLazy<SkeletonReferenceSet?>> s_compilationToSkeletonSet = new(); 210var lazy = s_compilationToSkeletonSet.GetValue(compilation,
Workspace\Solution\SolutionCompilationState.WithFrozenSourceGeneratedDocumentsCompilationTracker.cs (1)
31private AsyncLazy<Checksum>? _lazyDependentChecksum;
Workspace\Solution\SolutionCompilationState_Checksum.cs (4)
28private readonly AsyncLazy<SolutionCompilationStateChecksums> _lazyChecksums; 34private readonly Dictionary<ProjectId, AsyncLazy<(SolutionCompilationStateChecksums checksums, ProjectCone projectCone)>> _lazyProjectChecksums = []; 41AsyncLazy<(SolutionCompilationStateChecksums checksums, ProjectCone projectCone)>? lazyChecksums; 78AsyncLazy<(SolutionCompilationStateChecksums checksums, ProjectCone projectCone)>? checksums;
Workspace\Solution\SolutionCompilationState_SourceGenerators.cs (3)
24using AnalyzerReferenceMap = ConditionalWeakTable<IReadOnlyList<AnalyzerReference>, AsyncLazy<bool>>; 114if (!analyzerReferenceMap.TryGetValue(projectState.AnalyzerReferences, out var lazy)) 122AsyncLazy<bool> GetLazy(AnalyzerReferenceMap analyzerReferenceMap, ProjectState projectState)
Workspace\Solution\SolutionState_Checksum.cs (4)
31private readonly AsyncLazy<SolutionStateChecksums> _lazyChecksums; 37private readonly Dictionary<ProjectId, AsyncLazy<SolutionStateChecksums>> _lazyProjectChecksums = []; 47AsyncLazy<SolutionStateChecksums>? checksums; 77AsyncLazy<SolutionStateChecksums>? checksums;
Workspace\Solution\TextDocumentState.cs (1)
25private readonly AsyncLazy<DocumentStateChecksums> _lazyChecksums;
Workspace\Solution\VersionSource\SimpleTreeAndVersionSource.cs (4)
15/// cref="AsyncLazy{TreeAndVersion}"/>."/> 19private readonly AsyncLazy<TreeAndVersion> _source; 21private SimpleTreeAndVersionSource(AsyncLazy<TreeAndVersion> source) 39return new(AsyncLazy<TreeAndVersion>.Create(asynchronousComputeFunction, synchronousComputeFunction, arg));