private async ValueTask <ImmutableArray <IMethodSymbol>?> GetExtensionMethodSymbolsFromPeReferenceAsync( PortableExecutableReference peReference, bool forceCacheCreation, CancellationToken cancellationToken) { SymbolTreeInfo?symbolInfo; if (forceCacheCreation) { symbolInfo = await SymbolTreeInfo.GetInfoForMetadataReferenceAsync( _originatingDocument.Project.Solution, peReference, loadOnly : false, cancellationToken).ConfigureAwait(false); } else { var cachedInfoTask = SymbolTreeInfo.TryGetCachedInfoForMetadataReferenceIgnoreChecksumAsync(peReference, cancellationToken); if (cachedInfoTask.IsCompleted) { // Use cached data if available, even checksum doesn't match. We will update the cache in the background. symbolInfo = await cachedInfoTask.ConfigureAwait(false); } else { // No cached data immediately available, returns null to indicate index not ready return(null); } } if (symbolInfo is null || !symbolInfo.ContainsExtensionMethod || _originatingSemanticModel.Compilation.GetAssemblyOrModuleSymbol(peReference) is not IAssemblySymbol assembly) { return(ImmutableArray <IMethodSymbol> .Empty); } var filter = CreateAggregatedFilter(symbolInfo); var internalsVisible = _originatingSemanticModel.Compilation.Assembly.IsSameAssemblyOrHasFriendAccessTo(assembly); var matchingMethodSymbols = GetPotentialMatchingSymbolsFromAssembly(assembly, filter, internalsVisible, cancellationToken); return(GetExtensionMethodsForSymbolsFromSameCompilation(matchingMethodSymbols, cancellationToken)); }