IVsGeneratorProgress::GeneratorError Method (Int32, UInt32, String^, UInt32, UInt32)
Returns warning and error information to the project system.
Assembly: Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)
int GeneratorError( int fWarning, unsigned int dwLevel, String^ bstrError, unsigned int dwLine, unsigned int dwColumn )
Parameters
- fWarning
-
Type:
System::Int32
[in] Flag that indicates whether this message is a warning or an error. Set to true to indicate a warning or to false to indicate an error.
- dwLevel
-
Type:
System::UInt32
[in] Severity level of the error. The project system currently ignores the value of this parameter.
- bstrError
-
Type:
System::String^
[in] Text of the error to be displayed to the user by means of the Task List.
- dwLine
-
Type:
System::UInt32
[in] Zero-based line number that indicates where in the source file the error occurred. This can be –1 (or, 0xFFFFFFFF) if not needed.
- dwColumn
-
Type:
System::UInt32
[in] One-based column number that indicates where in the source file the error occurred. This can be –1 if not needed, but must be –1 if dwLine is –1.
Return Value
Type: System::Int32If the method succeeds, it returns S_OK. If it fails, it returns an error code.
From vsshell.idl:
HRESULT IVsGeneratorProgress::GeneratorError( [in] BOOL fWarning, [in] DWORD dwLevel, [in] BSTR bstrError, [in] DWORD dwLine, [in] DWORD dwColumn );
The behavior of the project system with respect to fWarning provides a custom tool with two possibilities for reporting errors:
Use IVsGeneratorProgress.GeneratorError to report multiple errors (or, Task List items).
Set error information in Generate and rely on the project system to display a task list item automatically.
If a FAILED is returned from the Generate method and at least one error has been added (fWarning = false), the project system does not display its own generic error message. Otherwise, a generic message that is displayed includes the custom tool name and any error information set by the custom tool prior to its return from Generate.