ICLRPolicyManager::SetDefaultAction Method

Specifies the policy action the common language runtime (CLR) should take when the specified operation occurs.

Syntax

HRESULT SetDefaultAction (  
    [in] EClrOperation operation,  
    [in] EPolicyAction action  
);  

Parameters

operation
[in] One of the EClrOperation values, indicating the action for which CLR behavior should be customized.

action
[in] One of the EPolicyAction values, indicating the policy action the CLR should take when operation occurs.

Return Value

HRESULT Description
S_OK SetDefaultAction returned successfully.
HOST_E_CLRNOTAVAILABLE The CLR has not been loaded into a process, or the CLR is in a state in which it cannot run managed code or process the call successfully.
HOST_E_TIMEOUT The call timed out.
HOST_E_NOT_OWNER The caller does not own the lock.
HOST_E_ABANDONED An event was canceled while a blocked thread or fiber was waiting on it.
E_FAIL An unknown catastrophic failure occurred. After a method returns E_FAIL, the CLR is no longer usable within the process. Subsequent calls to hosting methods return HOST_E_CLRNOTAVAILABLE.
E_INVALIDARG An invalid action was specified for the operation, or an invalid value was supplied for operation.

Remarks

Not all policy action values can be specified as the default behavior for CLR operations. SetDefaultAction can typically be used only to escalate behavior. For example, a host can specify that thread aborts be turned into rude thread aborts, but cannot specify the opposite. The table below describes the valid action values for each possible operation value.

Value for operation Valid values for action
OPR_ThreadAbort - eAbortThread
- eRudeAbortThread
- eUnloadAppDomain
- eRudeUnloadAppDomain
- eExitProcess
- eFastExitProcess
- eRudeExitProcess
- eDisableRuntime
OPR_ThreadRudeAbortInNonCriticalRegion

OPR_ThreadRudeAbortInCriticalRegion
- eRudeAbortThread
- eUnloadAppDomain
- eRudeUnloadAppDomain
- eExitProcess
- eFastExitProcess
- eRudeExitProcess
- eDisableRuntime
OPR_AppDomainUnload - eUnloadAppDomain
- eRudeUnloadAppDomain
- eExitProcess
- eFastExitProcess
- eRudeExitProcess
- eDisableRuntime
OPR_AppDomainRudeUnload - eRudeUnloadAppDomain
- eExitProcess
- eFastExitProcess
- eRudeExitProcess
- eDisableRuntime
OPR_ProcessExit - eExitProcess
- eFastExitProcess
- eRudeExitProcess
- eDisableRuntime
OPR_FinalizerRun - eNoAction
- eAbortThread
- eRudeAbortThread
- eUnloadAppDomain
- eRudeUnloadAppDomain
- eExitProcess
- eFastExitProcess
- eRudeExitProcess
- eDisableRuntime

Requirements

Platforms: See System Requirements.

Header: MSCorEE.h

Library: Included as a resource in MSCorEE.dll

.NET Framework Versions: Available since 2.0

See also