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.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
Syntax
‘선언
Public Overridable Sub AddError ( _
path As String, _
message As String, _
context As TextSpan, _
sev As Severity _
)
‘사용 방법
Dim instance As AuthoringSink
Dim path As String
Dim message As String
Dim context As TextSpan
Dim sev As Severity
instance.AddError(path, message, context, _
sev)
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: System.String
[in] The source file's path.
- message
Type: System.String
[in] The error message to report.
- context
Type: Microsoft.VisualStudio.TextManager.Interop.TextSpan
[in] A TextSpan indicating what triggered the error (this is used to mark the bad code).
- sev
Type: Microsoft.VisualStudio.Package.Severity
[in] The severity of the error: a value from the Severity enumeration.
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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.