SetErrorInfo Method
The document is archived and information here might be outdated

IVsUIShell.SetErrorInfo Method

Helper method that records rich information about an error.

Namespace: Microsoft.VisualStudio.Shell.Interop
Assembly: Microsoft.VisualStudio.Shell.Interop (in microsoft.visualstudio.shell.interop.dll)

int SetErrorInfo (
	[InAttribute] int hr,
	[InAttribute] string pszDescription,
	[InAttribute] uint dwReserved,
	[InAttribute] string pszHelpKeyword,
	[InAttribute] string pszSource
)
int SetErrorInfo (
	/** @attribute InAttribute() */ int hr, 
	/** @attribute InAttribute() */ String pszDescription, 
	/** @attribute InAttribute() */ UInt32 dwReserved, 
	/** @attribute InAttribute() */ String pszHelpKeyword, 
	/** @attribute InAttribute() */ String pszSource
)
function SetErrorInfo (
	hr : int, 
	pszDescription : String, 
	dwReserved : uint, 
	pszHelpKeyword : String, 
	pszSource : String
) : int

Parameters

hr

[in] Error message to display.

pszDescription

[in] Rich error information.

dwReserved

[in] Must be zero.

pszHelpKeyword

[in] Pointer to the F1 keyword to attach to the Help button on the message box. This keyword links through the environment to a Help file (.HxS) registered with the Visual Studio Help collection. For more information about developing F1 keywords, see F1 Keywords Overview.

pszSource

[in] Pointer to pass to the SetSource method of the standard Windows ICreateErrorInfo interface, which sets the language-dependent ProgID for the class or application that raised the error.

Return Value

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

COM Signature

From vsshell.idl:

HRESULT IVsUIShell::SetErrorInfo(
   [in] HRESULT hr,
   [in] LPCOLESTR pszDescription,
   [in] DWORD dwReserved,
   [in] LPCOLESTR pszHelpKeyword,
   [in] LPCOLESTR pszSource
);

This method is a helper function that you employ in the same way as the Win32 API SetErrorInfo function. The IVsUIShell.SetErrorInfo method adds three parameters to the original function. The last two parameters, dwHelpKeyword and pszSource, accommodate context-sensitive help and language dependencies. The other additional parameter, dwreserved, is reserved.

The IVsUIShell.SetErrorInfo method is typically called within VSPackage objects that handle commands. However, you can use it in any VSPackage if you elect to use a similar error handling strategy.

Show:
© 2016 Microsoft