Share via


AuthoringSink.AddError Method

Adds an error in parsing message for later reporting.

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

Syntax

'Declaration
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
)
public:
virtual void AddError(
    String^ path, 
    String^ message, 
    TextSpan context, 
    Severity sev
)
abstract AddError : 
        path:string * 
        message:string * 
        context:TextSpan * 
        sev:Severity -> unit  
override AddError : 
        path:string * 
        message:string * 
        context:TextSpan * 
        sev:Severity -> unit
public function AddError(
    path : String, 
    message : String, 
    context : TextSpan, 
    sev : Severity
)

Parameters

  • path
    Type: String

    [in] The source file's path.

  • message
    Type: String

    [in] The error message to report.

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