AppDomains and Escalation Policies, or ICLRPolicyManager::SetTimeoutAndAction RRS feed

  • Question

  • Does anyone know if there's any way, in C#, to do the equivalent of ICLRPolicyManager::SetTimeoutAndAction on an AppDomain? I want to set the escalation policy for an AppDomain so that I can force it to shut down, even if a thread is blocking in unmanaged code. It’s a last-resort type of thing, to guarantee I can unload a misbehaving AppDomain no matter what.

    And before I get lectured from everyone, I realize the best answer is to have code that doesn't require this. But I have something that needs to stay running, even when the very unexpected happens.

    By the way, setting a thread's IsBackground property won't solve this issue. If a thread is blocked on on unmanaged code, it will not allow you to unload an AppDomain (you can, however, shut down the application itself, but this is what I'm trying to avoid).



    Thursday, February 17, 2011 8:39 PM

All replies