-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Description
Im trying to migrate a big native application which uses mixed-mode libraries. After the migration to .net6 im running into an issue that when closing the process the C++ global objects are not properly destroyed.
The main .exe is an older MFC native executable which loads and uses mixed-mode dlls.
In .net framework when process if ending it normally calls CorExitProcess which causes the app-domain to unload and all the mixed-mode modules get uninitialized which includes destroying any static/global objects in C++ mixed-mode library.
In .net6 i see that the module subscribes to the domain unload but the event never occurs.
Is this intentional behaviour for .net6 ? Is there some way I can unload the domain from native code when the process is finishing to simulate the old behaviour ?