I have the following setup
App -> native.dll -> native/clr.dll -> .net.dll
App loads/unloads native.dll before for every call.
native.dll in turn uses code like this to load
Assembly^ AssemblyLoader::Load(Object^ sender, ResolveEventArgs^ args) => Assembly::LoadFrom(AssemblyPathHolder::Value); ... _resolveEventHandler = gcnew ResolveEventHandler(this, &AssemblyLoader::Load); AppDomain::CurrentDomain->AssemblyResolve += _resolveEventHandler; ... AppDomain::CurrentDomain->AssemblyResolve -= _resolveEventHandler;
Appeared that removing the handler doesn’t let
.net.dll to unload because CLR keeps DLLs loaded until the app domain hasn’t been unloaded.
.net.dll stay in memory forever. But I need to
.net.dlland I can’t replace it with debug version to start debugging.
- Remove them after App has finished.
What can I do about it?
Source: Windows Questions C++