static async Task <ImmutableDictionary <Document, ImmutableArray <Diagnostic> > > GetSpanDiagnosticsAsync( FixAllContext fixAllContext, IEnumerable <KeyValuePair <Document, ImmutableArray <TextSpan> > > documentsAndSpans) { var builder = PooledDictionary <Document, ArrayBuilder <Diagnostic> > .GetInstance(); foreach (var(document, spans) in documentsAndSpans) { foreach (var span in spans) { var documentDiagnostics = await fixAllContext.GetDocumentSpanDiagnosticsAsync(document, span).ConfigureAwait(false); builder.MultiAddRange(document, documentDiagnostics); } } return(builder.ToImmutableMultiDictionaryAndFree()); }