Compartilhar via


AuthoringSink.AddError Method

Adds an error in parsing message for later reporting.

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
  Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)

Syntax

'Declaração
Public Overridable Sub AddError ( _
    path As String, _
    message As String, _
    context As TextSpan, _
    sev As Severity _
)
public virtual void AddError(
    string path,
    string message,
    TextSpan context,
    Severity sev
)

Parameters

Remarks

If the parser encounters any errors in the parsing operation, it can store the errors for later reporting through this method. The assumption here is the parser can recover from simple syntax errors and continue on parsing. This allows the user to see all the errors encountered and fix them all before committing to a compilation.

Note that this approach to storing errors is used in support of checking the source code dynamically, before the user actually compiles the code. All the errors in the list are shown in the code (typically with the squiggly underline) and the error message is shown when the user holds the cursor over the error line.

.NET Framework Security

See Also

Reference

AuthoringSink Class

Microsoft.VisualStudio.Package Namespace