5 instantiations of CompilationWithAnalyzers
Microsoft.CodeAnalysis (2)
DiagnosticAnalyzer\DiagnosticAnalyzerExtensions.cs (2)
21return new CompilationWithAnalyzers(compilation, analyzers, options, cancellationToken); 32return new CompilationWithAnalyzers(compilation, analyzers, analysisOptions);
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (1)
Diagnostics\DiagnosticAnalyzerTests.cs (1)
3511var compWithAnalyzers = new CompilationWithAnalyzers(
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
Preview\PreviewWorkspaceTests.cs (1)
272var compilationWithAnalyzers = new CompilationWithAnalyzers(compilation, analyzers, compilationWithAnalyzersOptions);
Microsoft.CodeAnalysis.UnitTests (1)
Diagnostics\CompilationWithAnalyzersTests.cs (1)
62var compWithAnalyzers = new CompilationWithAnalyzers(compilation, analyzers, analyzerOptions, CancellationToken.None);
104 references to CompilationWithAnalyzers
AnalyzerRunner (2)
DiagnosticAnalyzerRunner.cs (2)
191CompilationWithAnalyzers compilationWithAnalyzers = compilation.WithAnalyzers(languageAnalyzers, new CompilationWithAnalyzersOptions(workspaceAnalyzerOptions, null, analyzerOptionsInternal.RunConcurrent, logAnalyzerExecutionTime: true, reportSuppressedDiagnostics: analyzerOptionsInternal.ReportSuppressedDiagnostics)); 399var compilationWithAnalyzers = newCompilation.WithAnalyzers(analyzers, new CompilationWithAnalyzersOptions(workspaceAnalyzerOptions, null, analyzerOptionsInternal.RunConcurrent, logAnalyzerExecutionTime: true, reportSuppressedDiagnostics: analyzerOptionsInternal.ReportSuppressedDiagnostics));
Microsoft.CodeAnalysis (15)
DiagnosticAnalyzer\AnalysisScope.cs (2)
58/// Flag indicating if this is a partial analysis for the corresponding <see cref="CompilationWithAnalyzers"/>, 59/// i.e. <see cref="IsSingleFileAnalysis"/> is true and/or <see cref="Analyzers"/> is a subset of <see cref="CompilationWithAnalyzers.Analyzers"/>.
DiagnosticAnalyzer\CachingSemanticModelProvider.cs (1)
15/// For example, <see cref="CompilationWithAnalyzers"/> uses this provider to ensure that semantic model instances
DiagnosticAnalyzer\CompilationWithAnalyzers.cs (8)
254/// <param name="analyzers">Analyzers whose diagnostics are required. All the given analyzers must be from the analyzers passed into the constructor of <see cref="CompilationWithAnalyzers"/>.</param> 274/// <param name="analyzers">Analyzers whose analysis results are required. All the given analyzers must be from the analyzers passed into the constructor of <see cref="CompilationWithAnalyzers"/>.</param> 349/// <param name="analyzers">Analyzers whose diagnostics are required. All the given analyzers must be from the analyzers passed into the constructor of <see cref="CompilationWithAnalyzers"/>.</param> 416/// <param name="analyzers">Analyzers whose diagnostics are required. All the given analyzers must be from the analyzers passed into the constructor of <see cref="CompilationWithAnalyzers"/>.</param> 444/// <param name="analyzers">Analyzers whose diagnostics are required. All the given analyzers must be from the analyzers passed into the constructor of <see cref="CompilationWithAnalyzers"/>.</param> 474/// <param name="analyzers">Analyzers whose diagnostics are required. All the given analyzers must be from the analyzers passed into the constructor of <see cref="CompilationWithAnalyzers"/>.</param> 518/// <param name="analyzers">Analyzers whose diagnostics are required. All the given analyzers must be from the analyzers passed into the constructor of <see cref="CompilationWithAnalyzers"/>.</param> 548/// <param name="analyzers">Analyzers whose diagnostics are required. All the given analyzers must be from the analyzers passed into the constructor of <see cref="CompilationWithAnalyzers"/>.</param>
DiagnosticAnalyzer\CompilationWithAnalyzersOptions.cs (1)
10/// Options to configure analyzer execution within <see cref="CompilationWithAnalyzers"/>.
DiagnosticAnalyzer\DiagnosticAnalyzerExtensions.cs (3)
19public static CompilationWithAnalyzers WithAnalyzers(this Compilation compilation, ImmutableArray<DiagnosticAnalyzer> analyzers, AnalyzerOptions? options = null, CancellationToken cancellationToken = default) 29/// <param name="analysisOptions">Options to configure analyzer execution within <see cref="CompilationWithAnalyzers"/>.</param> 30public static CompilationWithAnalyzers WithAnalyzers(this Compilation compilation, ImmutableArray<DiagnosticAnalyzer> analyzers, CompilationWithAnalyzersOptions analysisOptions)
Microsoft.CodeAnalysis.CodeStyle (5)
AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (4)
85CompilationWithAnalyzers compilationWithAnalyzers, 391CompilationWithAnalyzers compilationWithAnalyzers, 507CompilationWithAnalyzers compilationWithAnalyzers, 618var effectiveDiagnostics = CompilationWithAnalyzers.GetEffectiveDiagnostics(diagnosticsBuilder, compilation);
IPragmaSuppressionsAnalyzer.cs (1)
25CompilationWithAnalyzers compilationWithAnalyzers,
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (17)
Diagnostics\DiagnosticAnalyzerTests.cs (6)
3256var compilationWithAnalyzers = compilation.WithAnalyzers(ImmutableArray.Create<DiagnosticAnalyzer>(analyzer1, analyzer2)); 3511var compWithAnalyzers = new CompilationWithAnalyzers( 3595var compilationWithAnalyzers = compilation.WithAnalyzers(allAnalyzers); 3662var compilationWithAnalyzers = compilation.WithAnalyzers(allAnalyzers); 3722var compilationWithAnalyzers = compilation.WithAnalyzers(analyzers); 4075var compilationWithAnalyzers = compilation.WithAnalyzers(ImmutableArray.Create<DiagnosticAnalyzer>(analyzer));
Diagnostics\GetDiagnosticsTests.cs (11)
459var effectiveDiagnostics = CompilationWithAnalyzers.GetEffectiveDiagnostics(diagnostics, compilation); 492var compilationWithAnalyzers = compilation.WithAnalyzers(analyzers, new AnalyzerOptions(ImmutableArray<AdditionalText>.Empty)); 554var compilationWithAnalyzers = compilation.WithAnalyzers(ImmutableArray.Create(analyzer), analyzerOptions); 602var compilationWithAnalyzers = compilation.WithAnalyzers(analyzers, 655var compilationWithAnalyzers = compilation.WithAnalyzers(analyzers, 684var compilationWithAnalyzers = compilation.WithAnalyzers(analyzers, 724var compilationWithAnalyzers = compilation.WithAnalyzers(analyzers, AnalyzerOptions.Empty); 777var compilationWithAnalyzers = compilation.WithAnalyzers(ImmutableArray.Create<DiagnosticAnalyzer>(analyzer), AnalyzerOptions.Empty); 1003var compilationWithAnalyzers = compilation.WithAnalyzers(ImmutableArray.Create<DiagnosticAnalyzer>(compilerAnalyzer), AnalyzerOptions.Empty); 1051var compilationWithAnalyzers = compilation.WithAnalyzers(analyzers); 1131var compilationWithAnalyzers = compilation.WithAnalyzers(ImmutableArray.Create<DiagnosticAnalyzer>(analyzer), AnalyzerOptions.Empty);
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
Preview\PreviewWorkspaceTests.cs (1)
272var compilationWithAnalyzers = new CompilationWithAnalyzers(compilation, analyzers, compilationWithAnalyzersOptions);
Microsoft.CodeAnalysis.Features (6)
AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (4)
85CompilationWithAnalyzers compilationWithAnalyzers, 391CompilationWithAnalyzers compilationWithAnalyzers, 507CompilationWithAnalyzers compilationWithAnalyzers, 618var effectiveDiagnostics = CompilationWithAnalyzers.GetEffectiveDiagnostics(diagnosticsBuilder, compilation);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction_Pragma.cs (1)
213var effectiveDiagnostic = CompilationWithAnalyzers.GetEffectiveDiagnostics(new[] { dummyDiagnosticWithLocationToCheck }, model.Compilation).FirstOrDefault();
SyncNamespaces\AbstractSyncNamespacesService.cs (1)
86var analyzerCompilation = compilation.WithAnalyzers(diagnosticAnalyzers, analyzerOptions);
Microsoft.CodeAnalysis.LanguageServer.Protocol (34)
Features\Diagnostics\DefaultDiagnosticAnalyzerService.cs (1)
163var compilationWithAnalyzers = await DocumentAnalysisExecutor.CreateCompilationWithAnalyzersAsync(
Features\Diagnostics\DocumentAnalysisExecutor.cs (3)
28private readonly CompilationWithAnalyzers? _compilationWithAnalyzers; 40CompilationWithAnalyzers? compilationWithAnalyzers, 171Debug.Assert(diags.Length == CompilationWithAnalyzers.GetEffectiveDiagnostics(diags, _compilationWithAnalyzers.Compilation).Count());
Features\Diagnostics\DocumentAnalysisExecutor_Helpers.cs (3)
130public static async Task<CompilationWithAnalyzers?> CreateCompilationWithAnalyzersAsync( 262diagnostics = CompilationWithAnalyzers.GetEffectiveDiagnostics(diagnostics, compilation).ToImmutableArrayOrEmpty(); 295diagnostics = CompilationWithAnalyzers.GetEffectiveDiagnostics(diagnostics, compilation).ToImmutableArrayOrEmpty();
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.CompilationManager.cs (5)
21private async Task<CompilationWithAnalyzers?> GetOrCreateCompilationWithAnalyzersAsync(Project project, ImmutableArray<StateSet> stateSets, CancellationToken cancellationToken) 30if (_projectCompilationsWithAnalyzers.TryGetValue(project, out var compilationWithAnalyzers)) 46var newCompilationWithAnalyzers = await CreateCompilationWithAnalyzersAsync(project, ideOptions, stateSets, includeSuppressedDiagnostics: true, cancellationToken).ConfigureAwait(false); 60private static Task<CompilationWithAnalyzers?> CreateCompilationWithAnalyzersAsync(Project project, IdeAnalyzerOptions ideOptions, IEnumerable<StateSet> stateSets, bool includeSuppressedDiagnostics, CancellationToken cancellationToken) 80private static void AssertAnalyzers(CompilationWithAnalyzers? compilation, IEnumerable<StateSet> stateSets)
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.cs (1)
41private readonly ConditionalWeakTable<Project, CompilationWithAnalyzers?> _projectCompilationsWithAnalyzers = new();
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.Executor.cs (6)
170CompilationWithAnalyzers? compilationWithAnalyzers, Project project, IdeAnalyzerOptions ideOptions, ImmutableArray<StateSet> stateSets, bool forceAnalyzerRun, CancellationToken cancellationToken) 261private static bool CompilationHasOpenFileOnlyAnalyzers(CompilationWithAnalyzers? compilationWithAnalyzers, SimplifierOptions? options) 315CompilationWithAnalyzers? compilationWithAnalyzers, Project project, ImmutableArray<DiagnosticAnalyzer> ideAnalyzers, bool forcedAnalysis, CancellationToken cancellationToken) 344CompilationWithAnalyzers? compilationWithAnalyzers, Project project, IdeAnalyzerOptions ideOptions, ImmutableArray<StateSet> stateSets, bool forcedAnalysis, 363var compilationWithReducedAnalyzers = (analyzersToRun.Length == 0) ? null : 407CompilationWithAnalyzers compilationWithAnalyzers, VersionStamp version,
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.InProcOrRemoteHostAnalyzerRunner.cs (5)
41CompilationWithAnalyzers compilationWithAnalyzers, 50CompilationWithAnalyzers compilationWithAnalyzers, 61CompilationWithAnalyzers compilationWithAnalyzers, 90CompilationWithAnalyzers compilationWithAnalyzers, 157CompilationWithAnalyzers compilationWithAnalyzers,
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer_GetDiagnostics.cs (1)
266var compilation = await CreateCompilationWithAnalyzersAsync(project, ideOptions, stateSets, IncludeSuppressedDiagnostics, cancellationToken).ConfigureAwait(false);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs (5)
70private readonly CompilationWithAnalyzers? _compilationWithAnalyzers; 115var compilationWithAnalyzers = await GetOrCreateCompilationWithAnalyzersAsync(document.Project, ideOptions, stateSets, includeSuppressedDiagnostics, cancellationToken).ConfigureAwait(false); 122private static async Task<CompilationWithAnalyzers?> GetOrCreateCompilationWithAnalyzersAsync( 143var compilationWithAnalyzers = await CreateCompilationWithAnalyzersAsync(project, ideOptions, stateSets, includeSuppressedDiagnostics, cancellationToken).ConfigureAwait(false); 150CompilationWithAnalyzers? compilationWithAnalyzers,
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.ProjectAndCompilationWithAnalyzers.cs (2)
26public CompilationWithAnalyzers? CompilationWithAnalyzers { get; } 28public ProjectAndCompilationWithAnalyzers(Project project, CompilationWithAnalyzers? compilationWithAnalyzers)
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer_IncrementalAnalyzer.cs (2)
53var compilationWithAnalyzers = await GetOrCreateCompilationWithAnalyzersAsync(document.Project, stateSets, cancellationToken).ConfigureAwait(false); 149CompilationWithAnalyzers? compilationWithAnalyzers = null;
Microsoft.CodeAnalysis.Remote.ServiceHub (8)
Services\DiagnosticAnalyzer\DiagnosticComputer.cs (8)
28/// Cache of <see cref="CompilationWithAnalyzers"/> and a map from analyzer IDs to <see cref="DiagnosticAnalyzer"/>s 30/// The <see cref="CompilationWithAnalyzers"/> instance is shared between all the following document analyses modes for the project: 147CompilationWithAnalyzers compilationWithAnalyzers, 268private async Task<(CompilationWithAnalyzers compilationWithAnalyzers, BidirectionalMap<string, DiagnosticAnalyzer> analyzerToIdMap)> GetOrCreateCompilationWithAnalyzersAsync(CancellationToken cancellationToken) 323var compilationWithAnalyzers = await CreateCompilationWithAnalyzerAsync(analyzerBuilder.ToImmutable(), cancellationToken).ConfigureAwait(false); 329private async Task<CompilationWithAnalyzers> CreateCompilationWithAnalyzerAsync(ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken) 361public CompilationWithAnalyzers CompilationWithAnalyzers { get; } 364public CompilationWithAnalyzersCacheEntry(Checksum solutionChecksum, Project project, CompilationWithAnalyzers compilationWithAnalyzers, BidirectionalMap<string, DiagnosticAnalyzer> analyzerToIdMap)
Microsoft.CodeAnalysis.Test.Utilities (2)
Diagnostics\DiagnosticExtensions.cs (2)
341return CompilationWithAnalyzers.GetEffectiveDiagnostics(diagnostics, compilation); 349return CompilationWithAnalyzers.IsDiagnosticAnalyzerSuppressed(analyzer, options);
Microsoft.CodeAnalysis.UnitTests (6)
Diagnostics\CompilationWithAnalyzersTests.cs (6)
31Assert.Throws<ArgumentNullException>(() => CompilationWithAnalyzers.GetEffectiveDiagnostics(default(ImmutableArray<Diagnostic>), c)); 32Assert.Throws<ArgumentNullException>(() => CompilationWithAnalyzers.GetEffectiveDiagnostics(null, c)); 33Assert.Throws<ArgumentNullException>(() => CompilationWithAnalyzers.GetEffectiveDiagnostics(ds, null)); 47var filtered = CompilationWithAnalyzers.GetEffectiveDiagnostics(ds, c); 62var compWithAnalyzers = new CompilationWithAnalyzers(compilation, analyzers, analyzerOptions, CancellationToken.None); 77_ = CompilationWithAnalyzers.IsDiagnosticAnalyzerSuppressed(analyzer, s_dllWithMaxWarningLevel, onAnalyzerException: null);
Microsoft.CodeAnalysis.Workspaces (5)
Diagnostics\Extensions.cs (4)
256Debug.Assert(diagnostics.Length == CompilationWithAnalyzers.GetEffectiveDiagnostics(diagnostics, compilation).Count()); 309this CompilationWithAnalyzers compilationWithAnalyzers, 322CompilationWithAnalyzers compilationWithAnalyzers, 356this CompilationWithAnalyzers compilationWithAnalyzers,
IPragmaSuppressionsAnalyzer.cs (1)
25CompilationWithAnalyzers compilationWithAnalyzers,
Roslyn.VisualStudio.Next.UnitTests (3)
Services\VisualStudioDiagnosticAnalyzerExecutorTests.cs (3)
191var compilationWithAnalyzers = (await project.GetCompilationAsync()).WithAnalyzers( 234var compilationWithAnalyzers = (await project.GetCompilationAsync()) 257var analyzerDriver = (await project.GetCompilationAsync()).WithAnalyzers(