Share via


DiagnosticAnalyzerExtensions.WithAnalyzers Method

Definition

Overloads

WithAnalyzers(Compilation, ImmutableArray<DiagnosticAnalyzer>, AnalyzerOptions)

Returns a new compilation with attached diagnostic analyzers.

WithAnalyzers(Compilation, ImmutableArray<DiagnosticAnalyzer>, CompilationWithAnalyzersOptions)

Returns a new compilation with attached diagnostic analyzers.

WithAnalyzers(Compilation, ImmutableArray<DiagnosticAnalyzer>, AnalyzerOptions, CancellationToken)
Obsolete.

Returns a new compilation with attached diagnostic analyzers.

WithAnalyzers(Compilation, ImmutableArray<DiagnosticAnalyzer>, AnalyzerOptions)

Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs

Returns a new compilation with attached diagnostic analyzers.

public static Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers WithAnalyzers (this Microsoft.CodeAnalysis.Compilation compilation, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer> analyzers, Microsoft.CodeAnalysis.Diagnostics.AnalyzerOptions? options = default);
static member WithAnalyzers : Microsoft.CodeAnalysis.Compilation * System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer> * Microsoft.CodeAnalysis.Diagnostics.AnalyzerOptions -> Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers
<Extension()>
Public Function WithAnalyzers (compilation As Compilation, analyzers As ImmutableArray(Of DiagnosticAnalyzer), Optional options As AnalyzerOptions = Nothing) As CompilationWithAnalyzers

Parameters

compilation
Compilation

Compilation to which analyzers are to be added.

analyzers
ImmutableArray<DiagnosticAnalyzer>

The set of analyzers to include in future analyses.

options
AnalyzerOptions

Options that are passed to analyzers.

Returns

Applies to

WithAnalyzers(Compilation, ImmutableArray<DiagnosticAnalyzer>, CompilationWithAnalyzersOptions)

Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs

Returns a new compilation with attached diagnostic analyzers.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::CodeAnalysis::Diagnostics::CompilationWithAnalyzers ^ WithAnalyzers(Microsoft::CodeAnalysis::Compilation ^ compilation, System::Collections::Immutable::ImmutableArray<Microsoft::CodeAnalysis::Diagnostics::DiagnosticAnalyzer ^> analyzers, Microsoft::CodeAnalysis::Diagnostics::CompilationWithAnalyzersOptions ^ analysisOptions);
public static Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers WithAnalyzers (this Microsoft.CodeAnalysis.Compilation compilation, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer> analyzers, Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzersOptions analysisOptions);
static member WithAnalyzers : Microsoft.CodeAnalysis.Compilation * System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer> * Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzersOptions -> Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers
<Extension()>
Public Function WithAnalyzers (compilation As Compilation, analyzers As ImmutableArray(Of DiagnosticAnalyzer), analysisOptions As CompilationWithAnalyzersOptions) As CompilationWithAnalyzers

Parameters

compilation
Compilation

Compilation to which analyzers are to be added.

analyzers
ImmutableArray<DiagnosticAnalyzer>

The set of analyzers to include in future analyses.

analysisOptions
CompilationWithAnalyzersOptions

Options to configure analyzer execution within CompilationWithAnalyzers.

Returns

Applies to

WithAnalyzers(Compilation, ImmutableArray<DiagnosticAnalyzer>, AnalyzerOptions, CancellationToken)

Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs
Source:
DiagnosticAnalyzerExtensions.cs

Caution

Use WithAnalyzers overload without a cancellation token

Returns a new compilation with attached diagnostic analyzers.

public static Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers WithAnalyzers (this Microsoft.CodeAnalysis.Compilation compilation, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer> analyzers, Microsoft.CodeAnalysis.Diagnostics.AnalyzerOptions options = default, System.Threading.CancellationToken cancellationToken = default);
public static Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers WithAnalyzers (this Microsoft.CodeAnalysis.Compilation compilation, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer> analyzers, Microsoft.CodeAnalysis.Diagnostics.AnalyzerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
[System.Obsolete("Use WithAnalyzers overload without a cancellation token", false)]
public static Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers WithAnalyzers (this Microsoft.CodeAnalysis.Compilation compilation, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer> analyzers, Microsoft.CodeAnalysis.Diagnostics.AnalyzerOptions? options, System.Threading.CancellationToken cancellationToken);
static member WithAnalyzers : Microsoft.CodeAnalysis.Compilation * System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer> * Microsoft.CodeAnalysis.Diagnostics.AnalyzerOptions * System.Threading.CancellationToken -> Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers
[<System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)>]
[<System.Obsolete("Use WithAnalyzers overload without a cancellation token", false)>]
static member WithAnalyzers : Microsoft.CodeAnalysis.Compilation * System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer> * Microsoft.CodeAnalysis.Diagnostics.AnalyzerOptions * System.Threading.CancellationToken -> Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers
<Extension()>
Public Function WithAnalyzers (compilation As Compilation, analyzers As ImmutableArray(Of DiagnosticAnalyzer), Optional options As AnalyzerOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As CompilationWithAnalyzers
<Extension()>
Public Function WithAnalyzers (compilation As Compilation, analyzers As ImmutableArray(Of DiagnosticAnalyzer), options As AnalyzerOptions, cancellationToken As CancellationToken) As CompilationWithAnalyzers

Parameters

compilation
Compilation

Compilation to which analyzers are to be added.

analyzers
ImmutableArray<DiagnosticAnalyzer>

The set of analyzers to include in future analyses.

options
AnalyzerOptions

Options that are passed to analyzers.

cancellationToken
CancellationToken

A cancellation token that can be used to abort analysis.

Returns

Attributes

Applies to