Partager via


ThreadHelper.ThrowIfOnUIThread Method

Determines whether the call is being made on the UI thread ,and throws COMException(RPC_E_WRONG_THREAD) if it is.

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

Syntax

'Declaration
Public Shared Sub ThrowIfOnUIThread ( _
    callerMemberName As String _
)
public static void ThrowIfOnUIThread(
    string callerMemberName
)
public:
static void ThrowIfOnUIThread(
    String^ callerMemberName
)
static member ThrowIfOnUIThread : 
        callerMemberName:string -> unit
public static function ThrowIfOnUIThread(
    callerMemberName : String
)

Parameters

  • callerMemberName
    Type: String

    The optional name of caller if a Debug Assert is desired if on the UI thread.

Exceptions

Exception Condition
[COMException]

Thrown with RPC_E_WRONG_THREAD when called on any thread other than the main UI thread.

.NET Framework Security

See Also

Reference

ThreadHelper Class

Microsoft.VisualStudio.Shell Namespace