6 instantiations of ImmutableDictionary
System.Collections.Immutable (6)
System\Collections\Immutable\ImmutableDictionary_2.cs (6)
25public static readonly ImmutableDictionary<TKey, TValue> Empty = new ImmutableDictionary<TKey, TValue>();
449return new ImmutableDictionary<TKey, TValue>(_root, comparers, _count);
455var set = new ImmutableDictionary<TKey, TValue>(comparers);
841: new ImmutableDictionary<TKey, TValue>(comparers);
1052return new ImmutableDictionary<TKey, TValue>(root, comparers, count);
1070return root.IsEmpty ? this.Clear() : new ImmutableDictionary<TKey, TValue>(root, _comparers, adjustedCountIfDifferentRoot);
3390 references to ImmutableDictionary
Analyzer.Utilities.UnitTests (1)
AnalyzerRunner (20)
DiagnosticAnalyzerRunner.cs (13)
27private readonly ImmutableDictionary<string, ImmutableArray<DiagnosticAnalyzer>> _analyzers;
34var analyzers = GetDiagnosticAnalyzers(options.AnalyzerPath);
49var modifiedSpecificDiagnosticOptions = project.CompilationOptions.SpecificDiagnosticOptions
86var analysisResult = await GetAnalysisResultAsync(solution, _analyzers, _options, cancellationToken).ConfigureAwait(false);
178private static async Task<DocumentAnalyzerPerformance> TestDocumentPerformanceAsync(ImmutableDictionary<string, ImmutableArray<DiagnosticAnalyzer>> analyzers, Project project, DocumentId documentId, Options analyzerOptionsInternal, CancellationToken cancellationToken)
232private static ImmutableDictionary<string, ImmutableArray<DiagnosticAnalyzer>> FilterAnalyzers(ImmutableDictionary<string, ImmutableArray<DiagnosticAnalyzer>> analyzers, Options options)
285private static ImmutableDictionary<string, ImmutableArray<DiagnosticAnalyzer>> GetDiagnosticAnalyzers(string path)
304private static ImmutableDictionary<string, ImmutableArray<DiagnosticAnalyzer>> GetDiagnosticAnalyzersFromFile(string path)
309return ImmutableDictionary<string, ImmutableArray<DiagnosticAnalyzer>>.Empty
314private static async Task<ImmutableDictionary<ProjectId, AnalysisResult>> GetAnalysisResultAsync(
316ImmutableDictionary<string, ImmutableArray<DiagnosticAnalyzer>> analyzers,
407internal static void WriteTelemetry(ImmutableDictionary<ProjectId, AnalysisResult> dictionary)
Aspire.Dashboard (2)
Aspire.Dashboard.Components.Tests (2)
Aspire.Dashboard.Tests (1)
BuildActionTelemetryTable (3)
ILLink.RoslynAnalyzer (10)
Metrics (49)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (12)
27ImmutableDictionary<string, string?>? properties,
35ImmutableDictionary<string, string?>? properties,
54ImmutableDictionary<string, string?>? properties,
64ImmutableDictionary<string, string?>? properties,
89ImmutableDictionary<string, string?>? properties,
102properties: ImmutableDictionary<string, string?>.Empty,
108ImmutableDictionary<string, string?>? properties,
116ImmutableDictionary<string, string?>? properties,
143ImmutableDictionary<string, string?>? properties,
184ImmutableDictionary<string, string?>? properties,
250var options = (ImmutableDictionary<string, ReportDiagnostic>)s_syntaxTreeDiagnosticOptionsProperty.GetValue(tree)!;
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (19)
30private readonly ImmutableDictionary<string, TValue> _names;
31private readonly ImmutableDictionary<ISymbol, TValue> _symbols;
53private readonly ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> _wildcardNamesBySymbolKind;
62private SymbolNamesWithValueOption(ImmutableDictionary<string, TValue> names, ImmutableDictionary<ISymbol, TValue> symbols,
63ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> wildcardNamesBySymbolKind)
74_names = ImmutableDictionary<string, TValue>.Empty;
75_symbols = ImmutableDictionary<ISymbol, TValue>.Empty;
76_wildcardNamesBySymbolKind = ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>>.Empty;
309if (_wildcardNamesBySymbolKind.TryGetValue(symbol.Kind, out var names) &&
319if (_wildcardNamesBySymbolKind.TryGetValue(AllKinds, out var value) &&
329if (_wildcardNamesBySymbolKind.TryGetValue(AllKinds, out var allKindsValue) &&
372internal ref readonly ImmutableDictionary<string, TValue> Names => ref _symbolNamesWithValueOption._names;
374internal ref readonly ImmutableDictionary<ISymbol, TValue> Symbols => ref _symbolNamesWithValueOption._symbols;
376internal ref readonly ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> WildcardNamesBySymbolKind => ref _symbolNamesWithValueOption._wildcardNamesBySymbolKind;
Metrics.Legacy (49)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (12)
27ImmutableDictionary<string, string?>? properties,
35ImmutableDictionary<string, string?>? properties,
54ImmutableDictionary<string, string?>? properties,
64ImmutableDictionary<string, string?>? properties,
89ImmutableDictionary<string, string?>? properties,
102properties: ImmutableDictionary<string, string?>.Empty,
108ImmutableDictionary<string, string?>? properties,
116ImmutableDictionary<string, string?>? properties,
143ImmutableDictionary<string, string?>? properties,
184ImmutableDictionary<string, string?>? properties,
250var options = (ImmutableDictionary<string, ReportDiagnostic>)s_syntaxTreeDiagnosticOptionsProperty.GetValue(tree)!;
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (19)
30private readonly ImmutableDictionary<string, TValue> _names;
31private readonly ImmutableDictionary<ISymbol, TValue> _symbols;
53private readonly ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> _wildcardNamesBySymbolKind;
62private SymbolNamesWithValueOption(ImmutableDictionary<string, TValue> names, ImmutableDictionary<ISymbol, TValue> symbols,
63ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> wildcardNamesBySymbolKind)
74_names = ImmutableDictionary<string, TValue>.Empty;
75_symbols = ImmutableDictionary<ISymbol, TValue>.Empty;
76_wildcardNamesBySymbolKind = ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>>.Empty;
309if (_wildcardNamesBySymbolKind.TryGetValue(symbol.Kind, out var names) &&
319if (_wildcardNamesBySymbolKind.TryGetValue(AllKinds, out var value) &&
329if (_wildcardNamesBySymbolKind.TryGetValue(AllKinds, out var allKindsValue) &&
372internal ref readonly ImmutableDictionary<string, TValue> Names => ref _symbolNamesWithValueOption._names;
374internal ref readonly ImmutableDictionary<ISymbol, TValue> Symbols => ref _symbolNamesWithValueOption._symbols;
376internal ref readonly ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> WildcardNamesBySymbolKind => ref _symbolNamesWithValueOption._wildcardNamesBySymbolKind;
Microsoft.Analyzers.Extra.Tests (1)
Microsoft.AspNetCore.Analyzers (2)
Microsoft.AspNetCore.Components.Endpoints (14)
FormMapping\Converters\DictionaryAdapters\ImmutableDictionaryBufferAdapter.cs (10)
9: IDictionaryBufferAdapter<ImmutableDictionary<TKey, TValue>, ImmutableDictionary<TKey, TValue>.Builder, TKey, TValue>
12public static ImmutableDictionary<TKey, TValue>.Builder Add(ref ImmutableDictionary<TKey, TValue>.Builder buffer, TKey key, TValue value)
18public static ImmutableDictionary<TKey, TValue>.Builder CreateBuffer() => ImmutableDictionary.CreateBuilder<TKey, TValue>();
20public static ImmutableDictionary<TKey, TValue> ToResult(ImmutableDictionary<TKey, TValue>.Builder buffer) => buffer.ToImmutable();
27ImmutableDictionary<TKey, TValue>,
29ImmutableDictionary<TKey, TValue>.Builder,
32ImmutableDictionary<TKey, TValue>.Builder,
Microsoft.AspNetCore.Components.Endpoints.Tests (6)
Binding\FormDataMapperTests.cs (6)
913var expected = ImmutableDictionary.CreateRange(new Dictionary<int, int>() { [0] = 10, [1] = 11, [2] = 12, [3] = 13, [4] = 14, [5] = 15, [6] = 16, [7] = 17, [8] = 18, [9] = 19, });
914CanDeserialize_Dictionary<ImmutableDictionary<int, int>, ImmutableDictionary<int, int>, int, int>(expected);
929var expected = ImmutableDictionary.CreateRange(new Dictionary<int, int>() { [0] = 10, [1] = 11, [2] = 12, [3] = 13, [4] = 14, [5] = 15, [6] = 16, [7] = 17, [8] = 18, [9] = 19, });
951var dictionary = Assert.IsType<ImmutableDictionary<int, int>>(result);
Microsoft.AspNetCore.Http.Extensions (14)
src\Components\Endpoints\src\FormMapping\Converters\DictionaryAdapters\ImmutableDictionaryBufferAdapter.cs (10)
9: IDictionaryBufferAdapter<ImmutableDictionary<TKey, TValue>, ImmutableDictionary<TKey, TValue>.Builder, TKey, TValue>
12public static ImmutableDictionary<TKey, TValue>.Builder Add(ref ImmutableDictionary<TKey, TValue>.Builder buffer, TKey key, TValue value)
18public static ImmutableDictionary<TKey, TValue>.Builder CreateBuffer() => ImmutableDictionary.CreateBuilder<TKey, TValue>();
20public static ImmutableDictionary<TKey, TValue> ToResult(ImmutableDictionary<TKey, TValue>.Builder buffer) => buffer.ToImmutable();
27ImmutableDictionary<TKey, TValue>,
29ImmutableDictionary<TKey, TValue>.Builder,
32ImmutableDictionary<TKey, TValue>.Builder,
Microsoft.AspNetCore.Mvc.ApiExplorer (1)
Microsoft.AspNetCore.Server.HttpSys (1)
Microsoft.AspNetCore.Server.IIS (1)
Microsoft.AspNetCore.Shared.Tests (1)
Microsoft.Build (35)
CopyOnWriteDictionary.cs (11)
37private static readonly ImmutableDictionary<string, V> NameComparerDictionaryPrototype = ImmutableDictionary.Create<string, V>(MSBuildNameIgnoreCaseComparer.Default);
44private static readonly ImmutableDictionary<string, V> OrdinalIgnoreCaseComparerDictionaryPrototype = ImmutableDictionary.Create<string, V>(StringComparer.OrdinalIgnoreCase);
52private ImmutableDictionary<string, V> _backing;
59_backing = ImmutableDictionary<string, V>.Empty;
80var b = GetInitialDictionary((IEqualityComparer<string>?)comparer);
85private static ImmutableDictionary<string, V> GetInitialDictionary(IEqualityComparer<string>? keyComparer)
236ImmutableDictionary<string, V> initial = _backing;
290ImmutableDictionary<string, V> initial = _backing;
301public ImmutableDictionary<string, V>.Enumerator GetEnumerator()
308ImmutableDictionary<string, V>.Enumerator enumerator = _backing.GetEnumerator();
399ImmutableDictionary<string, V> snapshot = _backing;
Microsoft.Build.BuildCheck.UnitTests (14)
Microsoft.Build.Engine.UnitTests (1)
Microsoft.Build.Framework (12)
RoslynImmutableInterlocked.cs (8)
266/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue, TArg}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TArg, TValue}, TArg)"/>
286/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue})"/>
306/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue)"/>
334/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue}, Func{TKey, TValue, TValue})"/>
372/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue, Func{TKey, TValue, TValue})"/>
408/// <inheritdoc cref="ImmutableInterlocked.TryAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue)"/>
434/// <inheritdoc cref="ImmutableInterlocked.TryUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue, TValue)"/>
462/// <inheritdoc cref="ImmutableInterlocked.TryRemove{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, out TValue)"/>
Microsoft.Build.Tasks.Core (11)
CopyOnWriteDictionary.cs (11)
37private static readonly ImmutableDictionary<string, V> NameComparerDictionaryPrototype = ImmutableDictionary.Create<string, V>(MSBuildNameIgnoreCaseComparer.Default);
44private static readonly ImmutableDictionary<string, V> OrdinalIgnoreCaseComparerDictionaryPrototype = ImmutableDictionary.Create<string, V>(StringComparer.OrdinalIgnoreCase);
52private ImmutableDictionary<string, V> _backing;
59_backing = ImmutableDictionary<string, V>.Empty;
80var b = GetInitialDictionary((IEqualityComparer<string>?)comparer);
85private static ImmutableDictionary<string, V> GetInitialDictionary(IEqualityComparer<string>? keyComparer)
236ImmutableDictionary<string, V> initial = _backing;
290ImmutableDictionary<string, V> initial = _backing;
301public ImmutableDictionary<string, V>.Enumerator GetEnumerator()
308ImmutableDictionary<string, V>.Enumerator enumerator = _backing.GetEnumerator();
399ImmutableDictionary<string, V> snapshot = _backing;
Microsoft.Build.Utilities.Core (11)
CopyOnWriteDictionary.cs (11)
37private static readonly ImmutableDictionary<string, V> NameComparerDictionaryPrototype = ImmutableDictionary.Create<string, V>(MSBuildNameIgnoreCaseComparer.Default);
44private static readonly ImmutableDictionary<string, V> OrdinalIgnoreCaseComparerDictionaryPrototype = ImmutableDictionary.Create<string, V>(StringComparer.OrdinalIgnoreCase);
52private ImmutableDictionary<string, V> _backing;
59_backing = ImmutableDictionary<string, V>.Empty;
80var b = GetInitialDictionary((IEqualityComparer<string>?)comparer);
85private static ImmutableDictionary<string, V> GetInitialDictionary(IEqualityComparer<string>? keyComparer)
236ImmutableDictionary<string, V> initial = _backing;
290ImmutableDictionary<string, V> initial = _backing;
301public ImmutableDictionary<string, V>.Enumerator GetEnumerator()
308ImmutableDictionary<string, V>.Enumerator enumerator = _backing.GetEnumerator();
399ImmutableDictionary<string, V> snapshot = _backing;
Microsoft.CodeAnalysis (231)
CommandLine\AnalyzerConfigSet.cs (16)
19using AnalyzerOptions = System.Collections.Immutable.ImmutableDictionary<string, string>;
20using TreeOptions = System.Collections.Immutable.ImmutableDictionary<string, Microsoft.CodeAnalysis.ReportDiagnostic>;
54private readonly ObjectPool<TreeOptions.Builder> _treeOptionsPool =
55new ObjectPool<TreeOptions.Builder>(() => ImmutableDictionary.CreateBuilder<string, ReportDiagnostic>(Section.PropertiesKeyComparer));
57private readonly ObjectPool<AnalyzerOptions.Builder> _analyzerOptionsPool =
58new ObjectPool<AnalyzerOptions.Builder>(() => ImmutableDictionary.CreateBuilder<string, string>(Section.PropertiesKeyComparer));
395private static void ParseSectionOptions(Section section, TreeOptions.Builder treeBuilder, AnalyzerOptions.Builder analyzerBuilder, ArrayBuilder<Diagnostic> diagnosticBuilder, string analyzerConfigPath, ConcurrentDictionary<ReadOnlyMemory<char>, string> diagIdCache)
477private ImmutableDictionary<string, ImmutableDictionary<string, (string value, string configPath, int globalLevel)>.Builder>.Builder? _values;
478private ImmutableDictionary<string, ImmutableDictionary<string, (int globalLevel, ArrayBuilder<string> configPaths)>.Builder>.Builder? _duplicates;
487_values = ImmutableDictionary.CreateBuilder<string, ImmutableDictionary<string, (string, string, int)>.Builder>(Section.NameEqualityComparer);
488_duplicates = ImmutableDictionary.CreateBuilder<string, ImmutableDictionary<string, (int, ArrayBuilder<string>)>.Builder>(Section.NameEqualityComparer);
516return new GlobalAnalyzerConfig(new Section(GlobalSectionName, AnalyzerOptions.Empty), ImmutableArray<Section>.Empty);
557var result = dict.ToImmutableDictionary(d => d.Key, d => d.Value.value, Section.PropertiesKeyComparer);
Diagnostic\Diagnostic.cs (13)
63/// <see cref="ImmutableDictionary{TKey, TValue}.Empty"/>.
70ImmutableDictionary<string, string?>? properties,
110/// <see cref="ImmutableDictionary{TKey, TValue}.Empty"/>.
118ImmutableDictionary<string, string?>? properties,
138/// <see cref="ImmutableDictionary{TKey, TValue}.Empty"/>.
147ImmutableDictionary<string, string?>? properties,
192/// <see cref="ImmutableDictionary{TKey, TValue}.Empty"/>.
209ImmutableDictionary<string, string?>? properties = null)
242/// <see cref="ImmutableDictionary{TKey, TValue}.Empty"/>.
260ImmutableDictionary<string, string?>? properties = null)
407/// Gets property bag for the diagnostic. it will return <see cref="ImmutableDictionary{TKey, TValue}.Empty"/>
411public virtual ImmutableDictionary<string, string?> Properties
412=> ImmutableDictionary<string, string?>.Empty;
DiagnosticAnalyzer\AnalysisResult.cs (19)
24ImmutableDictionary<SyntaxTree, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>> localSyntaxDiagnostics,
25ImmutableDictionary<SyntaxTree, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>> localSemanticDiagnostics,
26ImmutableDictionary<AdditionalText, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>> localAdditionalFileDiagnostics,
27ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>> nonLocalDiagnostics,
28ImmutableDictionary<DiagnosticAnalyzer, AnalyzerTelemetryInfo> analyzerTelemetryInfo)
46public ImmutableDictionary<SyntaxTree, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>> SyntaxDiagnostics { get; }
51public ImmutableDictionary<SyntaxTree, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>> SemanticDiagnostics { get; }
56public ImmutableDictionary<AdditionalText, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>> AdditionalFileDiagnostics { get; }
61public ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>> CompilationDiagnostics { get; }
66public ImmutableDictionary<DiagnosticAnalyzer, AnalyzerTelemetryInfo> AnalyzerTelemetryInfo { get; }
113ImmutableDictionary<T, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>> localDiagnostics,
133ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>> nonLocalDiagnostics,
DiagnosticAnalyzer\AnalysisResultBuilder.cs (20)
24private static readonly ImmutableDictionary<string, OneOrMany<AdditionalText>> s_emptyPathToAdditionalTextMap =
25ImmutableDictionary<string, OneOrMany<AdditionalText>>.Empty.WithComparers(PathUtilities.Comparer);
34private readonly ImmutableDictionary<string, OneOrMany<AdditionalText>> _pathToAdditionalTextMap;
63private static ImmutableDictionary<string, OneOrMany<AdditionalText>> CreatePathToAdditionalTextMap(ImmutableArray<AdditionalText> additionalFiles)
503ImmutableDictionary<SyntaxTree, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>> localSyntaxDiagnostics;
504ImmutableDictionary<SyntaxTree, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>> localSemanticDiagnostics;
505ImmutableDictionary<AdditionalText, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>> localAdditionalFileDiagnostics;
506ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>> nonLocalDiagnostics;
519var analyzerTelemetryInfo = GetTelemetryInfo(analyzers);
523private static ImmutableDictionary<TKey, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>> GetImmutable<TKey>(
531return ImmutableDictionary<TKey, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>>.Empty;
534var builder = ImmutableDictionary.CreateBuilder<TKey, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>>();
559private static ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>> GetImmutable(
566return ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>.Empty;
585private ImmutableDictionary<DiagnosticAnalyzer, AnalyzerTelemetryInfo> GetTelemetryInfo(
DiagnosticAnalyzer\CompilerDiagnosticAnalyzer.CompilationAnalyzer.cs (8)
17private static readonly ImmutableDictionary<string, string?> s_syntactic = ImmutableDictionary<string, string?>.Empty.Add(Origin, Syntactic);
18private static readonly ImmutableDictionary<string, string?> s_declaration = ImmutableDictionary<string, string?>.Empty.Add(Origin, Declaration);
63ImmutableDictionary<string, string?>? properties = null)
79private readonly ImmutableDictionary<string, string?> _properties;
81public CompilerDiagnostic(Diagnostic original, ImmutableDictionary<string, string?> properties)
100public override ImmutableDictionary<string, string?> Properties => _properties;
Operations\ControlFlowGraph.cs (4)
27private readonly ImmutableDictionary<IMethodSymbol, (ControlFlowRegion region, ILocalFunctionOperation operation, int ordinal)> _localFunctionsMap;
29private readonly ImmutableDictionary<IFlowAnonymousFunctionOperation, (ControlFlowRegion region, int ordinal)> _anonymousFunctionsMap;
37ImmutableDictionary<IMethodSymbol, (ControlFlowRegion region, ILocalFunctionOperation operation, int ordinal)> localFunctionsMap,
38ImmutableDictionary<IFlowAnonymousFunctionOperation, (ControlFlowRegion region, int ordinal)> anonymousFunctionsMap)
Operations\ControlFlowGraphBuilder.RegionBuilder.cs (7)
298ImmutableDictionary<IMethodSymbol, (ControlFlowRegion region, ILocalFunctionOperation operation, int ordinal)>.Builder localFunctionsMap,
299ImmutableDictionary<IFlowAnonymousFunctionOperation, (ControlFlowRegion region, int ordinal)>.Builder? anonymousFunctionsMapOpt,
383(ImmutableDictionary<IFlowAnonymousFunctionOperation, (ControlFlowRegion region, int ordinal)>.Builder map, ControlFlowRegion region) argument = (anonymousFunctionsMapOpt, result);
399OperationVisitor<(ImmutableDictionary<IFlowAnonymousFunctionOperation, (ControlFlowRegion region, int ordinal)>.Builder map, ControlFlowRegion region), IOperation>
405(ImmutableDictionary<IFlowAnonymousFunctionOperation, (ControlFlowRegion region, int ordinal)>.Builder map, ControlFlowRegion region) argument)
411internal override IOperation? VisitNoneOperation(IOperation operation, (ImmutableDictionary<IFlowAnonymousFunctionOperation, (ControlFlowRegion region, int ordinal)>.Builder map, ControlFlowRegion region) argument)
418(ImmutableDictionary<IFlowAnonymousFunctionOperation, (ControlFlowRegion region, int ordinal)>.Builder map, ControlFlowRegion region) argument)
ReferenceManager\CommonReferenceManager.State.cs (10)
48internal abstract ImmutableDictionary<AssemblyIdentity, PortableExecutableReference?> ImplicitReferenceResolutions { get; }
132private ImmutableDictionary<AssemblyIdentity, PortableExecutableReference?>? _lazyImplicitReferenceResolutions;
188private ImmutableDictionary<MetadataReference, ImmutableArray<MetadataReference>>? _lazyMergedAssemblyReferencesMap;
259internal override ImmutableDictionary<AssemblyIdentity, PortableExecutableReference?> ImplicitReferenceResolutions
324internal ImmutableDictionary<MetadataReference, ImmutableArray<MetadataReference>> MergedAssemblyReferencesMap
414ImmutableDictionary<AssemblyIdentity, PortableExecutableReference?> implicitReferenceResolutions,
444_lazyMergedAssemblyReferencesMap = mergedAssemblyReferencesMapOpt?.ToImmutableDictionary() ?? ImmutableDictionary<MetadataReference, ImmutableArray<MetadataReference>>.Empty;
542internal static ImmutableDictionary<AssemblyIdentity, AssemblyIdentity> GetAssemblyReferenceIdentityBaselineMap(ImmutableArray<TAssemblySymbol> symbols, ImmutableArray<AssemblyIdentity> originalIdentities)
546ImmutableDictionary<AssemblyIdentity, AssemblyIdentity>.Builder? lazyBuilder = null;
576return lazyBuilder?.ToImmutable() ?? ImmutableDictionary<AssemblyIdentity, AssemblyIdentity>.Empty;
SourceGeneration\GeneratorState.cs (18)
26ImmutableDictionary<string, ImmutableArray<IncrementalGeneratorRunStep>>.Empty,
27ImmutableDictionary<string, ImmutableArray<IncrementalGeneratorRunStep>>.Empty,
28ImmutableDictionary<string, object>.Empty,
41ImmutableDictionary<string, ImmutableArray<IncrementalGeneratorRunStep>>.Empty,
42ImmutableDictionary<string, ImmutableArray<IncrementalGeneratorRunStep>>.Empty,
43ImmutableDictionary<string, object>.Empty,
55ImmutableDictionary<string, ImmutableArray<IncrementalGeneratorRunStep>> executedSteps,
56ImmutableDictionary<string, ImmutableArray<IncrementalGeneratorRunStep>> outputSteps,
57ImmutableDictionary<string, object> hostOutputs,
76ImmutableDictionary<string, ImmutableArray<IncrementalGeneratorRunStep>> executedSteps,
77ImmutableDictionary<string, ImmutableArray<IncrementalGeneratorRunStep>> outputSteps,
78ImmutableDictionary<string, object> hostOutputs,
100ImmutableDictionary<string, ImmutableArray<IncrementalGeneratorRunStep>>.Empty,
101ImmutableDictionary<string, ImmutableArray<IncrementalGeneratorRunStep>>.Empty,
102ImmutableDictionary<string, object>.Empty,
123internal ImmutableDictionary<string, ImmutableArray<IncrementalGeneratorRunStep>> ExecutedSteps { get; }
125internal ImmutableDictionary<string, ImmutableArray<IncrementalGeneratorRunStep>> OutputSteps { get; }
127internal ImmutableDictionary<string, object> HostOutputs { get; }
SourceGeneration\Nodes\GeneratorRunStateTable.cs (7)
15private GeneratorRunStateTable(ImmutableDictionary<string, ImmutableArray<IncrementalGeneratorRunStep>> executedSteps, ImmutableDictionary<string, ImmutableArray<IncrementalGeneratorRunStep>> outputSteps)
21public ImmutableDictionary<string, ImmutableArray<IncrementalGeneratorRunStep>> ExecutedSteps { get; }
23public ImmutableDictionary<string, ImmutableArray<IncrementalGeneratorRunStep>> OutputSteps { get; }
57private static ImmutableDictionary<string, ImmutableArray<IncrementalGeneratorRunStep>> StepCollectionToImmutable(Dictionary<string, HashSet<IncrementalGeneratorRunStep>>? builder)
61return ImmutableDictionary<string, ImmutableArray<IncrementalGeneratorRunStep>>.Empty;
64ImmutableDictionary<string, ImmutableArray<IncrementalGeneratorRunStep>>.Builder resultBuilder = ImmutableDictionary.CreateBuilder<string, ImmutableArray<IncrementalGeneratorRunStep>>();
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (8)
390/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue, TArg}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TArg, TValue}, TArg)"/>
410/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue})"/>
430/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue)"/>
458/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue}, Func{TKey, TValue, TValue})"/>
496/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue, Func{TKey, TValue, TValue})"/>
532/// <inheritdoc cref="ImmutableInterlocked.TryAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue)"/>
558/// <inheritdoc cref="ImmutableInterlocked.TryUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue, TValue)"/>
586/// <inheritdoc cref="ImmutableInterlocked.TryRemove{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, out TValue)"/>
Microsoft.CodeAnalysis.Analyzers (75)
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer.cs (5)
27using PooledResourcesDataValueConcurrentDictionary = PooledConcurrentDictionary<string, ImmutableDictionary<string, (string value, Location location)>>;
222out ImmutableDictionary<string, ImmutableArray<(string? prefix, int start, int end)>>? categoryAndAllowedIdsMap,
672var properties = ImmutableDictionary<string, string?>.Empty.Add(DefineDescriptorArgumentCorrectlyFixValue, fixValue);
849var map = GetOrCreateResourceMap(options, resourceFileName, resourceDataValueMap, cancellationToken);
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer_IdRangeAndCategoryValidation.cs (3)
140ImmutableDictionary<string, ImmutableArray<(string? prefix, int start, int end)>>? categoryAndAllowedIdsInfoMap,
197[NotNullWhen(returnValue: true)] out ImmutableDictionary<string, ImmutableArray<(string? prefix, int start, int end)>>? categoryAndAllowedIdsMap,
230[NotNullWhen(returnValue: true)] out ImmutableDictionary<string, ImmutableArray<(string? prefix, int start, int end)>>? categoryAndAllowedIdsInfoMap,
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer_ResourceStringsFormat.cs (6)
19using PooledResourcesDataValueConcurrentDictionary = PooledConcurrentDictionary<string, ImmutableDictionary<string, (string value, Location location)>>;
36private static ImmutableDictionary<string, (string value, Location location)> GetOrCreateResourceMap(
46if (resourceMap.TryGetValue(resourceFileName, out var map))
55private static ImmutableDictionary<string, (string value, Location location)> CreateResourceMap(AnalyzerOptions options, string resourceFileName, CancellationToken cancellationToken)
66return ImmutableDictionary<string, (string value, Location location)>.Empty;
68static ImmutableDictionary<string, (string value, Location location)> CreateResourceMapForFile(AdditionalText file, CancellationToken cancellationToken)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (12)
27ImmutableDictionary<string, string?>? properties,
35ImmutableDictionary<string, string?>? properties,
54ImmutableDictionary<string, string?>? properties,
64ImmutableDictionary<string, string?>? properties,
89ImmutableDictionary<string, string?>? properties,
102properties: ImmutableDictionary<string, string?>.Empty,
108ImmutableDictionary<string, string?>? properties,
116ImmutableDictionary<string, string?>? properties,
143ImmutableDictionary<string, string?>? properties,
184ImmutableDictionary<string, string?>? properties,
250var options = (ImmutableDictionary<string, ReportDiagnostic>)s_syntaxTreeDiagnosticOptionsProperty.GetValue(tree)!;
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (19)
30private readonly ImmutableDictionary<string, TValue> _names;
31private readonly ImmutableDictionary<ISymbol, TValue> _symbols;
53private readonly ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> _wildcardNamesBySymbolKind;
62private SymbolNamesWithValueOption(ImmutableDictionary<string, TValue> names, ImmutableDictionary<ISymbol, TValue> symbols,
63ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> wildcardNamesBySymbolKind)
74_names = ImmutableDictionary<string, TValue>.Empty;
75_symbols = ImmutableDictionary<ISymbol, TValue>.Empty;
76_wildcardNamesBySymbolKind = ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>>.Empty;
309if (_wildcardNamesBySymbolKind.TryGetValue(symbol.Kind, out var names) &&
319if (_wildcardNamesBySymbolKind.TryGetValue(AllKinds, out var value) &&
329if (_wildcardNamesBySymbolKind.TryGetValue(AllKinds, out var allKindsValue) &&
372internal ref readonly ImmutableDictionary<string, TValue> Names => ref _symbolNamesWithValueOption._names;
374internal ref readonly ImmutableDictionary<ISymbol, TValue> Symbols => ref _symbolNamesWithValueOption._symbols;
376internal ref readonly ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> WildcardNamesBySymbolKind => ref _symbolNamesWithValueOption._wildcardNamesBySymbolKind;
Microsoft.CodeAnalysis.Analyzers.UnitTests (4)
Microsoft.CodeAnalysis.AnalyzerUtilities (179)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (12)
27ImmutableDictionary<string, string?>? properties,
35ImmutableDictionary<string, string?>? properties,
54ImmutableDictionary<string, string?>? properties,
64ImmutableDictionary<string, string?>? properties,
89ImmutableDictionary<string, string?>? properties,
102properties: ImmutableDictionary<string, string?>.Empty,
108ImmutableDictionary<string, string?>? properties,
116ImmutableDictionary<string, string?>? properties,
143ImmutableDictionary<string, string?>? properties,
184ImmutableDictionary<string, string?>? properties,
250var options = (ImmutableDictionary<string, ReportDiagnostic>)s_syntaxTreeDiagnosticOptionsProperty.GetValue(tree)!;
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (19)
30private readonly ImmutableDictionary<string, TValue> _names;
31private readonly ImmutableDictionary<ISymbol, TValue> _symbols;
53private readonly ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> _wildcardNamesBySymbolKind;
62private SymbolNamesWithValueOption(ImmutableDictionary<string, TValue> names, ImmutableDictionary<ISymbol, TValue> symbols,
63ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> wildcardNamesBySymbolKind)
74_names = ImmutableDictionary<string, TValue>.Empty;
75_symbols = ImmutableDictionary<ISymbol, TValue>.Empty;
76_wildcardNamesBySymbolKind = ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>>.Empty;
309if (_wildcardNamesBySymbolKind.TryGetValue(symbol.Kind, out var names) &&
319if (_wildcardNamesBySymbolKind.TryGetValue(AllKinds, out var value) &&
329if (_wildcardNamesBySymbolKind.TryGetValue(AllKinds, out var allKindsValue) &&
372internal ref readonly ImmutableDictionary<string, TValue> Names => ref _symbolNamesWithValueOption._names;
374internal ref readonly ImmutableDictionary<ISymbol, TValue> Symbols => ref _symbolNamesWithValueOption._symbols;
376internal ref readonly ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> WildcardNamesBySymbolKind => ref _symbolNamesWithValueOption._wildcardNamesBySymbolKind;
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PointsToAnalysis\PointsToAnalysisResult.cs (7)
14private readonly ImmutableDictionary<IOperation, ImmutableHashSet<AbstractLocation>> _escapedLocationsThroughOperationsMap;
15private readonly ImmutableDictionary<IOperation, ImmutableHashSet<AbstractLocation>> _escapedLocationsThroughReturnValuesMap;
16private readonly ImmutableDictionary<AnalysisEntity, ImmutableHashSet<AbstractLocation>> _escapedLocationsThroughEntitiesMap;
22ImmutableDictionary<IOperation, ImmutableHashSet<AbstractLocation>> escapedLocationsThroughOperationsMap,
23ImmutableDictionary<IOperation, ImmutableHashSet<AbstractLocation>> escapedLocationsThroughReturnValuesMap,
24ImmutableDictionary<AnalysisEntity, ImmutableHashSet<AbstractLocation>> escapedLocationsThroughEntitiesMap,
46ImmutableDictionary<TKey, ImmutableHashSet<AbstractLocation>> map)
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\TaintedDataAnalysis\TaintedDataConfig.cs (10)
33private static ImmutableDictionary<SinkKind, ImmutableHashSet<SourceInfo>> s_sinkKindToSourceInfo
39private static ImmutableDictionary<SinkKind, ImmutableHashSet<SanitizerInfo>> s_sinkKindToSanitizerInfo
45private static ImmutableDictionary<SinkKind, bool> s_sinkKindHasTaintArraySource
58private ImmutableDictionary<SinkKind, Lazy<TaintedDataSymbolMap<SourceInfo>>> SourceSymbolMap { get; }
63private ImmutableDictionary<SinkKind, Lazy<TaintedDataSymbolMap<SanitizerInfo>>> SanitizerSymbolMap { get; }
68private ImmutableDictionary<SinkKind, Lazy<TaintedDataSymbolMap<SinkInfo>>> SinkSymbolMap { get; }
82ImmutableDictionary<SinkKind, Lazy<TaintedDataSymbolMap<SourceInfo>>> sourceSymbolMap,
83ImmutableDictionary<SinkKind, Lazy<TaintedDataSymbolMap<SanitizerInfo>>> sanitizerSymbolMap,
84ImmutableDictionary<SinkKind, Lazy<TaintedDataSymbolMap<SinkInfo>>> sinkSymbolMap)
191private TaintedDataSymbolMap<T> GetFromMap<T>(SinkKind sinkKind, ImmutableDictionary<SinkKind, Lazy<TaintedDataSymbolMap<T>>> map)
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\DataFlowAnalysisResult.cs (11)
25private readonly ImmutableDictionary<BasicBlock, TBlockAnalysisResult> _basicBlockStateMap;
26private readonly ImmutableDictionary<IOperation, TAbstractAnalysisValue> _operationStateMap;
27private readonly ImmutableDictionary<IOperation, PredicateValueKind> _predicateValueKindMap;
28private readonly ImmutableDictionary<IOperation, IDataFlowAnalysisResult<TAbstractAnalysisValue>> _interproceduralResultsMap;
29private readonly ImmutableDictionary<IMethodSymbol, IDataFlowAnalysisResult<TAbstractAnalysisValue>> _standaloneLocalFunctionAnalysisResultsMap;
34ImmutableDictionary<BasicBlock, TBlockAnalysisResult> basicBlockStateMap,
35ImmutableDictionary<IOperation, TAbstractAnalysisValue> operationStateMap,
36ImmutableDictionary<IOperation, PredicateValueKind> predicateValueKindMap,
38ImmutableDictionary<IOperation, IDataFlowAnalysisResult<TAbstractAnalysisValue>> interproceduralResultsMap,
39ImmutableDictionary<IMethodSymbol, IDataFlowAnalysisResult<TAbstractAnalysisValue>> standaloneLocalFunctionAnalysisResultsMap,
87internal DataFlowAnalysisResult<TBlockAnalysisResult, TAbstractAnalysisValue> With(ImmutableDictionary<IOperation, TAbstractAnalysisValue> operationStateMap)
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\DataFlowOperationVisitor.cs (26)
45private readonly ImmutableDictionary<IOperation, TAbstractAnalysisValue>.Builder _valueCacheBuilder;
46private readonly ImmutableDictionary<IOperation, PredicateValueKind>.Builder _predicateValueKindCacheBuilder;
52private ImmutableDictionary<IParameterSymbol, AnalysisEntity>? _lazyParameterEntities;
116private readonly ImmutableDictionary<IOperation, IDataFlowAnalysisResult<TAbstractAnalysisValue>>.Builder _interproceduralResultsBuilder;
121private readonly ImmutableDictionary<IMethodSymbol, IDataFlowAnalysisResult<TAbstractAnalysisValue>>.Builder _standaloneLocalFunctionAnalysisResultsBuilder;
150public ImmutableDictionary<IOperation, IDataFlowAnalysisResult<TAbstractAnalysisValue>> InterproceduralResultsMap => _interproceduralResultsBuilder.ToImmutable();
151public ImmutableDictionary<IMethodSymbol, IDataFlowAnalysisResult<TAbstractAnalysisValue>> StandaloneLocalFunctionAnalysisResultsMap => _standaloneLocalFunctionAnalysisResultsBuilder.ToImmutable();
535protected virtual void StopTrackingDataForParameters(ImmutableDictionary<IParameterSymbol, AnalysisEntity> parameterEntities)
556var argumentValuesMap = DataFlowAnalysisContext.InterproceduralAnalysisData?.ArgumentValuesMap ??
557ImmutableDictionary<IParameterSymbol, ArgumentInfo<TAbstractAnalysisValue>>.Empty;
1017internal ImmutableDictionary<IOperation, TAbstractAnalysisValue> GetStateMap() => _valueCacheBuilder.ToImmutable();
1019internal ImmutableDictionary<IOperation, PredicateValueKind> GetPredicateValueKindMap() => _predicateValueKindCacheBuilder.ToImmutable();
1155var outputData = DataFlowAnalysisContext.PointsToAnalysisResult.EntryBlockOutput.Data;
1162var inputData = DataFlowAnalysisContext.PointsToAnalysisResult[CurrentBasicBlock].Data;
1176var inputData = DataFlowAnalysisContext.PointsToAnalysisResult.MergedStateForUnhandledThrowOperations?.Data;
2128ImmutableDictionary<IParameterSymbol, ArgumentInfo<TAbstractAnalysisValue>> argumentValuesMap,
2435var argumentValuesMap = GetArgumentValues(ref invocationInstance);
2436var pointsToValues = pointsToAnalysisResult?[cfg.GetEntry()].Data;
2437var copyValues = copyAnalysisResult?[cfg.GetEntry()].Data;
2438var valueContentValues = valueContentAnalysisResult?[cfg.GetEntry()].Data;
2497ImmutableDictionary<IParameterSymbol, ArgumentInfo<TAbstractAnalysisValue>> GetArgumentValues(ref (AnalysisEntity? entity, PointsToAbstractValue pointsToValue)? invocationInstance)
2592private ImmutableDictionary<ISymbol, PointsToAbstractValue> GetCapturedVariablesMap(
2601return ImmutableDictionary<ISymbol, PointsToAbstractValue>.Empty;
2607return ImmutableDictionary<ISymbol, PointsToAbstractValue>.Empty;
2743argumentValuesMap: ImmutableDictionary<IParameterSymbol, ArgumentInfo<TAbstractAnalysisValue>>.Empty,
2745addressSharedEntities: ImmutableDictionary<AnalysisEntity, CopyAbstractValue>.Empty,
Microsoft.CodeAnalysis.BannedApiAnalyzers (54)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (12)
27ImmutableDictionary<string, string?>? properties,
35ImmutableDictionary<string, string?>? properties,
54ImmutableDictionary<string, string?>? properties,
64ImmutableDictionary<string, string?>? properties,
89ImmutableDictionary<string, string?>? properties,
102properties: ImmutableDictionary<string, string?>.Empty,
108ImmutableDictionary<string, string?>? properties,
116ImmutableDictionary<string, string?>? properties,
143ImmutableDictionary<string, string?>? properties,
184ImmutableDictionary<string, string?>? properties,
250var options = (ImmutableDictionary<string, ReportDiagnostic>)s_syntaxTreeDiagnosticOptionsProperty.GetValue(tree)!;
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (19)
30private readonly ImmutableDictionary<string, TValue> _names;
31private readonly ImmutableDictionary<ISymbol, TValue> _symbols;
53private readonly ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> _wildcardNamesBySymbolKind;
62private SymbolNamesWithValueOption(ImmutableDictionary<string, TValue> names, ImmutableDictionary<ISymbol, TValue> symbols,
63ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> wildcardNamesBySymbolKind)
74_names = ImmutableDictionary<string, TValue>.Empty;
75_symbols = ImmutableDictionary<ISymbol, TValue>.Empty;
76_wildcardNamesBySymbolKind = ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>>.Empty;
309if (_wildcardNamesBySymbolKind.TryGetValue(symbol.Kind, out var names) &&
319if (_wildcardNamesBySymbolKind.TryGetValue(AllKinds, out var value) &&
329if (_wildcardNamesBySymbolKind.TryGetValue(AllKinds, out var allKindsValue) &&
372internal ref readonly ImmutableDictionary<string, TValue> Names => ref _symbolNamesWithValueOption._names;
374internal ref readonly ImmutableDictionary<ISymbol, TValue> Symbols => ref _symbolNamesWithValueOption._symbols;
376internal ref readonly ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> WildcardNamesBySymbolKind => ref _symbolNamesWithValueOption._wildcardNamesBySymbolKind;
Microsoft.CodeAnalysis.CodeStyle (121)
src\Analyzers\Core\Analyzers\Helpers\DiagnosticHelper.cs (14)
35/// <see cref="ImmutableDictionary{TKey, TValue}.Empty"/>.
45ImmutableDictionary<string, string?>? properties,
116return CreateWithMessage(descriptor, location, notificationOption, analyzerOptions, additionalLocations, ImmutableDictionary<string, string?>.Empty, message);
118var tagIndices = ImmutableDictionary<string, IEnumerable<int>>.Empty
128ImmutableDictionary<string, string?>.Empty);
162ImmutableDictionary<string, string?>? properties,
184ImmutableDictionary<string, string?>? properties)
189var tagIndices = ImmutableDictionary<string, IEnumerable<int>>.Empty
210ImmutableDictionary<string, string?>? properties)
215properties ??= ImmutableDictionary<string, string?>.Empty;
250/// <see cref="ImmutableDictionary{TKey, TValue}.Empty"/>.
260ImmutableDictionary<string, string?>? properties,
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (8)
390/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue, TArg}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TArg, TValue}, TArg)"/>
410/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue})"/>
430/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue)"/>
458/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue}, Func{TKey, TValue, TValue})"/>
496/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue, Func{TKey, TValue, TValue})"/>
532/// <inheritdoc cref="ImmutableInterlocked.TryAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue)"/>
558/// <inheritdoc cref="ImmutableInterlocked.TryUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue, TValue)"/>
586/// <inheritdoc cref="ImmutableInterlocked.TryRemove{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, out TValue)"/>
Microsoft.CodeAnalysis.CodeStyle.Fixes (30)
Microsoft.CodeAnalysis.CodeStyle.UnitTestUtilities (3)
Microsoft.CodeAnalysis.Collections.Package (16)
RoslynImmutableInterlocked.cs (8)
390/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue, TArg}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TArg, TValue}, TArg)"/>
410/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue})"/>
430/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue)"/>
458/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue}, Func{TKey, TValue, TValue})"/>
496/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue, Func{TKey, TValue, TValue})"/>
532/// <inheritdoc cref="ImmutableInterlocked.TryAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue)"/>
558/// <inheritdoc cref="ImmutableInterlocked.TryUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue, TValue)"/>
586/// <inheritdoc cref="ImmutableInterlocked.TryRemove{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, out TValue)"/>
Microsoft.CodeAnalysis.CSharp (204)
Binder\DecisionDagBuilder.cs (16)
828DagState uniquifyState(FrozenArrayBuilder<StateForCase> cases, ImmutableDictionary<BoundDagTemp, IValueSet> remainingValues)
887ImmutableDictionary<BoundDagTemp, IValueSet>.Empty);
950out var whenTrueDecisions, out var whenTrueValues,
951out var whenFalseDecisions, out var whenFalseValues,
1088out ImmutableDictionary<BoundDagTemp, IValueSet> whenTrueValues,
1090out ImmutableDictionary<BoundDagTemp, IValueSet> whenFalseValues,
1125ImmutableDictionary<BoundDagTemp, IValueSet> whenTrueValues,
1126ImmutableDictionary<BoundDagTemp, IValueSet> whenFalseValues,
1130ImmutableDictionary<BoundDagTemp, IValueSet> values,
1149ImmutableDictionary<BoundDagTemp, IValueSet> whenTrueValues,
1150ImmutableDictionary<BoundDagTemp, IValueSet> whenFalseValues,
1169var whenTrueValues = values.SetItem(input, fromTestPassing);
1170var whenFalseValues = values.SetItem(input, fromTestFailing);
1854public ImmutableDictionary<BoundDagTemp, IValueSet> RemainingValues { get; private set; } = null!;
1883public static DagState GetInstance(FrozenArrayBuilder<StateForCase> cases, ImmutableDictionary<BoundDagTemp, IValueSet> remainingValues)
1927internal void UpdateRemainingValues(ImmutableDictionary<BoundDagTemp, IValueSet> newRemainingValues)
Binder\WithExternAndUsingAliasesBinder.cs (7)
34protected abstract ImmutableDictionary<string, AliasAndUsingDirective> GetUsingAliasesMap(ConsList<TypeSymbol>? basesBeingResolved);
103internal static WithExternAndUsingAliasesBinder Create(ImmutableArray<AliasAndExternAliasDirective> externAliases, ImmutableDictionary<string, AliasAndUsingDirective> usingAliases, WithUsingNamespacesAndTypesBinder next)
114private ImmutableDictionary<string, AliasAndUsingDirective>? _lazyUsingAliasesMap;
151protected override ImmutableDictionary<string, AliasAndUsingDirective> GetUsingAliasesMap(ConsList<TypeSymbol>? basesBeingResolved)
229private readonly ImmutableDictionary<string, AliasAndUsingDirective> _usingAliases;
231internal FromSymbols(ImmutableArray<AliasAndExternAliasDirective> externAliases, ImmutableDictionary<string, AliasAndUsingDirective> usingAliases, WithUsingNamespacesAndTypesBinder next)
255protected override ImmutableDictionary<string, AliasAndUsingDirective> GetUsingAliasesMap(ConsList<TypeSymbol>? basesBeingResolved)
Compilation\AttributeSemanticModel.cs (4)
28ImmutableDictionary<Symbol, Symbol>? parentRemappedSymbolsOpt = null)
39public static AttributeSemanticModel Create(PublicSemanticModel containingSemanticModel, AttributeSyntax syntax, NamedTypeSymbol attributeType, AliasSymbol aliasOpt, Symbol? attributeTarget, Binder rootBinder, ImmutableDictionary<Symbol, Symbol>? parentRemappedSymbolsOpt)
48public static SpeculativeSemanticModelWithMemberModel CreateSpeculative(SyntaxTreeSemanticModel parentSemanticModel, AttributeSyntax syntax, NamedTypeSymbol attributeType, AliasSymbol aliasOpt, Binder rootBinder, ImmutableDictionary<Symbol, Symbol> parentRemappedSymbolsOpt, int position)
108ref ImmutableDictionary<Symbol, Symbol>? remappedSymbols)
Compilation\InitializerSemanticModel.cs (4)
30ImmutableDictionary<Symbol, Symbol> parentRemappedSymbolsOpt = null) :
59internal static InitializerSemanticModel Create(PublicSemanticModel containingSemanticModel, ParameterSyntax syntax, ParameterSymbol parameterSymbol, Binder rootBinder, ImmutableDictionary<Symbol, Symbol> parentRemappedSymbolsOpt)
69internal static SpeculativeSemanticModelWithMemberModel CreateSpeculative(SyntaxTreeSemanticModel parentSemanticModel, Symbol owner, EqualsValueClauseSyntax syntax, Binder rootBinder, ImmutableDictionary<Symbol, Symbol> parentRemappedSymbolsOpt, int position)
259ref ImmutableDictionary<Symbol, Symbol> remappedSymbols)
Compilation\MemberSemanticModel.cs (9)
36private ImmutableDictionary<Symbol, Symbol> _lazyRemappedSymbols;
37private readonly ImmutableDictionary<Symbol, Symbol> _parentRemappedSymbolsOpt;
50ImmutableDictionary<Symbol, Symbol> parentRemappedSymbolsOpt)
162internal ImmutableDictionary<Symbol, Symbol> GetRemappedSymbols()
205ImmutableDictionary<Symbol, Symbol> ignored = null;
1473protected void UnguardedAddBoundTreeForStandaloneSyntax(SyntaxNode syntax, BoundNode bound, NullableWalker.SnapshotManager manager = null, ImmutableDictionary<Symbol, Symbol> remappedSymbols = null)
1481protected void GuardedAddBoundTreeForStandaloneSyntax(SyntaxNode syntax, BoundNode bound, NullableWalker.SnapshotManager manager = null, ImmutableDictionary<Symbol, Symbol> remappedSymbols = null)
1960var remappedSymbols = _parentRemappedSymbolsOpt;
2045ref ImmutableDictionary<Symbol, Symbol>? remappedSymbols);
Compilation\SyntaxAndDeclarationManager.cs (16)
314var loadDirectiveMap = state.LoadDirectiveMap;
315var loadedSyntaxTreeMap = state.LoadedSyntaxTreeMap;
386ImmutableDictionary<SyntaxTree, int> syntaxTreeOrdinalMap,
387ImmutableDictionary<SyntaxTree, ImmutableArray<LoadDirective>> loadDirectiveMap,
388ImmutableDictionary<string, SyntaxTree> loadedSyntaxTreeMap,
434ImmutableDictionary<SyntaxTree, ImmutableArray<LoadDirective>> loadDirectiveMap,
435ImmutableDictionary<string, SyntaxTree> loadedSyntaxTreeMap,
478var ordinalMap = state.OrdinalMap;
479var loadDirectiveMap = state.LoadDirectiveMap;
480var loadedSyntaxTreeMap = state.LoadedSyntaxTreeMap;
607ImmutableDictionary<SyntaxTree, Lazy<RootSingleNamespaceDeclaration>>.Builder declMapBuilder,
608ImmutableDictionary<SyntaxTree, OneOrMany<WeakReference<StrongBox<ImmutableSegmentedHashSet<string>>>>>.Builder lastComputedMemberNamesMap)
668internal static bool IsLoadedSyntaxTree(SyntaxTree tree, ImmutableDictionary<string, SyntaxTree> loadedSyntaxTreeMap)
678ImmutableDictionary<SyntaxTree, ImmutableArray<LoadDirective>> loadDirectiveMap,
679ImmutableDictionary<string, SyntaxTree> loadedSyntaxTreeMap)
728private static bool TryGetLoadedSyntaxTree(ImmutableDictionary<string, SyntaxTree> loadedSyntaxTreeMap, LoadDirective directive, out SyntaxTree loadedTree)
Compilation\SyntaxAndDeclarationManager.LazyState.cs (10)
21internal readonly ImmutableDictionary<SyntaxTree, int> OrdinalMap; // Inverse of syntaxTrees array (i.e. maps tree to index)
22internal readonly ImmutableDictionary<SyntaxTree, ImmutableArray<LoadDirective>> LoadDirectiveMap;
23internal readonly ImmutableDictionary<string, SyntaxTree> LoadedSyntaxTreeMap;
24internal readonly ImmutableDictionary<SyntaxTree, Lazy<RootSingleNamespaceDeclaration>> RootNamespaces;
43internal readonly ImmutableDictionary<SyntaxTree, OneOrMany<WeakReference<StrongBox<ImmutableSegmentedHashSet<string>>>>> LastComputedMemberNames;
48ImmutableDictionary<SyntaxTree, int> syntaxTreeOrdinalMap,
49ImmutableDictionary<SyntaxTree, ImmutableArray<LoadDirective>> loadDirectiveMap,
50ImmutableDictionary<string, SyntaxTree> loadedSyntaxTreeMap,
51ImmutableDictionary<SyntaxTree, Lazy<RootSingleNamespaceDeclaration>> rootNamespaces,
52ImmutableDictionary<SyntaxTree, OneOrMany<WeakReference<StrongBox<ImmutableSegmentedHashSet<string>>>>> lastComputedMemberNames,
FlowAnalysis\NullableWalker.cs (11)
222private readonly ImmutableDictionary<BoundExpression, (NullabilityInfo Info, TypeSymbol? Type)>.Builder? _analyzedNullabilityMapOpt;
467ImmutableDictionary<BoundExpression, (NullabilityInfo, TypeSymbol?)>.Builder? analyzedNullabilityMapOpt,
1583ref ImmutableDictionary<Symbol, Symbol>? remappedSymbols)
1585ImmutableDictionary<BoundExpression, (NullabilityInfo, TypeSymbol?)> analyzedNullabilitiesMap;
1590private static (SnapshotManager?, ImmutableDictionary<BoundExpression, (NullabilityInfo, TypeSymbol?)>) AnalyzeWithSemanticInfo(
1627var analyzedNullabilitiesMap = analyzedNullabilities.ToImmutable();
1656ref ImmutableDictionary<Symbol, Symbol>? remappedSymbols)
1688var analyzedNullabilitiesMap = analyzedNullabilities.ToImmutable();
1698private static BoundNode Rewrite(ImmutableDictionary<BoundExpression, (NullabilityInfo, TypeSymbol?)> updatedNullabilities, SnapshotManager? snapshotManager, BoundNode node, ref ImmutableDictionary<Symbol, Symbol>? remappedSymbols)
1824ImmutableDictionary<BoundExpression, (NullabilityInfo, TypeSymbol?)>.Builder? analyzedNullabilityMapOpt,
FlowAnalysis\NullableWalker.SnapshotManager.cs (4)
31private readonly ImmutableDictionary<(BoundNode?, Symbol), Symbol> _updatedSymbolsMap;
35private SnapshotManager(ImmutableArray<SharedWalkerState> walkerSharedStates, ImmutableArray<(int position, Snapshot snapshot)> incrementalSnapshots, ImmutableDictionary<(BoundNode?, Symbol), Symbol> updatedSymbolsMap)
148private readonly ImmutableDictionary<(BoundNode?, Symbol), Symbol>.Builder _updatedSymbolMap = ImmutableDictionary.CreateBuilder<(BoundNode?, Symbol), Symbol>(ExpressionAndSymbolEqualityComparer.Instance, Symbols.SymbolEqualityComparer.ConsiderEverything);
177var updatedSymbols = _updatedSymbolMap.ToImmutable();
Lowering\ExtensionMethodBodyRewriter.cs (6)
25private ImmutableDictionary<Symbol, Symbol> _symbolMap;
41_symbolMap = ImmutableDictionary<Symbol, Symbol>.Empty.WithComparers(ReferenceEqualityComparer.Instance, ReferenceEqualityComparer.Instance);
54private (RewrittenMethodSymbol, ImmutableDictionary<Symbol, Symbol>) EnterMethod(MethodSymbol symbol, RewrittenMethodSymbol rewritten, ReadOnlySpan<ParameterSymbol> rewrittenParameters)
56ImmutableDictionary<Symbol, Symbol> saveSymbolMap = _symbolMap;
76private (RewrittenMethodSymbol, ImmutableDictionary<Symbol, Symbol>) EnterMethod(MethodSymbol symbol, RewrittenLambdaOrLocalFunctionSymbol rewritten)
122ImmutableDictionary<Symbol, Symbol> saveSymbolMap = _symbolMap;
Symbols\Source\SourceNamespaceSymbol.AliasesAndUsings.cs (23)
89ref ImmutableDictionary<SingleNamespaceDeclaration, AliasesAndUsings> dictionary,
174public ImmutableDictionary<string, AliasAndUsingDirective> GetUsingAliasesMap(CSharpSyntaxNode declarationSyntax, ConsList<TypeSymbol>? basesBeingResolved)
181var result = GetGlobalUsingAliasesMap(basesBeingResolved);
195return ImmutableDictionary<string, AliasAndUsingDirective>.Empty;
243private ImmutableDictionary<string, AliasAndUsingDirective> GetGlobalUsingAliasesMap(ConsList<TypeSymbol>? basesBeingResolved)
263ImmutableDictionary<string, AliasAndUsingDirective>? mergedAliases = null;
281var aliases = GetAliasesAndUsings(singleDeclaration).GetGlobalUsingAliasesMap(this, singleDeclaration.SyntaxReference, basesBeingResolved);
356var globalAliasesMap = ImmutableDictionary<string, AliasAndUsingDirective>.Empty;
380UsingAliasesMap = mergedAliases ?? ImmutableDictionary<string, AliasAndUsingDirective>.Empty,
520internal ImmutableDictionary<string, AliasAndUsingDirective> GetUsingAliasesMap(SourceNamespaceSymbol declaringSymbol, CSharpSyntaxNode declarationSyntax, ConsList<TypeSymbol>? basesBeingResolved)
522return GetUsingsAndDiagnostics(declaringSymbol, declarationSyntax, basesBeingResolved).UsingAliasesMap ?? ImmutableDictionary<string, AliasAndUsingDirective>.Empty;
525internal ImmutableDictionary<string, AliasAndUsingDirective> GetGlobalUsingAliasesMap(SourceNamespaceSymbol declaringSymbol, SyntaxReference declarationSyntax, ConsList<TypeSymbol>? basesBeingResolved)
527return (_lazyGlobalUsings ?? GetGlobalUsingsAndDiagnostics(declaringSymbol, (CSharpSyntaxNode)declarationSyntax.GetSyntax(), basesBeingResolved)).UsingAliasesMap ?? ImmutableDictionary<string, AliasAndUsingDirective>.Empty;
599Debug.Assert((calculated.UsingAliasesMap ?? ImmutableDictionary<string, AliasAndUsingDirective>.Empty).SetEquals(result.UsingAliasesMap ?? ImmutableDictionary<string, AliasAndUsingDirective>.Empty));
624var globalUsingAliasesMap = ImmutableDictionary<string, AliasAndUsingDirective>.Empty;
641ImmutableDictionary<string, AliasAndUsingDirective>.Builder? usingAliasesMap = null;
1104public ImmutableDictionary<string, AliasAndUsingDirective>? UsingAliasesMap { get; init; }
1122UsingAliasesMap = ImmutableDictionary<string, AliasAndUsingDirective>.Empty,
1128public ImmutableDictionary<string, AliasAndUsingDirective>? UsingAliasesMap { get; init; }
1139Imports.Create(UsingAliasesMap ?? ImmutableDictionary<string, AliasAndUsingDirective>.Empty,
Syntax\CSharpSyntaxTree.cs (6)
337ImmutableDictionary<string, ReportDiagnostic>? diagnosticOptions,
457ImmutableDictionary<string, ReportDiagnostic>? diagnosticOptions,
495ImmutableDictionary<string, ReportDiagnostic>? diagnosticOptions,
917ImmutableDictionary<string, ReportDiagnostic>? diagnosticOptions,
929ImmutableDictionary<string, ReportDiagnostic>? diagnosticOptions,
941ImmutableDictionary<string, ReportDiagnostic>? diagnosticOptions)
Microsoft.CodeAnalysis.CSharp.CodeStyle (35)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (29)
Microsoft.CodeAnalysis.CSharp.EditorFeatures (1)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (10)
Rename\CSharpInlineRenameServiceTests.cs (8)
27private sealed class ContextDictionaryComparer : IEqualityComparer<ImmutableDictionary<string, ImmutableArray<(string filePath, string content)>>?>
31public bool Equals(ImmutableDictionary<string, ImmutableArray<(string filePath, string content)>>? x, ImmutableDictionary<string, ImmutableArray<(string filePath, string content)>>? y)
54public int GetHashCode(ImmutableDictionary<string, ImmutableArray<(string filePath, string content)>>? obj)
55=> EqualityComparer<ImmutableDictionary<string, ImmutableArray<(string filePath, string content)>>?>.Default.GetHashCode(obj);
73var expectedContext = JsonSerializer.Deserialize<ImmutableDictionary<string, ImmutableArray<(string, string)>>>(expectedContextJson, serializationOptions);
74AssertEx.AreEqual<ImmutableDictionary<string, ImmutableArray<(string filePath, string content)>>?>(expectedContext, context, comparer: ContextDictionaryComparer.Instance);
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (24)
Attributes\AttributeTests_WellKnownAttributes.cs (6)
8807verify(TestOptions.DebugDll.WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty.Add("TEST1", ReportDiagnostic.Warn)),
8813verify(TestOptions.DebugDll.WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty.Add("TEST1", ReportDiagnostic.Error)),
8819verify(TestOptions.DebugDll.WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty.Add("TEST1", ReportDiagnostic.Hidden)),
8825verify(TestOptions.DebugDll.WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty.Add("TEST1", ReportDiagnostic.Suppress)));
8828verify(TestOptions.DebugDll.WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty.Add("CS0618", ReportDiagnostic.Error)),
8834verify(TestOptions.DebugDll.WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty.Add("CS0618", ReportDiagnostic.Suppress)),
Diagnostics\DiagnosticAnalyzerTests.cs (10)
1508var analyzerConfigOptions = new DictionaryAnalyzerConfigOptions(ImmutableDictionary<string, string>.Empty.Add("generated_code", "true"));
1516analyzerConfigOptions = new DictionaryAnalyzerConfigOptions(ImmutableDictionary<string, string>.Empty.Add("generated_code", "TRUE"));
1522analyzerConfigOptions = new DictionaryAnalyzerConfigOptions(ImmutableDictionary<string, string>.Empty.Add("generated_code", "false"));
1528analyzerConfigOptions = new DictionaryAnalyzerConfigOptions(ImmutableDictionary<string, string>.Empty.Add("generated_code", "auto"));
3710var diagnosticsMap = syntax ? analysisResult.SyntaxDiagnostics : analysisResult.SemanticDiagnostics;
3711var diagnostics = diagnosticsMap.TryGetValue(tree1, out var value) ? value : ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>.Empty;
4023if (analysisResult.AdditionalFileDiagnostics.TryGetValue(additionalFile, out var diagnosticsMap) &&
4195.WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty.Add(AnalyzerWithDisabledRules.Rule.Id, ReportDiagnostic.Warn))
Diagnostics\GetDiagnosticsTests.cs (5)
683var analyzerConfigOptions = new DictionaryAnalyzerConfigOptions(ImmutableDictionary<string, string>.Empty.Add("dotnet_analyzer_diagnostic.severity", "none"));
685ImmutableDictionary<object, AnalyzerConfigOptions>.Empty.Add(compilation.SyntaxTrees.Single(), analyzerConfigOptions),
729var analyzerConfigOptions = new DictionaryAnalyzerConfigOptions(ImmutableDictionary<string, string>.Empty.Add(options.Value.key, options.Value.value));
731ImmutableDictionary<object, AnalyzerConfigOptions>.Empty.Add(compilation.SyntaxTrees.Single(), analyzerConfigOptions),
1208var diagnosticsByAnalyzerMap = result.SemanticDiagnostics[syntaxTree];
Microsoft.CodeAnalysis.CSharp.Features (76)
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (11)
Copilot\CSharpImplementNotImplementedExceptionFixProviderTests.cs (10)
179copilotService.SetupFixAll = (Document document, ImmutableDictionary<SyntaxNode, ImmutableArray<ReferencedSymbol>> memberReferences, CancellationToken cancellationToken) =>
540private static ImmutableDictionary<SyntaxNode, ImplementationDetails> BuildResult(ImmutableDictionary<SyntaxNode, ImmutableArray<ReferencedSymbol>> memberReferences, Dictionary<string, string> implementationMap)
644public Func<Document, ImmutableDictionary<SyntaxNode, ImmutableArray<ReferencedSymbol>>, CancellationToken, ImmutableDictionary<SyntaxNode, ImplementationDetails>>? SetupFixAll { get; internal set; }
672public Task<ImmutableDictionary<SyntaxNode, ImplementationDetails>> ImplementNotImplementedExceptionsAsync(
674ImmutableDictionary<SyntaxNode, ImmutableArray<ReferencedSymbol>> methodOrProperties,
687return Task.FromResult(ImmutableDictionary<SyntaxNode, ImplementationDetails>.Empty);
690private static ImmutableDictionary<SyntaxNode, ImplementationDetails> CreateSingleNodeResult(
691ImmutableDictionary<SyntaxNode, ImmutableArray<ReferencedSymbol>> methodOrProperties,
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (8)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (8)
Syntax\SyntaxTreeTests.cs (8)
130var options = CreateImmutableDictionary(("CS0078", ReportDiagnostic.Suppress));
140var options = CreateImmutableDictionary(("CS0078", ReportDiagnostic.Suppress));
166Assert.NotSame(ImmutableDictionary<string, ReportDiagnostic>.Empty, tree.DiagnosticOptions);
176diagnosticOptions: ImmutableDictionary<string, ReportDiagnostic>.Empty,
181Assert.Same(ImmutableDictionary<string, ReportDiagnostic>.Empty, tree.DiagnosticOptions);
187var options = CreateImmutableDictionary(("CS0078", ReportDiagnostic.Suppress));
220var newTree = tree.WithDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty);
231var map = ImmutableDictionary.CreateRange(
Microsoft.CodeAnalysis.CSharp.Test.Utilities (3)
Microsoft.CodeAnalysis.CSharp.Workspaces (6)
Microsoft.CodeAnalysis.Debugging.Package (3)
Microsoft.CodeAnalysis.EditorFeatures (40)
InlineRename\UI\SmartRename\SmartRenameViewModel.cs (5)
39/// Cancellation token source for <see cref="ISmartRenameSessionWrapper.GetSuggestionsAsync(ImmutableDictionary{string, ImmutableArray{ValueTuple{string, string}}}, CancellationToken)"/>.
71/// and call to <see cref="ISmartRenameSessionWrapper.GetSuggestionsAsync(ImmutableDictionary{string, ImmutableArray{ValueTuple{string, string}}}, CancellationToken)"/>.
201/// 3. Call to <see cref="ISmartRenameSessionWrapper.GetSuggestionsAsync(ImmutableDictionary{string, ImmutableArray{ValueTuple{string, string}}}, CancellationToken)"/>.
227var smartRenameContext = ImmutableDictionary<string, ImmutableArray<(string filePath, string content)>>.Empty;
Tagging\AbstractAsynchronousTaggerProvider.TagSource_ProduceTags.cs (14)
57var oldTagTrees = Interlocked.Exchange(
58ref _cachedTagTrees_mayChangeFromAnyThread, ImmutableDictionary<ITextBuffer, TagSpanIntervalTree<TTag>>.Empty);
241private async Task<(ImmutableDictionary<ITextBuffer, TagSpanIntervalTree<TTag>> oldTagTrees, ImmutableDictionary<ITextBuffer, TagSpanIntervalTree<TTag>> newTagTrees, TResult)>
243Func<ImmutableDictionary<ITextBuffer, TagSpanIntervalTree<TTag>>, TArgs, CancellationToken, ValueTask<(ImmutableDictionary<ITextBuffer, TagSpanIntervalTree<TTag>> newTagTrees, TResult result)>> callback,
249var oldTagTrees = _cachedTagTrees_mayChangeFromAnyThread;
282private async Task<ImmutableDictionary<ITextBuffer, TagSpanIntervalTree<TTag>>?> RecomputeTagsAsync(
469private ImmutableDictionary<ITextBuffer, TagSpanIntervalTree<TTag>> ComputeNewTagTrees(
470ImmutableDictionary<ITextBuffer, TagSpanIntervalTree<TTag>> oldTagTrees,
514ImmutableDictionary<ITextBuffer, TagSpanIntervalTree<TTag>> oldTagTrees,
599ImmutableDictionary<ITextBuffer, TagSpanIntervalTree<TTag>> oldTagTrees,
600ImmutableDictionary<ITextBuffer, TagSpanIntervalTree<TTag>> newTagTrees)
735var tagTrees = _cachedTagTrees_mayChangeFromAnyThread;
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (6)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (12)
Diagnostics\DiagnosticDataTests.cs (5)
124properties: ImmutableDictionary<string, string>.Empty,
157properties: ImmutableDictionary<string, string>.Empty,
192properties: ImmutableDictionary<string, string>.Empty,
240properties: ImmutableDictionary<string, string>.Empty,
288properties: ImmutableDictionary<string, string>.Empty,
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (4)
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (28)
PDB\MethodDebugInfo.Native.cs (16)
135ImmutableDictionary<int, ImmutableArray<bool>>? dynamicLocalMap = null;
136ImmutableDictionary<string, ImmutableArray<bool>>? dynamicLocalConstantMap = null;
137ImmutableDictionary<int, ImmutableArray<string?>>? tupleLocalMap = null;
138ImmutableDictionary<LocalNameAndScope, ImmutableArray<string?>>? tupleLocalConstantMap = null;
385out ImmutableDictionary<int, ImmutableArray<bool>>? dynamicLocalMap,
386out ImmutableDictionary<string, ImmutableArray<bool>>? dynamicLocalConstantMap)
400ImmutableDictionary<int, ImmutableArray<bool>>.Builder? localBuilder = null;
401ImmutableDictionary<string, ImmutableArray<bool>>.Builder? constantBuilder = null;
473out ImmutableDictionary<int, ImmutableArray<string?>>? tupleLocalMap,
474out ImmutableDictionary<LocalNameAndScope, ImmutableArray<string?>>? tupleLocalConstantMap)
485ImmutableDictionary<int, ImmutableArray<string?>>.Builder? localBuilder = null;
486ImmutableDictionary<LocalNameAndScope, ImmutableArray<string?>>.Builder? constantBuilder = null;
632ImmutableDictionary<string, ImmutableArray<bool>>? dynamicLocalConstantMap,
633ImmutableDictionary<LocalNameAndScope, ImmutableArray<string?>>? tupleLocalConstantMap)
694ImmutableDictionary<int, ImmutableArray<bool>>? dynamicLocalMap,
695ImmutableDictionary<int, ImmutableArray<string?>>? tupleLocalConstantMap)
Microsoft.CodeAnalysis.ExpressionEvaluator.FunctionResolver (4)
Microsoft.CodeAnalysis.Extensions.Package (17)
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (8)
390/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue, TArg}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TArg, TValue}, TArg)"/>
410/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue})"/>
430/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue)"/>
458/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue}, Func{TKey, TValue, TValue})"/>
496/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue, Func{TKey, TValue, TValue})"/>
532/// <inheritdoc cref="ImmutableInterlocked.TryAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue)"/>
558/// <inheritdoc cref="ImmutableInterlocked.TryUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue, TValue)"/>
586/// <inheritdoc cref="ImmutableInterlocked.TryRemove{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, out TValue)"/>
Microsoft.CodeAnalysis.ExternalAccess.Copilot (9)
Microsoft.CodeAnalysis.ExternalAccess.Debugger (1)
Microsoft.CodeAnalysis.ExternalAccess.FSharp (6)
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp (3)
Microsoft.CodeAnalysis.ExternalAccess.Razor.Features (1)
Microsoft.CodeAnalysis.ExternalAccess.Razor.UnitTests (4)
Microsoft.CodeAnalysis.Features (370)
CodeFixes\Service\CodeFixService.cs (39)
43private readonly Lazy<ImmutableDictionary<string, ImmutableArray<Lazy<CodeFixProvider, CodeChangeProviderMetadata>>>> _fixersPerLanguageMap;
45private readonly ConditionalWeakTable<IReadOnlyList<AnalyzerReference>, ImmutableDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>>> _projectFixersMap = new();
48private readonly Lazy<ImmutableDictionary<LanguageKind, Lazy<ImmutableArray<IConfigurationFixProvider>>>> _configurationProvidersMap;
51private ImmutableDictionary<LanguageKind, Lazy<ImmutableDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>>>>? _lazyWorkspaceFixersMap;
52private ImmutableDictionary<LanguageKind, Lazy<ImmutableDictionary<CodeFixProvider, int>>>? _lazyFixerPriorityMap;
54private ImmutableDictionary<CodeFixProvider, ImmutableArray<DiagnosticId>> _fixerToFixableIdsMap = ImmutableDictionary<CodeFixProvider, ImmutableArray<DiagnosticId>>.Empty;
55private ImmutableDictionary<object, FixAllProviderInfo?> _fixAllProviderMap = ImmutableDictionary<object, FixAllProviderInfo?>.Empty;
56private ImmutableDictionary<CodeFixProvider, CodeChangeProviderMetadata?> _fixerToMetadataMap = ImmutableDictionary<CodeFixProvider, CodeChangeProviderMetadata?>.Empty;
86var hasWorkspaceFixers = TryGetWorkspaceFixersMap(document, out var workspaceFixersMap);
87var projectFixersMap = GetProjectFixers(document);
367private bool TryGetWorkspaceFixersMap(TextDocument document, [NotNullWhen(true)] out ImmutableDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>>? fixerMap)
371var workspaceFixersMap = GetFixerPerLanguageMap(document.Project.Solution.Services);
377fixerMap = ImmutableDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>>.Empty;
393private bool TryGetWorkspaceFixersPriorityMap(TextDocument document, [NotNullWhen(true)] out Lazy<ImmutableDictionary<CodeFixProvider, int>>? fixersPriorityMap)
397var fixersPriorityByLanguageMap = GetFixerPriorityPerLanguageMap(document.Project.Solution.Services);
455var hasAnySharedFixer = TryGetWorkspaceFixersMap(document, out var fixerMap);
457var projectFixersMap = GetProjectFixers(document);
879private ImmutableDictionary<LanguageKind, Lazy<ImmutableDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>>>> GetFixerPerLanguageMap(
882var fixerMap = ImmutableDictionary.Create<LanguageKind, Lazy<ImmutableDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>>>>();
886var lazyMap = new Lazy<ImmutableDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>>>(() =>
917private static ImmutableDictionary<LanguageKind, Lazy<ImmutableArray<IConfigurationFixProvider>>> GetConfigurationProvidersPerLanguageMap(
942private ImmutableDictionary<LanguageKind, Lazy<ImmutableDictionary<CodeFixProvider, int>>> GetFixerPriorityPerLanguageMap(SolutionServices services)
944var languageMap = ImmutableDictionary.CreateBuilder<LanguageKind, Lazy<ImmutableDictionary<CodeFixProvider, int>>>();
947var lazyMap = new Lazy<ImmutableDictionary<CodeFixProvider, int>>(() =>
969private ImmutableDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>> GetProjectFixers(TextDocument document)
973? ImmutableDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>>.Empty
977private ImmutableDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>> ComputeProjectFixers(TextDocument document)
1008private readonly ImmutableDictionary<CodeFixProvider, int> _priorityMap;
1012ImmutableDictionary<CodeFixProvider, int> priorityMap)
1049public ImmutableDictionary<LanguageKind, Lazy<ImmutableDictionary<CodeFixProvider, int>>> GetFixerPriorityPerLanguageMap(SolutionServices services)
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.GlobalSuppressMessageFixAllCodeAction.cs (6)
41internal static CodeAction Create(string title, AbstractSuppressionCodeFixProvider fixer, Document triggerDocument, ImmutableDictionary<Document, ImmutableArray<Diagnostic>> diagnosticsByDocument)
48internal static CodeAction Create(string title, AbstractSuppressionCodeFixProvider fixer, Project triggerProject, ImmutableDictionary<Project, ImmutableArray<Diagnostic>> diagnosticsByProject)
70ImmutableDictionary<Document, ImmutableArray<Diagnostic>> diagnosticsByDocument,
99ImmutableDictionary<Project, ImmutableArray<Diagnostic>> diagnosticsByProject,
190private static void AddDiagnosticForSymbolIfNeeded(ISymbol targetSymbol, Diagnostic diagnostic, ImmutableDictionary<ISymbol, List<Diagnostic>>.Builder diagnosticsMapBuilder)
206private static IEnumerable<KeyValuePair<ISymbol, ImmutableArray<Diagnostic>>> CreateDiagnosticsBySymbol(ImmutableDictionary<ISymbol, List<Diagnostic>>.Builder diagnosticsMapBuilder)
Completion\CompletionChange.cs (6)
49internal ImmutableDictionary<string, string> Properties { get; }
53: this(textChange, textChanges, newPosition, includesCommitCharacter, ImmutableDictionary<string, string>.Empty)
58TextChange textChange, ImmutableArray<TextChange> textChanges, int? newPosition, bool includesCommitCharacter, ImmutableDictionary<string, string> properties)
64TextChange textChange, ImmutableArray<TextChange> textChanges, TextSpan? newSelection, bool includesCommitCharacter, ImmutableDictionary<string, string> properties)
124ImmutableDictionary<string, string> properties,
134ImmutableDictionary<string, string> properties,
Completion\CompletionItem.cs (8)
24private ImmutableDictionary<string, string>? _lazyPropertiesAsImmutableDictionary;
95public ImmutableDictionary<string, string> Properties
219ImmutableDictionary<string, string>? properties,
231ImmutableDictionary<string, string>? properties,
245ImmutableDictionary<string, string>? properties,
261ImmutableDictionary<string, string>? properties = null,
321ImmutableDictionary<string, string>? properties,
447public CompletionItem WithProperties(ImmutableDictionary<string, string> properties)
EditAndContinue\DebuggingSession.cs (6)
154nonRemappableRegions: ImmutableDictionary<ManagedMethodId, ImmutableArray<NonRemappableRegion>>.Empty,
241internal void RestartEditSession(ImmutableDictionary<ManagedMethodId, ImmutableArray<NonRemappableRegion>>? nonRemappableRegions, bool? inBreakState)
430private static ImmutableDictionary<K, ImmutableArray<V>> GroupToImmutableDictionary<K, V>(IEnumerable<IGrouping<K, V>> items)
515ImmutableDictionary<ProjectId, RunningProjectInfo> runningProjects,
571out var projectsToRestart,
592ImmutableDictionary<ManagedMethodId, ImmutableArray<NonRemappableRegion>>? newNonRemappableRegions = null;
EditAndContinue\EmitSolutionUpdateResults.cs (6)
36public required ImmutableDictionary<ProjectId, ImmutableArray<ProjectId>> ProjectsToRestart { get; init; }
87ProjectsToRestart = ImmutableDictionary<ProjectId, ImmutableArray<ProjectId>>.Empty,
114public required ImmutableDictionary<ProjectId, ImmutableArray<ProjectId>> ProjectsToRestart { get; init; }
131ProjectsToRestart = ImmutableDictionary<ProjectId, ImmutableArray<ProjectId>>.Empty,
172ImmutableDictionary<ProjectId, RunningProjectInfo> runningProjects,
173out ImmutableDictionary<ProjectId, ImmutableArray<ProjectId>> projectsToRestart,
EmbeddedLanguages\RegularExpressions\RegexParser.CaptureInfoAnalyzer.cs (7)
32private readonly ImmutableDictionary<int, TextSpan>.Builder _captureNumberToSpan;
33private readonly ImmutableDictionary<string, TextSpan>.Builder _captureNameToSpan;
50public static (ImmutableDictionary<string, TextSpan>, ImmutableDictionary<int, TextSpan>) Analyze(
57private (ImmutableDictionary<string, TextSpan>, ImmutableDictionary<int, TextSpan>) Analyze(
197ImmutableDictionary<T, TextSpan>.Builder mapping,
FindUsages\DefinitionItem.cs (7)
65public ImmutableDictionary<string, string> Properties { get; }
122ImmutableDictionary<string, string>? properties,
132Properties = properties ?? ImmutableDictionary<string, string>.Empty;
213ImmutableDictionary<string, string>? properties = null,
228ImmutableDictionary<string, string>? properties = null,
258ImmutableDictionary<string, string>? properties = null,
261properties ??= ImmutableDictionary<string, string>.Empty;
InlineMethod\AbstractInlineMethodRefactoringProvider.InlineContext.cs (9)
105var renameTable = ComputeRenameTable(
224var replacementTable = ComputeReplacementTable(
251ImmutableDictionary<ISymbol, string> renameTable)
277ImmutableDictionary<ISymbol, string> renameTable,
289ImmutableDictionary<ISymbol, SyntaxNode> replacementTable,
322private ImmutableDictionary<ISymbol, SyntaxNode> ComputeReplacementTable(
325ImmutableDictionary<IParameterSymbol, TExpressionSyntax> parametersToReplace,
327ImmutableDictionary<ISymbol, string> renameTable)
351private static ImmutableDictionary<ISymbol, string> ComputeRenameTable(
src\Analyzers\Core\Analyzers\Helpers\DiagnosticHelper.cs (14)
35/// <see cref="ImmutableDictionary{TKey, TValue}.Empty"/>.
45ImmutableDictionary<string, string?>? properties,
116return CreateWithMessage(descriptor, location, notificationOption, analyzerOptions, additionalLocations, ImmutableDictionary<string, string?>.Empty, message);
118var tagIndices = ImmutableDictionary<string, IEnumerable<int>>.Empty
128ImmutableDictionary<string, string?>.Empty);
162ImmutableDictionary<string, string?>? properties,
184ImmutableDictionary<string, string?>? properties)
189var tagIndices = ImmutableDictionary<string, IEnumerable<int>>.Empty
210ImmutableDictionary<string, string?>? properties)
215properties ??= ImmutableDictionary<string, string?>.Empty;
250/// <see cref="ImmutableDictionary{TKey, TValue}.Empty"/>.
260ImmutableDictionary<string, string?>? properties,
Structure\Syntax\BlockSpanCollector.cs (6)
16private readonly ImmutableDictionary<Type, ImmutableArray<AbstractSyntaxStructureProvider>> _nodeProviderMap;
17private readonly ImmutableDictionary<int, ImmutableArray<AbstractSyntaxStructureProvider>> _triviaProviderMap;
22ImmutableDictionary<Type, ImmutableArray<AbstractSyntaxStructureProvider>> nodeOutlinerMap,
23ImmutableDictionary<int, ImmutableArray<AbstractSyntaxStructureProvider>> triviaOutlinerMap,
35ImmutableDictionary<Type, ImmutableArray<AbstractSyntaxStructureProvider>> nodeOutlinerMap,
36ImmutableDictionary<int, ImmutableArray<AbstractSyntaxStructureProvider>> triviaOutlinerMap,
Microsoft.CodeAnalysis.Features.Test.Utilities (5)
Microsoft.CodeAnalysis.Features.UnitTests (40)
EditAndContinue\EditAndContinueWorkspaceServiceTests.cs (8)
1437var runningProjects = ImmutableDictionary<ProjectId, RunningProjectInfo>.Empty.Add(projectId, new RunningProjectInfo() { RestartWhenChangesHaveNoEffect = false, AllowPartialUpdate = true });
3025var runningProjects = ImmutableDictionary<ProjectId, RunningProjectInfo>.Empty
3145var results = (await debuggingSession.EmitSolutionUpdateAsync(solution, runningProjects: ImmutableDictionary<ProjectId, RunningProjectInfo>.Empty, s_noActiveSpans, CancellationToken.None).ConfigureAwait(false)).Dehydrate();
4853var result1 = await encService.EmitSolutionUpdateAsync(sessionId, solution1, runningProjects: ImmutableDictionary<ProjectId, RunningProjectInfo>.Empty, s_noActiveSpans, CancellationToken.None);
4860var result2 = await encService.EmitSolutionUpdateAsync(sessionId, solution2, runningProjects: ImmutableDictionary<ProjectId, RunningProjectInfo>.Empty, s_noActiveSpans, CancellationToken.None);
4883await Assert.ThrowsAsync<ObjectDisposedException>(async () => await debuggingSession.EmitSolutionUpdateAsync(solution, runningProjects: ImmutableDictionary<ProjectId, RunningProjectInfo>.Empty, s_noActiveSpans, CancellationToken.None));
EditAndContinue\EmitSolutionUpdateResultsTests.cs (19)
58private static ImmutableDictionary<ProjectId, RunningProjectInfo> CreateRunningProjects(IEnumerable<(ProjectId id, bool noEffectRestarts)> projectIds, bool allowPartialUpdate = true)
61private static IEnumerable<string> Inspect(ImmutableDictionary<ProjectId, ImmutableArray<ProjectId>> projectsToRestart)
93properties: ImmutableDictionary<string, string?>.Empty,
109properties: ImmutableDictionary<string, string?>.Empty,
126properties: ImmutableDictionary<string, string?>.Empty,
147ProjectsToRestart = ImmutableDictionary<ProjectId, ImmutableArray<ProjectId>>.Empty,
178out var projectsToRestart,
201out var projectsToRestart,
226out var projectsToRestart,
256out var projectsToRestart,
282out var projectsToRestart,
315out var projectsToRestart,
342out var projectsToRestart,
365out var projectsToRestart,
399out var projectsToRestart,
447out var projectsToRestart,
478out var projectsToRestart,
516out var projectsToRestart,
564out var projectsToRestart,
Microsoft.CodeAnalysis.InteractiveHost (17)
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (8)
390/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue, TArg}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TArg, TValue}, TArg)"/>
410/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue})"/>
430/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue)"/>
458/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue}, Func{TKey, TValue, TValue})"/>
496/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue, Func{TKey, TValue, TValue})"/>
532/// <inheritdoc cref="ImmutableInterlocked.TryAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue)"/>
558/// <inheritdoc cref="ImmutableInterlocked.TryUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue, TValue)"/>
586/// <inheritdoc cref="ImmutableInterlocked.TryRemove{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, out TValue)"/>
Microsoft.CodeAnalysis.LanguageServer (19)
Microsoft.CodeAnalysis.LanguageServer.Protocol (33)
Handler\Diagnostics\DiagnosticSources\TaskListDiagnosticSource.cs (7)
23private static readonly ImmutableDictionary<string, string?> s_lowPriorityProperties = ImmutableDictionary<string, string?>.Empty.Add(Priority, Low);
24private static readonly ImmutableDictionary<string, string?> s_mediumPriorityProperties = ImmutableDictionary<string, string?>.Empty.Add(Priority, Medium);
25private static readonly ImmutableDictionary<string, string?> s_highPriorityProperties = ImmutableDictionary<string, string?>.Empty.Add(Priority, High);
64private static ImmutableDictionary<string, string?> GetProperties(TaskListItemPriority priority)
Workspaces\LspWorkspaceManager.cs (6)
66private ImmutableDictionary<DocumentUri, (SourceText Text, string LanguageId)> _trackedDocuments = ImmutableDictionary<DocumentUri, (SourceText SourceText, string LanguageId)>.Empty;
214public ImmutableDictionary<DocumentUri, (SourceText SourceText, string LanguageId)> GetTrackedLspText() => _trackedDocuments;
381var documentsInWorkspace = GetDocumentsForUris([.. _trackedDocuments.Keys], workspaceCurrentSolution);
492private async Task<bool> DoesAllTextMatchWorkspaceSolutionAsync(ImmutableDictionary<DocumentUri, ImmutableArray<TextDocument>> documentsInWorkspace, CancellationToken cancellationToken)
545private static ImmutableDictionary<DocumentUri, ImmutableArray<TextDocument>> GetDocumentsForUris(ImmutableArray<DocumentUri> trackedDocuments, Solution workspaceCurrentSolution)
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (7)
Microsoft.CodeAnalysis.LanguageServer.UnitTests (2)
Microsoft.CodeAnalysis.PooledObjects.Package (3)
Microsoft.CodeAnalysis.PublicApiAnalyzers (65)
DeclarePublicApiAnalyzer.cs (7)
117if (!TryGetAndValidateApiFiles(context, isPublic, errors, out var additionalFiles, out var shippedData, out var unshippedData))
135bool TryGetAndValidateApiFiles(CompilationStartAnalysisContext context, bool isPublic, List<Diagnostic> errors, [NotNullWhen(true)] out ImmutableDictionary<AdditionalText, SourceText>? additionalFiles, [NotNullWhen(true)] out ApiData? shippedData, [NotNullWhen(true)] out ApiData? unshippedData)
198private static bool TryGetApiData(CompilationStartAnalysisContext context, bool isPublic, List<Diagnostic> errors, [NotNullWhen(true)] out ImmutableDictionary<AdditionalText, SourceText>? additionalFiles, [NotNullWhen(true)] out ApiData? shippedData, [NotNullWhen(true)] out ApiData? unshippedData)
351out ImmutableDictionary<AdditionalText, SourceText> additionalFiles,
355additionalFiles = ImmutableDictionary<AdditionalText, SourceText>.Empty;
378private static bool ValidateApiFiles(ImmutableDictionary<AdditionalText, SourceText> additionalFiles, ApiData shippedData, ApiData unshippedData, bool isPublic, List<Diagnostic> errors)
405private static void ValidateApiList(ImmutableDictionary<AdditionalText, SourceText> additionalFiles, Dictionary<string, ApiLine> publicApiMap, ImmutableArray<ApiLine> apiList, bool isPublic, List<Diagnostic> errors)
DeclarePublicApiAnalyzer.Impl.cs (19)
27public string GetPath(ImmutableDictionary<AdditionalText, SourceText> additionalFiles)
46public string GetPath(ImmutableDictionary<AdditionalText, SourceText> additionalFiles)
49public Location GetLocation(ImmutableDictionary<AdditionalText, SourceText> additionalFiles)
76private readonly ImmutableDictionary<AdditionalText, SourceText> _additionalFiles;
86internal Impl(Compilation compilation, ImmutableDictionary<AdditionalText, SourceText> additionalFiles, ApiData shippedData, ApiData unshippedData, bool isPublic, AnalyzerOptions analyzerOptions)
297reportDiagnosticAtLocations(GetDiagnostic(ShouldAnnotatePublicApiFilesRule, ShouldAnnotateInternalApiFilesRule), ImmutableDictionary<string, string>.Empty);
318ImmutableDictionary<string, string> propertyBag = ImmutableDictionary<string, string>.Empty;
355reportDiagnosticAtLocations(diagnostic, ImmutableDictionary<string, string>.Empty, errorMessageName, diagnostic.HelpLinkUri);
368reportDiagnosticAtLocations(diagnostic, ImmutableDictionary<string, string>.Empty, errorMessageName, diagnostic.HelpLinkUri);
380reportDiagnosticAtLocations(diagnostic, ImmutableDictionary<string, string>.Empty, errorMessageName, diagnostic.HelpLinkUri);
392void reportDiagnosticAtLocations(DiagnosticDescriptor descriptor, ImmutableDictionary<string, string> propertyBag, params object[] args)
413ImmutableDictionary<string, string> propertyBag = ImmutableDictionary<string, string>.Empty
425ImmutableDictionary<string, string> propertyBag = ImmutableDictionary<string, string>.Empty
445reportDiagnosticAtLocations(GetDiagnostic(ObliviousPublicApiRule, ObliviousInternalApiRule), ImmutableDictionary<string, string>.Empty, errorMessageName);
762ImmutableDictionary<string, string> propertyBag = ImmutableDictionary<string, string>.Empty.Add(ApiNamePropertyBagKey, pair.Value.Text);
src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (12)
27ImmutableDictionary<string, string?>? properties,
35ImmutableDictionary<string, string?>? properties,
54ImmutableDictionary<string, string?>? properties,
64ImmutableDictionary<string, string?>? properties,
89ImmutableDictionary<string, string?>? properties,
102properties: ImmutableDictionary<string, string?>.Empty,
108ImmutableDictionary<string, string?>? properties,
116ImmutableDictionary<string, string?>? properties,
143ImmutableDictionary<string, string?>? properties,
184ImmutableDictionary<string, string?>? properties,
250var options = (ImmutableDictionary<string, ReportDiagnostic>)s_syntaxTreeDiagnosticOptionsProperty.GetValue(tree)!;
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (19)
30private readonly ImmutableDictionary<string, TValue> _names;
31private readonly ImmutableDictionary<ISymbol, TValue> _symbols;
53private readonly ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> _wildcardNamesBySymbolKind;
62private SymbolNamesWithValueOption(ImmutableDictionary<string, TValue> names, ImmutableDictionary<ISymbol, TValue> symbols,
63ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> wildcardNamesBySymbolKind)
74_names = ImmutableDictionary<string, TValue>.Empty;
75_symbols = ImmutableDictionary<ISymbol, TValue>.Empty;
76_wildcardNamesBySymbolKind = ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>>.Empty;
309if (_wildcardNamesBySymbolKind.TryGetValue(symbol.Kind, out var names) &&
319if (_wildcardNamesBySymbolKind.TryGetValue(AllKinds, out var value) &&
329if (_wildcardNamesBySymbolKind.TryGetValue(AllKinds, out var allKindsValue) &&
372internal ref readonly ImmutableDictionary<string, TValue> Names => ref _symbolNamesWithValueOption._names;
374internal ref readonly ImmutableDictionary<ISymbol, TValue> Symbols => ref _symbolNamesWithValueOption._symbols;
376internal ref readonly ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> WildcardNamesBySymbolKind => ref _symbolNamesWithValueOption._wildcardNamesBySymbolKind;
Microsoft.CodeAnalysis.Rebuild.UnitTests (1)
Microsoft.CodeAnalysis.Remote.ServiceHub (18)
Microsoft.CodeAnalysis.Remote.Workspaces (8)
Microsoft.CodeAnalysis.ResxSourceGenerator (55)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (12)
27ImmutableDictionary<string, string?>? properties,
35ImmutableDictionary<string, string?>? properties,
54ImmutableDictionary<string, string?>? properties,
64ImmutableDictionary<string, string?>? properties,
89ImmutableDictionary<string, string?>? properties,
102properties: ImmutableDictionary<string, string?>.Empty,
108ImmutableDictionary<string, string?>? properties,
116ImmutableDictionary<string, string?>? properties,
143ImmutableDictionary<string, string?>? properties,
184ImmutableDictionary<string, string?>? properties,
250var options = (ImmutableDictionary<string, ReportDiagnostic>)s_syntaxTreeDiagnosticOptionsProperty.GetValue(tree)!;
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (19)
30private readonly ImmutableDictionary<string, TValue> _names;
31private readonly ImmutableDictionary<ISymbol, TValue> _symbols;
53private readonly ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> _wildcardNamesBySymbolKind;
62private SymbolNamesWithValueOption(ImmutableDictionary<string, TValue> names, ImmutableDictionary<ISymbol, TValue> symbols,
63ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> wildcardNamesBySymbolKind)
74_names = ImmutableDictionary<string, TValue>.Empty;
75_symbols = ImmutableDictionary<ISymbol, TValue>.Empty;
76_wildcardNamesBySymbolKind = ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>>.Empty;
309if (_wildcardNamesBySymbolKind.TryGetValue(symbol.Kind, out var names) &&
319if (_wildcardNamesBySymbolKind.TryGetValue(AllKinds, out var value) &&
329if (_wildcardNamesBySymbolKind.TryGetValue(AllKinds, out var allKindsValue) &&
372internal ref readonly ImmutableDictionary<string, TValue> Names => ref _symbolNamesWithValueOption._names;
374internal ref readonly ImmutableDictionary<ISymbol, TValue> Symbols => ref _symbolNamesWithValueOption._symbols;
376internal ref readonly ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> WildcardNamesBySymbolKind => ref _symbolNamesWithValueOption._wildcardNamesBySymbolKind;
Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests (2)
Microsoft.CodeAnalysis.Scripting (4)
Microsoft.CodeAnalysis.Scripting.UnitTests (2)
Microsoft.CodeAnalysis.Test.Utilities (17)
PDB\DeterministicBuildCompilationTestHelpers.cs (3)
25public static void VerifyPdbOption<T>(this ImmutableDictionary<string, string> pdbOptions, string pdbName, T expectedValue, Func<T, bool> isDefault = null, Func<T, string> toString = null)
47internal static void AssertCommonOptions(EmitOptions emitOptions, CompilationOptions compilationOptions, Compilation compilation, ImmutableDictionary<string, string> pdbOptions)
152public static ImmutableDictionary<string, string> ParseCompilationOptions(BlobReader blobReader)
Microsoft.CodeAnalysis.Threading.Package (16)
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (8)
390/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue, TArg}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TArg, TValue}, TArg)"/>
410/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue})"/>
430/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue)"/>
458/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue}, Func{TKey, TValue, TValue})"/>
496/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue, Func{TKey, TValue, TValue})"/>
532/// <inheritdoc cref="ImmutableInterlocked.TryAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue)"/>
558/// <inheritdoc cref="ImmutableInterlocked.TryUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue, TValue)"/>
586/// <inheritdoc cref="ImmutableInterlocked.TryRemove{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, out TValue)"/>
Microsoft.CodeAnalysis.UnitTests (5)
Microsoft.CodeAnalysis.VisualBasic (70)
Compilation\VisualBasicCompilation.vb (8)
91Private ReadOnly _syntaxTreeOrdinalMap As ImmutableDictionary(Of SyntaxTree, Integer)
103Private ReadOnly _rootNamespaces As ImmutableDictionary(Of SyntaxTree, DeclarationTableEntry)
422syntaxTreeOrdinalMap As ImmutableDictionary(Of SyntaxTree, Integer),
423rootNamespaces As ImmutableDictionary(Of SyntaxTree, DeclarationTableEntry),
528syntaxTreeOrdinalMap As ImmutableDictionary(Of SyntaxTree, Integer),
529rootNamespaces As ImmutableDictionary(Of SyntaxTree, DeclarationTableEntry),
981ByRef declMap As ImmutableDictionary(Of SyntaxTree, DeclarationTableEntry),
1050ByRef declMap As ImmutableDictionary(Of SyntaxTree, DeclarationTableEntry),
Syntax\VisualBasicSyntaxTree.ConditionalSymbolsMap.vb (6)
28Private ReadOnly _conditionalsMap As ImmutableDictionary(Of String, Stack(Of Tuple(Of InternalSyntax.CConst, Integer)))
35Private Sub New(conditionalsMap As ImmutableDictionary(Of String, Stack(Of Tuple(Of InternalSyntax.CConst, Integer))))
58Dim conditionalSymbolsMap As ImmutableDictionary(Of String, Stack(Of Tuple(Of InternalSyntax.CConst, Integer))) = symbolsMapBuilder.Build(syntaxRoot, options)
67Friend Function Build(root As SyntaxNodeOrToken, options As VisualBasicParseOptions) As ImmutableDictionary(Of String, Stack(Of Tuple(Of InternalSyntax.CConst, Integer)))
71Dim preprocessorSymbolsMap As ImmutableDictionary(Of String, InternalSyntax.CConst) = Scanner.GetPreprocessorConstants(options)
83Private Sub ProcessCommandLinePreprocessorSymbols(preprocessorSymbolsMap As ImmutableDictionary(Of String, InternalSyntax.CConst))
Microsoft.CodeAnalysis.VisualBasic.ExpressionCompiler (14)
Microsoft.CodeAnalysis.VisualBasic.Features (3)
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (4)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (2)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (4)
Microsoft.CodeAnalysis.Workspaces (386)
Diagnostics\AnalysisResultPair.cs (29)
16private ImmutableDictionary<SyntaxTree, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>>? _lazyMergedSyntaxDiagnostics;
17private ImmutableDictionary<SyntaxTree, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>>? _lazyMergedSemanticDiagnostics;
18private ImmutableDictionary<AdditionalText, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>>? _lazyMergedAdditionalFileDiagnostics;
19private ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>? _lazyMergedCompilationDiagnostics;
20private ImmutableDictionary<DiagnosticAnalyzer, AnalyzerTelemetryInfo>? _lazyMergedAnalyzerTelemetryInfo;
40public ImmutableDictionary<SyntaxTree, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>> MergedSyntaxDiagnostics
65public ImmutableDictionary<SyntaxTree, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>> MergedSemanticDiagnostics
90public ImmutableDictionary<AdditionalText, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>> MergedAdditionalFileDiagnostics
115public ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>> MergedCompilationDiagnostics
140public ImmutableDictionary<DiagnosticAnalyzer, AnalyzerTelemetryInfo> MergedAnalyzerTelemetryInfo
173private static ImmutableDictionary<TKey, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>> MergeDiagnostics<TKey>(
174ImmutableDictionary<TKey, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>> first,
175ImmutableDictionary<TKey, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>> second)
181if (!localSyntaxDiagnostics.TryGetValue(tree, out var projectSyntaxDiagnostics))
193private static ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>> MergeDiagnostics(
194ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>> first,
195ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>> second)
212private static ImmutableDictionary<DiagnosticAnalyzer, AnalyzerTelemetryInfo> MergeTelemetry(
213ImmutableDictionary<DiagnosticAnalyzer, AnalyzerTelemetryInfo> first,
214ImmutableDictionary<DiagnosticAnalyzer, AnalyzerTelemetryInfo> second)
Diagnostics\DiagnosticAnalysisResult.cs (17)
28private readonly ImmutableDictionary<DocumentId, ImmutableArray<DiagnosticData>> _syntaxLocals;
33private readonly ImmutableDictionary<DocumentId, ImmutableArray<DiagnosticData>> _semanticLocals;
38private readonly ImmutableDictionary<DocumentId, ImmutableArray<DiagnosticData>> _nonLocals;
47ImmutableDictionary<DocumentId, ImmutableArray<DiagnosticData>> syntaxLocals,
48ImmutableDictionary<DocumentId, ImmutableArray<DiagnosticData>> semanticLocals,
49ImmutableDictionary<DocumentId, ImmutableArray<DiagnosticData>> nonLocals,
69syntaxLocals: ImmutableDictionary<DocumentId, ImmutableArray<DiagnosticData>>.Empty,
70semanticLocals: ImmutableDictionary<DocumentId, ImmutableArray<DiagnosticData>>.Empty,
71nonLocals: ImmutableDictionary<DocumentId, ImmutableArray<DiagnosticData>>.Empty,
77ImmutableDictionary<DocumentId, ImmutableArray<DiagnosticData>> syntaxLocalMap,
78ImmutableDictionary<DocumentId, ImmutableArray<DiagnosticData>> semanticLocalMap,
79ImmutableDictionary<DocumentId, ImmutableArray<DiagnosticData>> nonLocalMap,
104private ImmutableDictionary<DocumentId, ImmutableArray<DiagnosticData>>? GetMap(AnalysisKind kind)
133var map = GetMap(kind);
150semanticLocals: ImmutableDictionary<DocumentId, ImmutableArray<DiagnosticData>>.Empty,
151nonLocals: ImmutableDictionary<DocumentId, ImmutableArray<DiagnosticData>>.Empty,
155private static void VerifyDocumentMap(Project project, ImmutableDictionary<DocumentId, ImmutableArray<DiagnosticData>> map)
Diagnostics\DiagnosticAnalysisResultMap.cs (8)
17ImmutableDictionary<TKey, TValue> analysisResult,
18ImmutableDictionary<TKey, AnalyzerTelemetryInfo> telemetryInfo)
29ImmutableDictionary<TKey, TValue>.Empty,
30ImmutableDictionary<TKey, AnalyzerTelemetryInfo>.Empty);
32public readonly ImmutableDictionary<TKey, TValue> AnalysisResult;
33public readonly ImmutableDictionary<TKey, AnalyzerTelemetryInfo> TelemetryInfo;
36ImmutableDictionary<TKey, TValue> analysisResult,
37ImmutableDictionary<TKey, AnalyzerTelemetryInfo> telemetryInfo)
Diagnostics\DiagnosticData.cs (7)
30ImmutableDictionary<string, string?> properties,
65public readonly ImmutableDictionary<string, string?> Properties = properties;
97internal static ImmutableDictionary<string, string> PropertiesForBuildDiagnostic { get; }
98= ImmutableDictionary<string, string>.Empty.Add(WellKnownDiagnosticPropertyNames.Origin, WellKnownDiagnosticTags.Build);
211var additionalProperties = GetAdditionalProperties(document, diagnostic);
237ImmutableDictionary<string, string?>? additionalProperties)
259private static ImmutableDictionary<string, string?>? GetAdditionalProperties(TextDocument document, Diagnostic diagnostic)
Diagnostics\HostDiagnosticAnalyzers.cs (32)
23private readonly ImmutableDictionary<object, AnalyzerReference> _hostAnalyzerReferencesMap;
31private readonly ConcurrentDictionary<string, ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>>> _hostDiagnosticAnalyzersPerLanguageMap;
40private readonly Lazy<ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>>> _lazyHostDiagnosticAnalyzersPerReferenceMap;
45private ImmutableDictionary<string, DiagnosticAnalyzer> _compilerDiagnosticAnalyzerMap;
55private readonly ConditionalWeakTable<IReadOnlyList<AnalyzerReference>, StrongBox<ImmutableDictionary<string, SkippedHostAnalyzersInfo>>> _skippedHostAnalyzers = new();
61_hostDiagnosticAnalyzersPerLanguageMap = new ConcurrentDictionary<string, ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>>>(concurrencyLevel: 2, capacity: 2);
62_lazyHostDiagnosticAnalyzersPerReferenceMap = new Lazy<ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>>>(() => CreateDiagnosticAnalyzersPerReferenceMap(_hostAnalyzerReferencesMap), isThreadSafe: true);
64_compilerDiagnosticAnalyzerMap = ImmutableDictionary<string, DiagnosticAnalyzer>.Empty;
75public ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> GetOrCreateHostDiagnosticAnalyzersPerReference(string language)
78public ImmutableDictionary<string, ImmutableArray<DiagnosticDescriptor>> GetDiagnosticDescriptorsPerReference(DiagnosticAnalyzerInfoCache infoCache)
85public ImmutableDictionary<string, ImmutableArray<DiagnosticDescriptor>> GetDiagnosticDescriptorsPerReference(DiagnosticAnalyzerInfoCache infoCache, Project project)
87var descriptorPerReference = CreateDiagnosticDescriptorsPerReference(infoCache, CreateDiagnosticAnalyzersPerReference(project));
88var map = _hostAnalyzerReferencesMap.AddRange(CreateProjectAnalyzerReferencesMap(project.AnalyzerReferences));
92private static ImmutableDictionary<string, ImmutableArray<DiagnosticDescriptor>> ConvertReferenceIdentityToName(
93ImmutableDictionary<object, ImmutableArray<DiagnosticDescriptor>> descriptorsPerReference,
94ImmutableDictionary<object, AnalyzerReference> map)
124public ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> CreateDiagnosticAnalyzersPerReference(Project project)
126var hostAnalyzerReferences = GetOrCreateHostDiagnosticAnalyzersPerReference(project.Language);
127var projectAnalyzerReferences = CreateProjectDiagnosticAnalyzersPerReference(project.AnalyzerReferences, project.Language);
136public ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> CreateProjectDiagnosticAnalyzersPerReference(ProjectState project)
139public ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> CreateProjectDiagnosticAnalyzersPerReference(IReadOnlyList<AnalyzerReference> projectAnalyzerReferences, string language)
156private ImmutableDictionary<object, AnalyzerReference> CreateProjectAnalyzerReferencesMap(IReadOnlyList<AnalyzerReference> projectAnalyzerReferences)
159private static ImmutableDictionary<object, ImmutableArray<DiagnosticDescriptor>> CreateDiagnosticDescriptorsPerReference(
161ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> analyzersMap)
180private ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> CreateHostDiagnosticAnalyzersAndBuildMap(string language)
219private static ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> CreateDiagnosticAnalyzersPerReferenceMap(
260private static ImmutableDictionary<object, AnalyzerReference> CreateAnalyzerReferencesMap(IEnumerable<AnalyzerReference> analyzerReferences)
279private static ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> MergeDiagnosticAnalyzerMap(
280ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> map1,
281ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> map2)
283var current = map1;
310box.Value ??= ImmutableDictionary<string, SkippedHostAnalyzersInfo>.Empty;
Rename\ConflictResolution.cs (10)
49private readonly ImmutableDictionary<DocumentId, ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)>> _documentToModifiedSpansMap;
50private readonly ImmutableDictionary<DocumentId, ImmutableArray<ComplexifiedSpan>> _documentToComplexifiedSpansMap;
51private readonly ImmutableDictionary<DocumentId, ImmutableArray<RelatedLocation>> _documentToRelatedLocationsMap;
65_documentToModifiedSpansMap = ImmutableDictionary<DocumentId, ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)>>.Empty;
66_documentToComplexifiedSpansMap = ImmutableDictionary<DocumentId, ImmutableArray<ComplexifiedSpan>>.Empty;
67_documentToRelatedLocationsMap = ImmutableDictionary<DocumentId, ImmutableArray<RelatedLocation>>.Empty;
76ImmutableDictionary<DocumentId, ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)>> documentToModifiedSpansMap,
77ImmutableDictionary<DocumentId, ImmutableArray<ComplexifiedSpan>> documentToComplexifiedSpansMap,
78ImmutableDictionary<DocumentId, ImmutableArray<RelatedLocation>> documentToRelatedLocationsMap)
103public ImmutableDictionary<TextSpan, TextSpan> GetModifiedSpanMap(DocumentId documentId)
Rename\IRemoteRenamerService.cs (6)
211ImmutableDictionary<DocumentId, ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)>> documentToModifiedSpansMap,
212ImmutableDictionary<DocumentId, ImmutableArray<ComplexifiedSpan>> documentToComplexifiedSpansMap,
213ImmutableDictionary<DocumentId, ImmutableArray<RelatedLocation>> documentToRelatedLocationsMap)
231public readonly ImmutableDictionary<DocumentId, ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)>> DocumentToModifiedSpansMap = documentToModifiedSpansMap;
234public readonly ImmutableDictionary<DocumentId, ImmutableArray<ComplexifiedSpan>> DocumentToComplexifiedSpansMap = documentToComplexifiedSpansMap;
237public readonly ImmutableDictionary<DocumentId, ImmutableArray<RelatedLocation>> DocumentToRelatedLocationsMap = documentToRelatedLocationsMap;
SemanticModelReuse\SemanticModelWorkspaceServiceFactory.SemanticModelWorkspaceService.cs (9)
59private ImmutableDictionary<DocumentId, SemanticModelReuseInfo?> _semanticModelMap = ImmutableDictionary<DocumentId, SemanticModelReuseInfo?>.Empty;
68var map = _semanticModelMap;
77_semanticModelMap = ImmutableDictionary<DocumentId, SemanticModelReuseInfo?>.Empty;
103var originalMap = _semanticModelMap;
115var updatedMap = await ComputeUpdatedMapAsync(originalMap, document, bodyNode, cancellationToken).ConfigureAwait(false);
127private static async Task<ImmutableDictionary<DocumentId, SemanticModelReuseInfo?>> ComputeUpdatedMapAsync(
128ImmutableDictionary<DocumentId, SemanticModelReuseInfo?> map, Document document, SyntaxNode bodyNode, CancellationToken cancellationToken)
165ImmutableDictionary<DocumentId, SemanticModelReuseInfo?> map,
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (8)
390/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue, TArg}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TArg, TValue}, TArg)"/>
410/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue})"/>
430/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue)"/>
458/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue}, Func{TKey, TValue, TValue})"/>
496/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue, Func{TKey, TValue, TValue})"/>
532/// <inheritdoc cref="ImmutableInterlocked.TryAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue)"/>
558/// <inheritdoc cref="ImmutableInterlocked.TryUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue, TValue)"/>
586/// <inheritdoc cref="ImmutableInterlocked.TryRemove{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, out TValue)"/>
Workspace\ProjectSystem\ProjectSystemProjectFactory.ProjectUpdateState.cs (8)
53ImmutableDictionary<string, ImmutableArray<ProjectId>> ProjectsByOutputPath,
54ImmutableDictionary<ProjectId, ProjectReferenceInformation> ProjectReferenceInfos,
61ImmutableDictionary<string, ImmutableArray<ProjectId>>.Empty.WithComparers(StringComparer.OrdinalIgnoreCase),
62ImmutableDictionary<ProjectId, ProjectReferenceInformation>.Empty, [], [], [], []);
79static ImmutableDictionary<string, ImmutableArray<ProjectId>> AddProject(string path, ProjectId projectId, ImmutableDictionary<string, ImmutableArray<ProjectId>> map)
99static ImmutableDictionary<string, ImmutableArray<ProjectId>> RemoveProject(string path, ProjectId projectId, ImmutableDictionary<string, ImmutableArray<ProjectId>> map)
Workspace\Solution\ProjectDependencyGraph.cs (24)
35private readonly ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> _referencesMap;
45private ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>>? _lazyReverseReferencesMap;
56private ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> _transitiveReferencesMap;
57private ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> _reverseTransitiveReferencesMap;
69ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>>.Empty,
71ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>>.Empty,
72ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>>.Empty,
78ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> referencesMap)
83transitiveReferencesMap: ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>>.Empty,
84reverseTransitiveReferencesMap: ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>>.Empty,
93ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> referencesMap,
94ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>>? reverseReferencesMap,
95ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> transitiveReferencesMap,
96ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> reverseTransitiveReferencesMap,
117private static ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> RemoveItemsWithEmptyValues(
118ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> map)
120ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>>.Builder? builder = null;
160var referencesMap = referencedProjectIds.IsEmpty ?
214private ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> ComputeReverseReferencesMap()
274var currentMap = _transitiveReferencesMap;
326var currentMap = _reverseTransitiveReferencesMap;
490ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> referencesMap)
510ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> forwardReferencesMap,
511ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>>? reverseReferencesMap)
Workspace\Solution\ProjectDependencyGraph_AddProjectReference.cs (12)
35var newReferencesMap = ComputeNewReferencesMapForAdditionalProjectReferences(_referencesMap, projectId, referencedProjectIds);
37var newReverseReferencesMap = ComputeNewReverseReferencesMapForAdditionalProjectReferences(_lazyReverseReferencesMap, projectId, referencedProjectIds);
39var newTransitiveReferencesMap = ComputeNewTransitiveReferencesMapForAdditionalProjectReferences(_transitiveReferencesMap, projectId, referencedProjectIds);
41var newReverseTransitiveReferencesMap = ComputeNewReverseTransitiveReferencesMapForAdditionalProjectReferences(_reverseTransitiveReferencesMap, projectId, referencedProjectIds);
58private static ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> ComputeNewReferencesMapForAdditionalProjectReferences(
59ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> existingReferencesMap,
78private static ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>>? ComputeNewReverseReferencesMapForAdditionalProjectReferences(
79ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>>? existingReverseReferencesMap,
99private static ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> ComputeNewTransitiveReferencesMapForAdditionalProjectReferences(
100ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> existingTransitiveReferencesMap,
155private static ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> ComputeNewReverseTransitiveReferencesMapForAdditionalProjectReferences(
156ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> existingReverseTransitiveReferencesMap,
Workspace\Solution\ProjectDependencyGraph_RemoveAllProjectReferences.cs (12)
24var referencesMap = ComputeNewReferencesMapForRemovedAllProjectReferences(_referencesMap, projectId);
25var reverseReferencesMap = ComputeNewReverseReferencesMapForRemovedAllProjectReferences(_lazyReverseReferencesMap, projectId, referencedProjectIds);
26var transitiveReferencesMap = ComputeNewTransitiveReferencesMapForRemovedAllProjectReferences(_transitiveReferencesMap, projectId, referencedProjectIds);
27var reverseTransitiveReferencesMap = ComputeNewReverseTransitiveReferencesMapForRemovedAllProjectReferences(_reverseTransitiveReferencesMap, projectId);
39private static ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> ComputeNewReferencesMapForRemovedAllProjectReferences(
40ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> existingForwardReferencesMap,
57private static ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>>? ComputeNewReverseReferencesMapForRemovedAllProjectReferences(
58ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>>? existingReverseReferencesMap,
76private static ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> ComputeNewTransitiveReferencesMapForRemovedAllProjectReferences(
77ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> existingTransitiveReferencesMap,
103private static ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> ComputeNewReverseTransitiveReferencesMapForRemovedAllProjectReferences(
104ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> existingReverseTransitiveReferencesMap,
Workspace\Solution\ProjectDependencyGraph_RemoveProject.cs (14)
22var referencesMap = ComputeNewReferencesMapForRemovedProject(
29var reverseReferencesMap = ComputeNewReverseReferencesMapForRemovedProject(
33var transitiveReferencesMap = ComputeNewTransitiveReferencesMapForRemovedProject(_transitiveReferencesMap, removedProjectIds);
34var reverseTransitiveReferencesMap = ComputeNewReverseTransitiveReferencesMapForRemovedProject(_reverseTransitiveReferencesMap, removedProjectIds);
54private static ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> ComputeNewReferencesMapForRemovedProject(
55ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> existingForwardReferencesMap,
56ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>>? existingReverseReferencesMap,
98private static ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>>? ComputeNewReverseReferencesMapForRemovedProject(
99ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> existingForwardReferencesMap,
100ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>>? existingReverseReferencesMap,
132private static ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> ComputeNewTransitiveReferencesMapForRemovedProject(
133ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> existingTransitiveReferencesMap,
166private static ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> ComputeNewReverseTransitiveReferencesMapForRemovedProject(
167ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> existingReverseTransitiveReferencesMap,
Workspace\Solution\ProjectDependencyGraph_RemoveProjectReference.cs (12)
22var referencesMap = ComputeNewReferencesMapForRemovedProjectReference(_referencesMap, projectId, referencedProjectId);
23var reverseReferencesMap = ComputeNewReverseReferencesMapForRemovedProjectReference(_lazyReverseReferencesMap, projectId, referencedProjectId);
24var transitiveReferencesMap = ComputeNewTransitiveReferencesMapForRemovedProjectReference(_transitiveReferencesMap, projectId, referencedProjectId);
25var reverseTransitiveReferencesMap = ComputeNewReverseTransitiveReferencesMapForRemovedProjectReference(_reverseTransitiveReferencesMap, projectId, referencedProjectId);
37private static ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> ComputeNewReferencesMapForRemovedProjectReference(
38ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> existingForwardReferencesMap,
54private static ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>>? ComputeNewReverseReferencesMapForRemovedProjectReference(
55ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>>? existingReverseReferencesMap,
67private static ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> ComputeNewTransitiveReferencesMapForRemovedProjectReference(
68ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> existingTransitiveReferencesMap,
94private static ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> ComputeNewReverseTransitiveReferencesMapForRemovedProjectReference(
95ImmutableDictionary<ProjectId, ImmutableHashSet<ProjectId>> existingReverseTransitiveReferencesMap,
Workspace\Solution\SolutionState.cs (14)
50public ImmutableDictionary<string, StructuredAnalyzerConfigOptions> FallbackAnalyzerOptions { get; } = ImmutableDictionary<string, StructuredAnalyzerConfigOptions>.Empty;
56internal ImmutableDictionary<string, int> ProjectCountByLanguage { get; } = ImmutableDictionary<string, int>.Empty;
74ImmutableDictionary<string, StructuredAnalyzerConfigOptions> fallbackAnalyzerOptions,
75ImmutableDictionary<string, int> projectCountByLanguage,
111ImmutableDictionary<string, StructuredAnalyzerConfigOptions> fallbackAnalyzerOptions)
121projectCountByLanguage: ImmutableDictionary<string, int>.Empty,
177ImmutableDictionary<string, int>? projectCountByLanguage = null,
182ImmutableDictionary<string, StructuredAnalyzerConfigOptions>? fallbackAnalyzerOptions = null,
509private static ImmutableDictionary<string, int> AddLanguageCounts(ImmutableDictionary<string, int> projectCountByLanguage, in TemporaryArray<(string language, int count)> languageCountDeltas)
929public SolutionState WithFallbackAnalyzerOptions(ImmutableDictionary<string, StructuredAnalyzerConfigOptions> options)
1217var map = sortedNewProjectStates.Select(state => KeyValuePairUtil.Create(
Microsoft.CodeAnalysis.Workspaces.Desktop (2)
Microsoft.CodeAnalysis.Workspaces.MSBuild (14)
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (30)
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (8)
390/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue, TArg}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TArg, TValue}, TArg)"/>
410/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue})"/>
430/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue)"/>
458/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue}, Func{TKey, TValue, TValue})"/>
496/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue, Func{TKey, TValue, TValue})"/>
532/// <inheritdoc cref="ImmutableInterlocked.TryAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue)"/>
558/// <inheritdoc cref="ImmutableInterlocked.TryUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, TValue, TValue)"/>
586/// <inheritdoc cref="ImmutableInterlocked.TryRemove{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, out TValue)"/>
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (4)
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (10)
Microsoft.CodeAnalysis.Workspaces.UnitTests (17)
Microsoft.DotNet.Build.Tasks.Feed (6)
Microsoft.DotNet.SignTool (4)
Microsoft.Interop.ComInterfaceGenerator (34)
Analyzers\AddGeneratedComClassFixer.cs (7)
43protected override Func<DocumentEditor, CancellationToken, Task> CreateFixForSelectedOptions(SyntaxNode node, ImmutableDictionary<string, Option> selectedOptions)
48protected override string GetDiagnosticTitle(ImmutableDictionary<string, Option> selectedOptions)
57protected override ImmutableDictionary<string, Option> ParseOptionsFromDiagnostic(Diagnostic diagnostic)
59return ImmutableDictionary<string, Option>.Empty;
62protected override ImmutableDictionary<string, Option> CombineOptions(ImmutableDictionary<string, Option> fixAllOptions, ImmutableDictionary<string, Option> diagnosticOptions) => fixAllOptions;
Analyzers\ConvertComImportToGeneratedComInterfaceFixer.cs (7)
28protected override string GetDiagnosticTitle(ImmutableDictionary<string, Option> selectedOptions)
35protected override Func<DocumentEditor, CancellationToken, Task> CreateFixForSelectedOptions(SyntaxNode node, ImmutableDictionary<string, Option> selectedOptions)
43protected override ImmutableDictionary<string, Option> ParseOptionsFromDiagnostic(Diagnostic diagnostic)
58protected override ImmutableDictionary<string, Option> CombineOptions(ImmutableDictionary<string, Option> fixAllOptions, ImmutableDictionary<string, Option> diagnosticOptions)
60ImmutableDictionary<string, Option> combinedOptions = fixAllOptions;
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (16)
27protected virtual IEnumerable<ConvertToSourceGeneratedInteropFix> CreateAllFixesForDiagnosticOptions(SyntaxNode node, ImmutableDictionary<string, Option> options)
33protected abstract Func<DocumentEditor, CancellationToken, Task> CreateFixForSelectedOptions(SyntaxNode node, ImmutableDictionary<string, Option> selectedOptions);
35protected abstract string GetDiagnosticTitle(ImmutableDictionary<string, Option> selectedOptions);
59public static ImmutableDictionary<string, Option> ParseOptionsFromEquivalenceKey(string equivalenceKey)
61ImmutableDictionary<string, Option>.Builder options = ImmutableDictionary.CreateBuilder<string, Option>();
86public static string CreateEquivalenceKeyFromOptions(string baseEquivalenceKey, ImmutableDictionary<string, Option> options)
97protected abstract ImmutableDictionary<string, Option> ParseOptionsFromDiagnostic(Diagnostic diagnostic);
99protected abstract ImmutableDictionary<string, Option> CombineOptions(ImmutableDictionary<string, Option> fixAllOptions, ImmutableDictionary<string, Option> diagnosticOptions);
101private ImmutableDictionary<string, Option> GetOptionsForIndividualFix(ImmutableDictionary<string, Option> fixAllOptions, Diagnostic diagnostic)
130var options = ParseOptionsFromDiagnostic(diagnostic);
135var selectedOptions = fix.SelectedOptions.Add(Option.AllowUnsafe, new Option.Bool(true));
164protected record struct ConvertToSourceGeneratedInteropFix(Func<DocumentEditor, CancellationToken, Task> ApplyFix, ImmutableDictionary<string, Option> SelectedOptions);
171var options = Option.ParseOptionsFromEquivalenceKey(fixAllContext.CodeActionEquivalenceKey);
Microsoft.Interop.LibraryImportGenerator (32)
Analyzers\ConvertToLibraryImportFixer.cs (8)
37protected override string GetDiagnosticTitle(ImmutableDictionary<string, Option> selectedOptions)
56protected override ImmutableDictionary<string, Option> ParseOptionsFromDiagnostic(Diagnostic diagnostic)
71protected override ImmutableDictionary<string, Option> CombineOptions(ImmutableDictionary<string, Option> fixAllOptions, ImmutableDictionary<string, Option> diagnosticOptions)
76protected override IEnumerable<ConvertToSourceGeneratedInteropFix> CreateAllFixesForDiagnosticOptions(SyntaxNode node, ImmutableDictionary<string, Option> options)
83var selectedOptions = options.Remove(CharSetOption);
129protected override Func<DocumentEditor, CancellationToken, Task> CreateFixForSelectedOptions(SyntaxNode node, ImmutableDictionary<string, Option> selectedOptions)
Analyzers\DiagnosticReporter.cs (4)
12private readonly Action<DiagnosticDescriptor, ImmutableDictionary<string, string>, object[]> _diagnosticFactory;
14public DiagnosticReporter(Action<DiagnosticDescriptor, ImmutableDictionary<string, string>, object[]> createAndReportDiagnostic)
21public void CreateAndReportDiagnostic(DiagnosticDescriptor descriptor, params object[] messageArgs) => _diagnosticFactory(descriptor, ImmutableDictionary<string, string>.Empty, messageArgs);
23public void CreateAndReportDiagnostic(DiagnosticDescriptor descriptor, ImmutableDictionary<string, string> properties, params object[] messageArgs) => _diagnosticFactory(descriptor, properties, messageArgs);
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (16)
27protected virtual IEnumerable<ConvertToSourceGeneratedInteropFix> CreateAllFixesForDiagnosticOptions(SyntaxNode node, ImmutableDictionary<string, Option> options)
33protected abstract Func<DocumentEditor, CancellationToken, Task> CreateFixForSelectedOptions(SyntaxNode node, ImmutableDictionary<string, Option> selectedOptions);
35protected abstract string GetDiagnosticTitle(ImmutableDictionary<string, Option> selectedOptions);
59public static ImmutableDictionary<string, Option> ParseOptionsFromEquivalenceKey(string equivalenceKey)
61ImmutableDictionary<string, Option>.Builder options = ImmutableDictionary.CreateBuilder<string, Option>();
86public static string CreateEquivalenceKeyFromOptions(string baseEquivalenceKey, ImmutableDictionary<string, Option> options)
97protected abstract ImmutableDictionary<string, Option> ParseOptionsFromDiagnostic(Diagnostic diagnostic);
99protected abstract ImmutableDictionary<string, Option> CombineOptions(ImmutableDictionary<string, Option> fixAllOptions, ImmutableDictionary<string, Option> diagnosticOptions);
101private ImmutableDictionary<string, Option> GetOptionsForIndividualFix(ImmutableDictionary<string, Option> fixAllOptions, Diagnostic diagnostic)
130var options = ParseOptionsFromDiagnostic(diagnostic);
135var selectedOptions = fix.SelectedOptions.Add(Option.AllowUnsafe, new Option.Bool(true));
164protected record struct ConvertToSourceGeneratedInteropFix(Func<DocumentEditor, CancellationToken, Task> ApplyFix, ImmutableDictionary<string, Option> SelectedOptions);
171var options = Option.ParseOptionsFromEquivalenceKey(fixAllContext.CodeActionEquivalenceKey);
Microsoft.Interop.LibraryImportGenerator.Downlevel (1)
Microsoft.Interop.SourceGeneration (29)
DiagnosticExtensions.cs (8)
23ImmutableDictionary<string, string> properties,
45ImmutableDictionary<string, string> properties,
67ImmutableDictionary<string, string> properties,
106ImmutableDictionary<string, string> properties,
127ImmutableDictionary<string, string> properties,
149ImmutableDictionary<string, string> properties,
171ImmutableDictionary<string, string> properties,
210ImmutableDictionary<string, string> properties,
Microsoft.ML.Core (12)
Microsoft.ML.InternalCodeAnalyzer (2)
Microsoft.ML.Tests (10)
PermutationFeatureImportanceTests.cs (10)
41ImmutableDictionary<string, RegressionMetricsStatistics> pfiDict;
109ImmutableDictionary<string, RegressionMetricsStatistics> pfiDict;
183ImmutableDictionary<string, RegressionMetricsStatistics> pfiDict;
271ImmutableDictionary<string, RegressionMetricsStatistics> pfiDict;
346ImmutableDictionary<string, BinaryClassificationMetricsStatistics> pfiDict;
420ImmutableDictionary<string, BinaryClassificationMetricsStatistics> pfiDict;
528ImmutableDictionary<string, MulticlassClassificationMetricsStatistics> pfiDict;
601ImmutableDictionary<string, MulticlassClassificationMetricsStatistics> pfiDict;
679ImmutableDictionary<string, RankingMetricsStatistics> pfiDict;
748ImmutableDictionary<string, RankingMetricsStatistics> pfiDict;
Microsoft.ML.Transforms (5)
Microsoft.VisualStudio.LanguageServices (77)
Options\VisualStudioSettingsOptionPersister.cs (4)
28private readonly ImmutableDictionary<string, Lazy<IVisualStudioStorageReadFallback, OptionNameMetadata>> _readFallbacks;
34private ImmutableDictionary<string, (OptionKey2 primaryOptionKey, string primaryStorageKey)> _storageKeysToMonitorForChanges
35= ImmutableDictionary<string, (OptionKey2, string)>.Empty;
40public VisualStudioSettingsOptionPersister(Action<OptionKey2, object?> refreshOption, ImmutableDictionary<string, Lazy<IVisualStudioStorageReadFallback, OptionNameMetadata>> readFallbacks, ISettingsManager settingsManager)
Snippets\SnippetExpansionClient.cs (4)
553var snippet = CreateMethodCallSnippet(methodName, includeMethod: true, [], ImmutableDictionary<string, string>.Empty);
631private static XDocument CreateMethodCallSnippet(string methodName, bool includeMethod, ImmutableArray<IParameterSymbol> parameters, ImmutableDictionary<string, string> parameterValues)
865var newArguments = _state._arguments;
1176public ImmutableDictionary<string, string> _arguments = ImmutableDictionary.Create<string, string>();
TableDataSource\Suppression\VisualStudioSuppressionFixService.cs (17)
224var documentDiagnosticsToFixMap = await GetDocumentDiagnosticsToFixAsync(
228var projectDiagnosticsToFixMap = isSuppressionInSource
229? ImmutableDictionary<Project, ImmutableArray<Diagnostic>>.Empty
262var documentDiagnosticsPerLanguage = GetDocumentDiagnosticsMappedToNewSolution(documentDiagnosticsToFixMap, newSolution, language);
287var projectDiagnosticsPerLanguage = GetProjectDiagnosticsMappedToNewSolution(projectDiagnosticsToFixMap, newSolution, language);
404private static ImmutableDictionary<Document, ImmutableArray<Diagnostic>> GetDocumentDiagnosticsMappedToNewSolution(ImmutableDictionary<Document, ImmutableArray<Diagnostic>> documentDiagnosticsToFixMap, Solution newSolution, string language)
406ImmutableDictionary<Document, ImmutableArray<Diagnostic>>.Builder? builder = null;
420return builder != null ? builder.ToImmutable() : ImmutableDictionary<Document, ImmutableArray<Diagnostic>>.Empty;
423private static ImmutableDictionary<Project, ImmutableArray<Diagnostic>> GetProjectDiagnosticsMappedToNewSolution(ImmutableDictionary<Project, ImmutableArray<Diagnostic>> projectDiagnosticsToFixMap, Solution newSolution, string language)
425ImmutableDictionary<Project, ImmutableArray<Diagnostic>>.Builder? projectDiagsBuilder = null;
439return projectDiagsBuilder != null ? projectDiagsBuilder.ToImmutable() : ImmutableDictionary<Project, ImmutableArray<Diagnostic>>.Empty;
448private async Task<ImmutableDictionary<Document, ImmutableArray<Diagnostic>>> GetDocumentDiagnosticsToFixAsync(IEnumerable<DiagnosticData> diagnosticsToFix, Func<Project, bool> shouldFixInProject, bool filterStaleDiagnostics, CancellationToken cancellationToken)
466return ImmutableDictionary<Document, ImmutableArray<Diagnostic>>.Empty;
541private async Task<ImmutableDictionary<Project, ImmutableArray<Diagnostic>>> GetProjectDiagnosticsToFixAsync(IEnumerable<DiagnosticData> diagnosticsToFix, Func<Project, bool> shouldFixInProject, bool filterStaleDiagnostics, CancellationToken cancellationToken)
548return ImmutableDictionary<Project, ImmutableArray<Diagnostic>>.Empty;
Microsoft.VisualStudio.LanguageServices.CodeLens (2)
Microsoft.VisualStudio.LanguageServices.DevKit (9)
Microsoft.VisualStudio.LanguageServices.LiveShare (4)
Microsoft.VisualStudio.LanguageServices.UnitTests (8)
Microsoft.VisualStudio.LanguageServices.Xaml (2)
MSBuild (11)
CopyOnWriteDictionary.cs (11)
37private static readonly ImmutableDictionary<string, V> NameComparerDictionaryPrototype = ImmutableDictionary.Create<string, V>(MSBuildNameIgnoreCaseComparer.Default);
44private static readonly ImmutableDictionary<string, V> OrdinalIgnoreCaseComparerDictionaryPrototype = ImmutableDictionary.Create<string, V>(StringComparer.OrdinalIgnoreCase);
52private ImmutableDictionary<string, V> _backing;
59_backing = ImmutableDictionary<string, V>.Empty;
80var b = GetInitialDictionary((IEqualityComparer<string>?)comparer);
85private static ImmutableDictionary<string, V> GetInitialDictionary(IEqualityComparer<string>? keyComparer)
236ImmutableDictionary<string, V> initial = _backing;
290ImmutableDictionary<string, V> initial = _backing;
301public ImmutableDictionary<string, V>.Enumerator GetEnumerator()
308ImmutableDictionary<string, V>.Enumerator enumerator = _backing.GetEnumerator();
399ImmutableDictionary<string, V> snapshot = _backing;
Mvc.Api.Analyzers.Test (1)
Roslyn.Diagnostics.Analyzers (61)
ExportedPartsShouldHaveImportingConstructor.cs (5)
146var properties = Equals(constructor, missingImportingConstructor) ? ScenarioProperties.MissingAttribute : ScenarioProperties.MultipleConstructors;
164public static readonly ImmutableDictionary<string, string?> ImplicitConstructor = ImmutableDictionary.Create<string, string?>().Add(nameof(Scenario), nameof(ImplicitConstructor));
165public static readonly ImmutableDictionary<string, string?> NonPublicConstructor = ImmutableDictionary.Create<string, string?>().Add(nameof(Scenario), nameof(NonPublicConstructor));
166public static readonly ImmutableDictionary<string, string?> MissingAttribute = ImmutableDictionary.Create<string, string?>().Add(nameof(Scenario), nameof(MissingAttribute));
167public static readonly ImmutableDictionary<string, string?> MultipleConstructors = ImmutableDictionary.Create<string, string?>().Add(nameof(Scenario), nameof(MultipleConstructors));
ImportingConstructorShouldBeObsolete.cs (5)
179public static readonly ImmutableDictionary<string, string?> MissingAttribute = ImmutableDictionary.Create<string, string?>().Add(nameof(Scenario), nameof(MissingAttribute));
180public static readonly ImmutableDictionary<string, string?> MissingDescription = ImmutableDictionary.Create<string, string?>().Add(nameof(Scenario), nameof(MissingDescription));
181public static readonly ImmutableDictionary<string, string?> IncorrectDescription = ImmutableDictionary.Create<string, string?>().Add(nameof(Scenario), nameof(IncorrectDescription));
182public static readonly ImmutableDictionary<string, string?> MissingError = ImmutableDictionary.Create<string, string?>().Add(nameof(Scenario), nameof(MissingError));
183public static readonly ImmutableDictionary<string, string?> ErrorSetToFalse = ImmutableDictionary.Create<string, string?>().Add(nameof(Scenario), nameof(ErrorSetToFalse));
src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (12)
27ImmutableDictionary<string, string?>? properties,
35ImmutableDictionary<string, string?>? properties,
54ImmutableDictionary<string, string?>? properties,
64ImmutableDictionary<string, string?>? properties,
89ImmutableDictionary<string, string?>? properties,
102properties: ImmutableDictionary<string, string?>.Empty,
108ImmutableDictionary<string, string?>? properties,
116ImmutableDictionary<string, string?>? properties,
143ImmutableDictionary<string, string?>? properties,
184ImmutableDictionary<string, string?>? properties,
250var options = (ImmutableDictionary<string, ReportDiagnostic>)s_syntaxTreeDiagnosticOptionsProperty.GetValue(tree)!;
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (19)
30private readonly ImmutableDictionary<string, TValue> _names;
31private readonly ImmutableDictionary<ISymbol, TValue> _symbols;
53private readonly ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> _wildcardNamesBySymbolKind;
62private SymbolNamesWithValueOption(ImmutableDictionary<string, TValue> names, ImmutableDictionary<ISymbol, TValue> symbols,
63ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> wildcardNamesBySymbolKind)
74_names = ImmutableDictionary<string, TValue>.Empty;
75_symbols = ImmutableDictionary<ISymbol, TValue>.Empty;
76_wildcardNamesBySymbolKind = ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>>.Empty;
309if (_wildcardNamesBySymbolKind.TryGetValue(symbol.Kind, out var names) &&
319if (_wildcardNamesBySymbolKind.TryGetValue(AllKinds, out var value) &&
329if (_wildcardNamesBySymbolKind.TryGetValue(AllKinds, out var allKindsValue) &&
372internal ref readonly ImmutableDictionary<string, TValue> Names => ref _symbolNamesWithValueOption._names;
374internal ref readonly ImmutableDictionary<ISymbol, TValue> Symbols => ref _symbolNamesWithValueOption._symbols;
376internal ref readonly ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> WildcardNamesBySymbolKind => ref _symbolNamesWithValueOption._wildcardNamesBySymbolKind;
Roslyn.Diagnostics.VisualBasic.Analyzers (1)
Roslyn.Test.PdbUtilities (2)
Roslyn.VisualStudio.Next.UnitTests (21)
Remote\SnapshotSerializationTests.cs (5)
427var reference = new AnalyzerFileReference(location, new MockShadowCopyAnalyzerAssemblyLoader(ImmutableDictionary<string, string>.Empty.Add(location, file.Path)));
448var reference = new AnalyzerFileReference(location, new MockShadowCopyAnalyzerAssemblyLoader(ImmutableDictionary<string, string>.Empty.Add(location, file.Path)));
701return new AnalyzerFileReference(original, new MockShadowCopyAnalyzerAssemblyLoader(ImmutableDictionary<string, string>.Empty.Add(original, shadow.Path)));
733private readonly ImmutableDictionary<string, string> _map;
735public MockShadowCopyAnalyzerAssemblyLoader(ImmutableDictionary<string, string> map)
RunTests (8)
System.Collections.Immutable (148)
System\Collections\Immutable\ImmutableDictionary.cs (35)
11/// A set of initialization methods for instances of <see cref="ImmutableDictionary{TKey, TValue}"/>.
21public static ImmutableDictionary<TKey, TValue> Create<TKey, TValue>() where TKey : notnull
23return ImmutableDictionary<TKey, TValue>.Empty;
35public static ImmutableDictionary<TKey, TValue> Create<TKey, TValue>(IEqualityComparer<TKey>? keyComparer) where TKey : notnull
37return ImmutableDictionary<TKey, TValue>.Empty.WithComparers(keyComparer);
50public static ImmutableDictionary<TKey, TValue> Create<TKey, TValue>(IEqualityComparer<TKey>? keyComparer, IEqualityComparer<TValue>? valueComparer) where TKey : notnull
52return ImmutableDictionary<TKey, TValue>.Empty.WithComparers(keyComparer, valueComparer);
62public static ImmutableDictionary<TKey, TValue> CreateRange<TKey, TValue>(IEnumerable<KeyValuePair<TKey, TValue>> items) where TKey : notnull
64return ImmutableDictionary<TKey, TValue>.Empty.AddRange(items);
79public static ImmutableDictionary<TKey, TValue> CreateRangeWithOverwrite<TKey, TValue>(
83return ImmutableDictionary<TKey, TValue>.Empty.AddRange(items, ImmutableDictionary<TKey, TValue>.KeyCollisionBehavior.SetValue);
94public static ImmutableDictionary<TKey, TValue> CreateRange<TKey, TValue>(IEqualityComparer<TKey>? keyComparer, IEnumerable<KeyValuePair<TKey, TValue>> items) where TKey : notnull
96return ImmutableDictionary<TKey, TValue>.Empty.WithComparers(keyComparer).AddRange(items);
112public static ImmutableDictionary<TKey, TValue> CreateRangeWithOverwrite<TKey, TValue>(
117return ImmutableDictionary<TKey, TValue>.Empty.WithComparers(keyComparer).AddRange(items, ImmutableDictionary<TKey, TValue>.KeyCollisionBehavior.SetValue);
129public static ImmutableDictionary<TKey, TValue> CreateRange<TKey, TValue>(IEqualityComparer<TKey>? keyComparer, IEqualityComparer<TValue>? valueComparer, IEnumerable<KeyValuePair<TKey, TValue>> items) where TKey : notnull
131return ImmutableDictionary<TKey, TValue>.Empty.WithComparers(keyComparer, valueComparer).AddRange(items);
140public static ImmutableDictionary<TKey, TValue>.Builder CreateBuilder<TKey, TValue>() where TKey : notnull
152public static ImmutableDictionary<TKey, TValue>.Builder CreateBuilder<TKey, TValue>(IEqualityComparer<TKey>? keyComparer) where TKey : notnull
165public static ImmutableDictionary<TKey, TValue>.Builder CreateBuilder<TKey, TValue>(IEqualityComparer<TKey>? keyComparer, IEqualityComparer<TValue>? valueComparer) where TKey : notnull
182public static ImmutableDictionary<TKey, TValue> ToImmutableDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, IEqualityComparer<TKey>? keyComparer, IEqualityComparer<TValue>? valueComparer) where TKey : notnull
188return ImmutableDictionary<TKey, TValue>.Empty.WithComparers(keyComparer, valueComparer)
197public static ImmutableDictionary<TKey, TValue> ToImmutableDictionary<TKey, TValue>(this ImmutableDictionary<TKey, TValue>.Builder builder) where TKey : notnull
215public static ImmutableDictionary<TKey, TValue> ToImmutableDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, IEqualityComparer<TKey>? keyComparer) where TKey : notnull
228public static ImmutableDictionary<TKey, TSource> ToImmutableDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector) where TKey : notnull
242public static ImmutableDictionary<TKey, TSource> ToImmutableDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? keyComparer) where TKey : notnull
257public static ImmutableDictionary<TKey, TValue> ToImmutableDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector) where TKey : notnull
271public static ImmutableDictionary<TKey, TValue> ToImmutableDictionary<TKey, TValue>(this IEnumerable<KeyValuePair<TKey, TValue>> source, IEqualityComparer<TKey>? keyComparer, IEqualityComparer<TValue>? valueComparer) where TKey : notnull
275if (source is ImmutableDictionary<TKey, TValue> existingDictionary)
280return ImmutableDictionary<TKey, TValue>.Empty.WithComparers(keyComparer, valueComparer).AddRange(source);
291public static ImmutableDictionary<TKey, TValue> ToImmutableDictionary<TKey, TValue>(this IEnumerable<KeyValuePair<TKey, TValue>> source, IEqualityComparer<TKey>? keyComparer) where TKey : notnull
303public static ImmutableDictionary<TKey, TValue> ToImmutableDictionary<TKey, TValue>(this IEnumerable<KeyValuePair<TKey, TValue>> source) where TKey : notnull
System\Collections\Immutable\ImmutableDictionary_2.Builder.cs (24)
11/// Contains the inner <see cref="ImmutableDictionary{TKey, TValue}.Builder"/> class.
21/// While <see cref="ImmutableDictionary{TKey, TValue}.AddRange(IEnumerable{KeyValuePair{TKey, TValue}})"/>
52private ImmutableDictionary<TKey, TValue>? _immutable;
65/// Initializes a new instance of the <see cref="ImmutableDictionary{TKey, TValue}.Builder"/> class.
68internal Builder(ImmutableDictionary<TKey, TValue> map)
97ImmutableDictionary<TKey, TValue>.MutationResult result = ImmutableDictionary<TKey, TValue>.AddRange(this, input);
422ImmutableDictionary<TKey, TValue>.MutationResult result = ImmutableDictionary<TKey, TValue>.Add(key, value, KeyCollisionBehavior.SetValue, this.Origin);
435ImmutableDictionary<TKey, TValue>.MutationResult result = ImmutableDictionary<TKey, TValue>.AddRange(items, this.Origin);
503public ImmutableDictionary<TKey, TValue> ToImmutable()
508return _immutable ??= ImmutableDictionary<TKey, TValue>.Wrap(_root, _comparers, _count);
525ImmutableDictionary<TKey, TValue>.MutationResult result = ImmutableDictionary<TKey, TValue>.Add(key, value, KeyCollisionBehavior.ThrowIfValueDifferent, this.Origin);
539return ImmutableDictionary<TKey, TValue>.ContainsKey(key, this.Origin);
543/// Determines whether the <see cref="ImmutableDictionary{TKey, TValue}"/>
547/// The value to locate in the <see cref="ImmutableDictionary{TKey, TValue}"/>.
551/// true if the <see cref="ImmutableDictionary{TKey, TValue}"/> contains
578ImmutableDictionary<TKey, TValue>.MutationResult result = ImmutableDictionary<TKey, TValue>.Remove(key, this.Origin);
593return ImmutableDictionary<TKey, TValue>.TryGetValue(key, this.Origin, out value!);
601return ImmutableDictionary<TKey, TValue>.TryGetKey(equalKey, this.Origin, out actualKey);
633return ImmutableDictionary<TKey, TValue>.Contains(item, this.Origin);
System\Collections\Immutable\ImmutableDictionary_2.cs (43)
25public static readonly ImmutableDictionary<TKey, TValue> Empty = new ImmutableDictionary<TKey, TValue>();
48/// Initializes a new instance of the <see cref="ImmutableDictionary{TKey, TValue}"/> class.
64/// Initializes a new instance of the <see cref="ImmutableDictionary{TKey, TValue}"/> class.
125public ImmutableDictionary<TKey, TValue> Clear()
172foreach (KeyValuePair<int, ImmutableDictionary<TKey, TValue>.HashBucket> bucket in _root)
189foreach (KeyValuePair<int, ImmutableDictionary<TKey, TValue>.HashBucket> bucket in _root)
300public ImmutableDictionary<TKey, TValue> Add(TKey key, TValue value)
304ImmutableDictionary<TKey, TValue>.MutationResult result = Add(key, value, KeyCollisionBehavior.ThrowIfValueDifferent, this.Origin);
311public ImmutableDictionary<TKey, TValue> AddRange(IEnumerable<KeyValuePair<TKey, TValue>> pairs)
318internal ImmutableDictionary<TKey, TValue> AddRange(ReadOnlySpan<KeyValuePair<TKey, TValue>> pairs, KeyCollisionBehavior collisionBehavior = KeyCollisionBehavior.ThrowIfValueDifferent)
326public ImmutableDictionary<TKey, TValue> SetItem(TKey key, TValue value)
330ImmutableDictionary<TKey, TValue>.MutationResult result = Add(key, value, KeyCollisionBehavior.SetValue, this.Origin);
339public ImmutableDictionary<TKey, TValue> SetItems(IEnumerable<KeyValuePair<TKey, TValue>> items)
343ImmutableDictionary<TKey, TValue>.MutationResult result = AddRange(items, this.Origin, KeyCollisionBehavior.SetValue);
350public ImmutableDictionary<TKey, TValue> Remove(TKey key)
354ImmutableDictionary<TKey, TValue>.MutationResult result = Remove(key, this.Origin);
361public ImmutableDictionary<TKey, TValue> RemoveRange(IEnumerable<TKey> keys)
366SortedInt32KeyNode<ImmutableDictionary<TKey, TValue>.HashBucket> root = _root;
374ImmutableDictionary<TKey, TValue>.HashBucket newBucket = bucket.Remove(key, _comparers.KeyOnlyComparer, out result);
432public ImmutableDictionary<TKey, TValue> WithComparers(IEqualityComparer<TKey>? keyComparer, IEqualityComparer<TValue>? valueComparer)
448ImmutableDictionary<TKey, TValue>.Comparers comparers = _comparers.WithValueComparer(valueComparer);
455var set = new ImmutableDictionary<TKey, TValue>(comparers);
464public ImmutableDictionary<TKey, TValue> WithComparers(IEqualityComparer<TKey>? keyComparer)
470/// Determines whether the <see cref="ImmutableDictionary{TKey, TValue}"/>
474/// The value to locate in the <see cref="ImmutableDictionary{TKey, TValue}"/>.
478/// true if the <see cref="ImmutableDictionary{TKey, TValue}"/> contains
835private static ImmutableDictionary<TKey, TValue> EmptyWithComparers(Comparers comparers)
845/// Attempts to discover an <see cref="ImmutableDictionary{TKey, TValue}"/> instance beneath some enumerable sequence
849/// <param name="other">Receives the concrete <see cref="ImmutableDictionary{TKey, TValue}"/> typed value if one can be found.</param>
851private static bool TryCastToImmutableMap(IEnumerable<KeyValuePair<TKey, TValue>> sequence, [NotNullWhen(true)] out ImmutableDictionary<TKey, TValue>? other)
853other = sequence as ImmutableDictionary<TKey, TValue>;
944ImmutableDictionary<TKey, TValue>.HashBucket newBucket = bucket.Add(key, value, origin.KeyOnlyComparer, origin.ValueComparer, behavior, out result);
950SortedInt32KeyNode<ImmutableDictionary<TKey, TValue>.HashBucket> newRoot = UpdateRoot(origin.Root, hashCode, newBucket, origin.HashBucketComparer);
962SortedInt32KeyNode<ImmutableDictionary<TKey, TValue>.HashBucket> newRoot = origin.Root;
969ImmutableDictionary<TKey, TValue>.HashBucket newBucket = bucket.Add(pair.Key, pair.Value, origin.KeyOnlyComparer, origin.ValueComparer, collisionBehavior, out result);
986SortedInt32KeyNode<ImmutableDictionary<TKey, TValue>.HashBucket> newRoot = origin.Root;
993ImmutableDictionary<TKey, TValue>.HashBucket newBucket = bucket.Add(pair.Key, pair.Value, origin.KeyOnlyComparer, origin.ValueComparer, collisionBehavior, out result);
1014SortedInt32KeyNode<ImmutableDictionary<TKey, TValue>.HashBucket> newRoot = UpdateRoot(origin.Root, hashCode, bucket.Remove(key, origin.KeyOnlyComparer, out result), origin.HashBucketComparer);
1047private static ImmutableDictionary<TKey, TValue> Wrap(SortedInt32KeyNode<HashBucket> root, Comparers comparers, int count)
1061private ImmutableDictionary<TKey, TValue> Wrap(SortedInt32KeyNode<HashBucket>? root, int adjustedCountIfDifferentRoot)
1081private ImmutableDictionary<TKey, TValue> AddRange(IEnumerable<KeyValuePair<TKey, TValue>> pairs, bool avoidToHashMap)
1090if (TryCastToImmutableMap(pairs, out ImmutableDictionary<TKey, TValue>? other))
1096ImmutableDictionary<TKey, TValue>.MutationResult result = AddRange(pairs, this.Origin);
System\Collections\Immutable\ImmutableInterlocked.cs (28)
250public static TValue GetOrAdd<TKey, TValue, TArg>(ref ImmutableDictionary<TKey, TValue> location, TKey key, Func<TKey, TArg, TValue> valueFactory, TArg factoryArgument)
258ImmutableDictionary<TKey, TValue> map = Volatile.Read(ref location);
283public static TValue GetOrAdd<TKey, TValue>(ref ImmutableDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> valueFactory) where TKey : notnull
287ImmutableDictionary<TKey, TValue> map = Volatile.Read(ref location);
309public static TValue GetOrAdd<TKey, TValue>(ref ImmutableDictionary<TKey, TValue> location, TKey key, TValue value) where TKey : notnull
311ImmutableDictionary<TKey, TValue> priorCollection = Volatile.Read(ref location);
322ImmutableDictionary<TKey, TValue> updatedCollection = priorCollection.Add(key, value);
323ImmutableDictionary<TKey, TValue> interlockedResult = Interlocked.CompareExchange(ref location, updatedCollection, priorCollection);
344public static TValue AddOrUpdate<TKey, TValue>(ref ImmutableDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> addValueFactory, Func<TKey, TValue, TValue> updateValueFactory) where TKey : notnull
350ImmutableDictionary<TKey, TValue> priorCollection = Volatile.Read(ref location);
366ImmutableDictionary<TKey, TValue> updatedCollection = priorCollection.SetItem(key, newValue);
371ImmutableDictionary<TKey, TValue> interlockedResult = Interlocked.CompareExchange(ref location, updatedCollection, priorCollection);
392public static TValue AddOrUpdate<TKey, TValue>(ref ImmutableDictionary<TKey, TValue> location, TKey key, TValue addValue, Func<TKey, TValue, TValue> updateValueFactory) where TKey : notnull
397ImmutableDictionary<TKey, TValue> priorCollection = Volatile.Read(ref location);
413ImmutableDictionary<TKey, TValue> updatedCollection = priorCollection.SetItem(key, newValue);
418ImmutableDictionary<TKey, TValue> interlockedResult = Interlocked.CompareExchange(ref location, updatedCollection, priorCollection);
438public static bool TryAdd<TKey, TValue>(ref ImmutableDictionary<TKey, TValue> location, TKey key, TValue value) where TKey : notnull
440ImmutableDictionary<TKey, TValue> priorCollection = Volatile.Read(ref location);
451ImmutableDictionary<TKey, TValue> updatedCollection = priorCollection.Add(key, value);
452ImmutableDictionary<TKey, TValue> interlockedResult = Interlocked.CompareExchange(ref location, updatedCollection, priorCollection);
470public static bool TryUpdate<TKey, TValue>(ref ImmutableDictionary<TKey, TValue> location, TKey key, TValue newValue, TValue comparisonValue) where TKey : notnull
473ImmutableDictionary<TKey, TValue> priorCollection = Volatile.Read(ref location);
486ImmutableDictionary<TKey, TValue> updatedCollection = priorCollection.SetItem(key, newValue);
487ImmutableDictionary<TKey, TValue> interlockedResult = Interlocked.CompareExchange(ref location, updatedCollection, priorCollection);
504public static bool TryRemove<TKey, TValue>(ref ImmutableDictionary<TKey, TValue> location, TKey key, [MaybeNullWhen(false)] out TValue value) where TKey : notnull
506ImmutableDictionary<TKey, TValue> priorCollection = Volatile.Read(ref location);
517ImmutableDictionary<TKey, TValue> updatedCollection = priorCollection.Remove(key);
518ImmutableDictionary<TKey, TValue> interlockedResult = Interlocked.CompareExchange(ref location, updatedCollection, priorCollection);
System.Text.Json.SourceGeneration (1)
System.Windows.Forms.Analyzers.CSharp.Tests (16)
Test.Utilities (53)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (12)
27ImmutableDictionary<string, string?>? properties,
35ImmutableDictionary<string, string?>? properties,
54ImmutableDictionary<string, string?>? properties,
64ImmutableDictionary<string, string?>? properties,
89ImmutableDictionary<string, string?>? properties,
102properties: ImmutableDictionary<string, string?>.Empty,
108ImmutableDictionary<string, string?>? properties,
116ImmutableDictionary<string, string?>? properties,
143ImmutableDictionary<string, string?>? properties,
184ImmutableDictionary<string, string?>? properties,
250var options = (ImmutableDictionary<string, ReportDiagnostic>)s_syntaxTreeDiagnosticOptionsProperty.GetValue(tree)!;
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (19)
30private readonly ImmutableDictionary<string, TValue> _names;
31private readonly ImmutableDictionary<ISymbol, TValue> _symbols;
53private readonly ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> _wildcardNamesBySymbolKind;
62private SymbolNamesWithValueOption(ImmutableDictionary<string, TValue> names, ImmutableDictionary<ISymbol, TValue> symbols,
63ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> wildcardNamesBySymbolKind)
74_names = ImmutableDictionary<string, TValue>.Empty;
75_symbols = ImmutableDictionary<ISymbol, TValue>.Empty;
76_wildcardNamesBySymbolKind = ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>>.Empty;
309if (_wildcardNamesBySymbolKind.TryGetValue(symbol.Kind, out var names) &&
319if (_wildcardNamesBySymbolKind.TryGetValue(AllKinds, out var value) &&
329if (_wildcardNamesBySymbolKind.TryGetValue(AllKinds, out var allKindsValue) &&
372internal ref readonly ImmutableDictionary<string, TValue> Names => ref _symbolNamesWithValueOption._names;
374internal ref readonly ImmutableDictionary<ISymbol, TValue> Symbols => ref _symbolNamesWithValueOption._symbols;
376internal ref readonly ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> WildcardNamesBySymbolKind => ref _symbolNamesWithValueOption._wildcardNamesBySymbolKind;
Text.Analyzers (49)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (12)
27ImmutableDictionary<string, string?>? properties,
35ImmutableDictionary<string, string?>? properties,
54ImmutableDictionary<string, string?>? properties,
64ImmutableDictionary<string, string?>? properties,
89ImmutableDictionary<string, string?>? properties,
102properties: ImmutableDictionary<string, string?>.Empty,
108ImmutableDictionary<string, string?>? properties,
116ImmutableDictionary<string, string?>? properties,
143ImmutableDictionary<string, string?>? properties,
184ImmutableDictionary<string, string?>? properties,
250var options = (ImmutableDictionary<string, ReportDiagnostic>)s_syntaxTreeDiagnosticOptionsProperty.GetValue(tree)!;
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (19)
30private readonly ImmutableDictionary<string, TValue> _names;
31private readonly ImmutableDictionary<ISymbol, TValue> _symbols;
53private readonly ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> _wildcardNamesBySymbolKind;
62private SymbolNamesWithValueOption(ImmutableDictionary<string, TValue> names, ImmutableDictionary<ISymbol, TValue> symbols,
63ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> wildcardNamesBySymbolKind)
74_names = ImmutableDictionary<string, TValue>.Empty;
75_symbols = ImmutableDictionary<ISymbol, TValue>.Empty;
76_wildcardNamesBySymbolKind = ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>>.Empty;
309if (_wildcardNamesBySymbolKind.TryGetValue(symbol.Kind, out var names) &&
319if (_wildcardNamesBySymbolKind.TryGetValue(AllKinds, out var value) &&
329if (_wildcardNamesBySymbolKind.TryGetValue(AllKinds, out var allKindsValue) &&
372internal ref readonly ImmutableDictionary<string, TValue> Names => ref _symbolNamesWithValueOption._names;
374internal ref readonly ImmutableDictionary<ISymbol, TValue> Symbols => ref _symbolNamesWithValueOption._symbols;
376internal ref readonly ImmutableDictionary<SymbolKind, ImmutableDictionary<string, TValue>> WildcardNamesBySymbolKind => ref _symbolNamesWithValueOption._wildcardNamesBySymbolKind;
xunit.assert (2)