Partager via


ThreadHelper.ThrowIfNotOnUIThread Method

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

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

Syntax

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

Parameters

  • callerMemberName
    Type: String

    The optional name of caller if a Debug Assert is desired if not 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