SemanticModel.GetDeclarationDiagnostics Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Get all of the declaration errors within the syntax tree associated with this object. Does not get errors involving incorrect syntax, compiling method bodies or initializers.
public abstract System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostic> GetDeclarationDiagnostics (Microsoft.CodeAnalysis.Text.TextSpan? span = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetDeclarationDiagnostics : Nullable<Microsoft.CodeAnalysis.Text.TextSpan> * System.Threading.CancellationToken -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostic>
Public MustOverride Function GetDeclarationDiagnostics (Optional span As Nullable(Of TextSpan) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic)
Parameters
Optional span within the syntax tree for which to get diagnostics. If no argument is specified, then diagnostics for the entire tree are returned.
- cancellationToken
- CancellationToken
A cancellation token that can be used to cancel the process of obtaining the diagnostics.
Returns
Remarks
The declaration errors for a syntax tree are cached. The first time this method is called, all declarations are analyzed for diagnostics. Calling this a second time will return the cached diagnostics.