Informs the common language runtime (CLR) that the host has completed a task, and enables the CLR to reuse the current ICLRTask instance to represent another task.
Reset returned successfully.
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
The call timed out.
The caller does not own the lock.
An event was canceled while a blocked thread or fiber was waiting on it.
An unknown catastrophic failure occurred. When a method returns E_FAIL, the CLR is no longer usable within the process. Subsequent calls to hosting methods return HOST_E_CLRNOTAVAILABLE.
The CLR can recycle previously created ICLRTask instances to avoid the overhead of repeatedly creating new instances every time it needs a fresh task. The host enables this feature by calling ICLRTask::Reset instead of ICLRTask::ExitTask when it has completed a task. The following list summarizes the normal life cycle of an ICLRTask instance:
The runtime creates a new ICLRTask instance.
The runtime calls IHostTaskManager::GetCurrentTask to get a reference to the current host task.
The runtime calls IHostTask::SetCLRTask to associate the new instance with the host task.
The task executes and completes.
The host destroys the task by calling ICLRTask::ExitTask.
Reset alters this scenario in two ways. In step 5 above, the host calls Reset to reset the task to a clean state, and then decouples the ICLRTask instance from its associated IHostTask instance. If desired, the host can also cache the IHostTask instance for reuse. In step 1 above, the runtime pulls a recycled ICLRTask from the cache instead of creating a new instance.
This approach works well when the host also has a pool of reusable worker tasks. When the host destroys one of its IHostTask instances, it destroys the corresponding ICLRTask by calling ExitTask.
Platforms: See .NET Framework System Requirements.
Library: Included as a resource in MSCorEE.dll
.NET Framework Versions: Available since 2.0