1) a mixed managed/native C++ assembly is loaded by a .NET application, and
2) that assembly contains a managed C++ method that (during regular program execution) calls a native C++ method, and
3) that native C++ method contains a static variable, and
4) that static variable is of a native type with a destructor,
then the following exception occurs during process exit:
Unhandled exception at 0x75df42eb (kernel32.dll) in App.exe: 0xC0020001: The string binding is invalid.
This occurs because a managed destructor for the static variable has been registered with the atexit function. This registered function is called when DllMain is called with DLL_PROCESS_DETACH, which happens when the C++ assembly is unloaded at exit. However, the CLR has already been shut down, so the attempt to transition back to managed code fails, and exception 0xc0020001 is thrown. The compiler should register a native destructor with atexit, not a managed destructor.