Visual Studio 2012.... What a pain!
by Vince Gee · 11/10/2012 (9:11 pm) · 4 comments
Wow,
I've just spent over 30 hours trying to figure out why DNT would not work with Visual Studio 2012. I must have over 30 hours logged chasing this down. I have rewritten core code God knows how many times. It just seemed that it would crash on nested PinInvokes.
So, after around the 30th hour, and the project running fine in Visual Studio 2010, I decided to take a different approach. This time, I compiled the debug build and ran it from the folder.
Guess What?
Well, it worked just fine! So I attached my debugger to it and I was able to debug the C# code just fine, but I wasn't able to debug the c++.
After doing a bit of research on the Internet it appears to be an issue with the "Managed Debugging Assistants" or MDA. Because I'm doing nested PInvokes, the MDA thinks the stack is corrupted, when in reality it isn't. The only solution I found was to disable the MDA, but I couldn't get any of the examples to work.
So, please, if anyone knows how to disable the MDA's inside of Visual Studio 2012 post me directions, because at this point I'm beyond frustration.
I've already tried adding the registry keys, etc.
At least I know DNT does run when compiled with Visual Studio 2012, now to just figure out why the debugging isn't working.
Vince
I've just spent over 30 hours trying to figure out why DNT would not work with Visual Studio 2012. I must have over 30 hours logged chasing this down. I have rewritten core code God knows how many times. It just seemed that it would crash on nested PinInvokes.
So, after around the 30th hour, and the project running fine in Visual Studio 2010, I decided to take a different approach. This time, I compiled the debug build and ran it from the folder.
Guess What?
Well, it worked just fine! So I attached my debugger to it and I was able to debug the C# code just fine, but I wasn't able to debug the c++.
After doing a bit of research on the Internet it appears to be an issue with the "Managed Debugging Assistants" or MDA. Because I'm doing nested PInvokes, the MDA thinks the stack is corrupted, when in reality it isn't. The only solution I found was to disable the MDA, but I couldn't get any of the examples to work.
So, please, if anyone knows how to disable the MDA's inside of Visual Studio 2012 post me directions, because at this point I'm beyond frustration.
I've already tried adding the registry keys, etc.
At least I know DNT does run when compiled with Visual Studio 2012, now to just figure out why the debugging isn't working.
Vince
About the author
www.winterleafentertainment.com
#2
11/11/2012 (9:11 am)
I'm wondering if the debug build might be a hint that a compiler optimization is malfunctioning (producing code that the MDA thinks is a bug). Maybe try a release build but modify the settings so that optimizations aren't done. If that still misbehaves, at least you've eliminated one possibility.
#3
Dunno, gonna have to research this more.
Vince
11/12/2012 (5:45 am)
Well it is something on the c# side, the debugger watches the stacks, and when they are modified in a fashion that isn't expected they throw errors. From the traces I did, it appears the error occurs on looped calls from C# to C++ to C# to C++ and the second round is what throws the error since the first round variables might be modified so it things the stack is invalid even though it is valid.Dunno, gonna have to research this more.
Vince
#4
11/14/2012 (4:23 am)
I'm surprised nobody else has chimed in on this, to be honest. Surely someone else has encountered this, if not come up with a solution? 
Torque Owner David Robert Pemberton
www.deadlyassets.com
I think the clue is in its name... 'MICROSOFT' Visual Studio 2012...
I only use 2010 atm. Am not ready to try get code that's working in 2010 to work with 2012 sorry :-(