HostExecutionContextManager::SetHostExecutionContext Method (HostExecutionContext^)
Sets the current host execution context to the specified host execution context.
Assembly: mscorlib (in mscorlib.dll)
public: [SecurityCriticalAttribute] virtual Object^ SetHostExecutionContext( HostExecutionContext^ hostExecutionContext )
Parameters
- hostExecutionContext
-
Type:
System.Threading::HostExecutionContext^
The HostExecutionContext to be set.
Return Value
Type: System::Object^An object for restoring the HostExecutionContext to its previous state.
| Exception | Condition |
|---|---|
| InvalidOperationException | hostExecutionContext was not acquired through a capture operation. -or- hostExecutionContext has been the argument to a previous SetHostExecutionContext method call. |
The SetHostExecutionContext method sets the host execution context for the current HostExecutionContext. A HostExecutionContext that has been used as the argument to another SetHostExecutionContext method call cannot be passed in as the parameter for this method. Instead, use the HostExecutionContext::CreateCopy method to create a copy of a HostExecutionContext object and then use the copy to set the host execution context.
Call the Revert method using the object returned by this method to restore the HostExecutionContext to its previous state.
Requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.
Available since 2.0