This topic has not yet been rated - Rate this topic

IVsGeneratorProgress.GeneratorError Method

Returns warning and error information to the project system.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)
int GeneratorError(
	int fWarning,
	uint dwLevel,
	string bstrError,
	uint dwLine,
	uint 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.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

COM Signature

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.

Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.