Share via


ErrorHandler.CallWithCOMConvention Method (Action)

Catches all but critical exceptions and returns the corresponding HRESULT.

Namespace:  Microsoft.VisualStudio
Assembly:  Microsoft.VisualStudio.Shell.10.0 (in Microsoft.VisualStudio.Shell.10.0.dll)

Syntax

'Declaration
Public Shared Function CallWithCOMConvention ( _
    method As Action _
) As Integer
public static int CallWithCOMConvention(
    Action method
)
public:
static int CallWithCOMConvention(
    Action^ method
)
static member CallWithCOMConvention : 
        method:Action -> int 
public static function CallWithCOMConvention(
    method : Action
) : int

Parameters

  • method
    Type: System.Action
    The T:System.Action that represents the method.

Return Value

Type: System.Int32
The HRESULT.

Remarks

Use this method when an interop interface might be implemented by managed code and its methods are expected to return HRESULT error codes but also throw exceptions. This method will catch all but critical exceptions and return the corresponding HRESULT for the caught exception.

Examples

Use one of the following:

hr = ErrorHandler.CallWithCOMConvention(delegate() {object.method(param);});} 
hr = ErrorHandler.CallWithCOMConvention(() => object.method(param));}

.NET Framework Security

See Also

Reference

ErrorHandler Class

CallWithCOMConvention Overload

Microsoft.VisualStudio Namespace