none
Any way to unload the default AppDomain in an unmanaged application? RRS feed

  • Question

  • I have an application written in Visual FoxPro which uses .NET components through a third-party COM interop library. Now that I have it all working I want to be able to unload the .NET Runtime and most of all the related .NET assemblies which are loaded into the default AppDomain. I know that in general unloading is not supported for the default AppDomain but my assumption is that this must be possible for unmanaged applications which may use .NET assemblies indirectly.

    I've tried this question on Stack Overflow but unfortunately have had no takers so far.
    Monday, March 1, 2010 11:48 AM

Answers

  • CLR cannot be unloaded from process. It is not supported scenario. To release CLR acquired resources (like threads, etc.), you have to terminate the process (it is mentioned for example here).

    There is API for unloading AppDomains by host (ICLRRuntimeHost::UnloadAppDomain), but I don't think it will work for default AppDomain. However you can give it a try.

    -Karel
    • Marked as answer by eryang Tuesday, March 9, 2010 3:25 AM
    Monday, March 1, 2010 4:43 PM
    Moderator