AppDomain and unloading assemblies
-
Hi everybody. I load an assembly into another AppDomain, not a default one. As there is no way to unload the assembly, I need to unload the domain. This is where the app hangs. The problem is this assembly has references to one dll, currently not performing any work. I tried this: 1. Setting the assembly to null, 2. Implementing a ClassFactory and returning an interface of the object, then removing it, 3. Making assembly to implement the IDisposable interface. None of this works. All examples on the Net just shows how to create AppDomains, load assemblies and then unload the AppDomain. None of those show what happens if the assembly has referenced assemblies. Thank you for your help. Sarajevo, Bosnia
-
Hi everybody. I load an assembly into another AppDomain, not a default one. As there is no way to unload the assembly, I need to unload the domain. This is where the app hangs. The problem is this assembly has references to one dll, currently not performing any work. I tried this: 1. Setting the assembly to null, 2. Implementing a ClassFactory and returning an interface of the object, then removing it, 3. Making assembly to implement the IDisposable interface. None of this works. All examples on the Net just shows how to create AppDomains, load assemblies and then unload the AppDomain. None of those show what happens if the assembly has referenced assemblies. Thank you for your help. Sarajevo, Bosnia
I believe you also must unload the referenced assemblies. Is there a reason you cannot do this?
Picture a huge catholic cathedral. In it there's many people, including a gregorian monk choir. You know, those who sing beautifully. Then they start singing, in latin, as they always do: "Ad hominem..." -Jörgen Sigvardsson
-
I believe you also must unload the referenced assemblies. Is there a reason you cannot do this?
Picture a huge catholic cathedral. In it there's many people, including a gregorian monk choir. You know, those who sing beautifully. Then they start singing, in latin, as they always do: "Ad hominem..." -Jörgen Sigvardsson
There is no way to unload the assembly at all. You can do this under Framework 2.0 but not under 1.1. The only way is to unload the AppDomain, and it is clearly said that way at the Microsoft site. The main assembly does not "realize" the AppDomain it is in is getting unloaded, so that it can do a clean up or something. Also important to note is that no unmanaged code is accessed anywhere, so this is not the reason. Thanks. Sarajevo, Bosnia
-
There is no way to unload the assembly at all. You can do this under Framework 2.0 but not under 1.1. The only way is to unload the AppDomain, and it is clearly said that way at the Microsoft site. The main assembly does not "realize" the AppDomain it is in is getting unloaded, so that it can do a clean up or something. Also important to note is that no unmanaged code is accessed anywhere, so this is not the reason. Thanks. Sarajevo, Bosnia
Right, I was just saying that you could load the referenced assembly in the same appdomain and then upload that appdomain.
Picture a huge catholic cathedral. In it there's many people, including a gregorian monk choir. You know, those who sing beautifully. Then they start singing, in latin, as they always do: "Ad hominem..." -Jörgen Sigvardsson
-
Right, I was just saying that you could load the referenced assembly in the same appdomain and then upload that appdomain.
Picture a huge catholic cathedral. In it there's many people, including a gregorian monk choir. You know, those who sing beautifully. Then they start singing, in latin, as they always do: "Ad hominem..." -Jörgen Sigvardsson
David Stone wrote: then upload that appdomain ya riiiiiight :laugh: xacc-ide 0.0.99-preview2 (now with integrated debugger)
-
David Stone wrote: then upload that appdomain ya riiiiiight :laugh: xacc-ide 0.0.99-preview2 (now with integrated debugger)
Okay, he probably meant AppDomain.Unload, but this is not working. I will try today to impement a WaitHandle to set a ManualResetEvent so that the assembly stop processing if the service singals that it should stop, so hopefully the unload will work. The funny thing is that this area is much improvedin Framework 2.0, you can do anything with unloading single assemblies from the AppDomain. Thanks. Sarajevo, Bosnia
-
Hi everybody. I load an assembly into another AppDomain, not a default one. As there is no way to unload the assembly, I need to unload the domain. This is where the app hangs. The problem is this assembly has references to one dll, currently not performing any work. I tried this: 1. Setting the assembly to null, 2. Implementing a ClassFactory and returning an interface of the object, then removing it, 3. Making assembly to implement the IDisposable interface. None of this works. All examples on the Net just shows how to create AppDomains, load assemblies and then unload the AppDomain. None of those show what happens if the assembly has referenced assemblies. Thank you for your help. Sarajevo, Bosnia
I've tried loading assemblies that in turn refer to other assemblies in an AppDomain and it worked.
mirano wrote:
This is where the app hangs.
Have you implemented any finalizers in your code? It's very much possible that one of the finalizers hung and that resulted in the hang? Regards Senthil _____________________________ My Blog | My Articles | WinMacro