Delen via


SemanticModel.GetSyntaxDiagnostics Method

Definition

Get all of the syntax errors within the syntax tree associated with this object. Does not get errors involving declarations or compiling method bodies or initializers.

public abstract System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostic> GetSyntaxDiagnostics (Microsoft.CodeAnalysis.Text.TextSpan? span = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetSyntaxDiagnostics : Nullable<Microsoft.CodeAnalysis.Text.TextSpan> * System.Threading.CancellationToken -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostic>
Public MustOverride Function GetSyntaxDiagnostics (Optional span As Nullable(Of TextSpan) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic)

Parameters

span
Nullable<TextSpan>

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

Applies to