Share via


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)

Syntax

'Declaration
Function SetErrorInfo ( _
    hr As Integer, _
    pszDescription As String, _
    dwReserved As UInteger, _
    pszHelpKeyword As String, _
    pszSource As String _
) As Integer
'Usage
Dim instance As IVsUIShell 
Dim hr As Integer 
Dim pszDescription As String 
Dim dwReserved As UInteger 
Dim pszHelpKeyword As String 
Dim pszSource As String 
Dim returnValue As Integer 

returnValue = instance.SetErrorInfo(hr, _
    pszDescription, dwReserved, pszHelpKeyword, _
    pszSource)
int SetErrorInfo(
    int hr,
    string pszDescription,
    uint dwReserved,
    string pszHelpKeyword,
    string pszSource
)
int SetErrorInfo(
    [InAttribute] int hr, 
    [InAttribute] String^ pszDescription, 
    [InAttribute] unsigned int dwReserved, 
    [InAttribute] String^ pszHelpKeyword, 
    [InAttribute] String^ pszSource
)
function SetErrorInfo(
    hr : int, 
    pszDescription : String, 
    dwReserved : uint, 
    pszHelpKeyword : String, 
    pszSource : String
) : int

Parameters

  • pszDescription
    Type: System.String

    [in] Rich error information.

  • pszHelpKeyword
    Type: System.String

    [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 Unique F1 Keywords.

  • pszSource
    Type: System.String

    [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

Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

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.

.NET Framework Security

See Also

Reference

IVsUIShell Interface

IVsUIShell Members

Microsoft.VisualStudio.Shell.Interop Namespace