I have a big legacy C++/MFC application which is being extended via a C# class library. There's a C++/CLI wrapper for this so the legacy program doesn't need CLR support turned on, but with that it is impossible to debug through the managed code while running the native project.
Turning on CLR support causes a System.IO.FileLoadException to be thrown immediately on running the program. However, with that one setting turned off, the program runs as expected, I just can't step through the DLL code in the Visual Studio debugger.
I know it doesn't have anything to do with a problem in the code. I have this working perfectly in Visual Studio 2017, but I need to get this working in VS 2012 for various reasons.
Edit to add exception text:
An unhandled exception of type 'System.IO.FileLoadException' occurred in
Unknown Module.
Additional information: Could not load file or assembly '<Project>,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Could not find or load a type. (Exception from HRESULT: 0x80131522)
Compile the DLL/executable using /GF
switch.
Go the Project Properties and
C/C++->Code Generation->Enable String Pooling - Set to “Yes”
Copied from MSDN discussion forum
User contributions licensed under CC BY-SA 3.0