Debugging Win32 app using .NET libraries, VS2008 works, 2010 doesn't, any idea where I should start looking?
We have a native program, written in Delphi 2007, a Win32 .EXE file.
This program hosts the .NET runtime, and loads a bunch of assemblies we've written.
So if I copy that executable into the bin\Debug directory, configure the .NET project with which executable to start, I could debug this in 2008. Basically, breakpoints in .NET assemblies would show up with a hollow circle until the point where the program loaded up the .NET runtime and loaded my assemblies, at which time they became functional breakpoints and they would break at the right point, etc.
Basically, debugging worked if I used Visual Studio 2008 for this.
Now I tried upgrading the projects with Visual Studio 2010, and it doesn't. The breakpoints are still showing as hollow circles, but now an additional yellow warning sign is shown telling me that no symbols have been loaded.
Yet, changes to the code actually execute. If I add a messagebox to a particular method, the message will be shown when running the program, but breakpoints on o开发者_StackOverflowr near that line doesn't stop the debugger.
I've gone through the debugging options dialogs and can find no differences between 2008 and 2010. There's a couple of new checkboxes in the 2010 dialogs, so I've tried with all combinations of those, no dice, still no functioning breakpoints.
Has anyone else done anything like this and know what I have to tweak?
Check these settings:
Workaround: Try you attach to the application manually and specify to debug Managed Code also:
Step 1
Step 2
It could be, depeding on what runtime you are using, that VS2010 is kicking off the exe and the .net part in seperate processes. Since studio is attaching to the exe process, if the .net component is indeed running in a seperate process, then the things you are seeing would apply. Try manually attaching to the .net process to see if that helps.
Here is a similar question, but nUnit is the exe rather than your dephi app. I suspect you problem is somewhat related.
UPDATE: Take a look at this solution. You may need to add a config to tell studio to use the non- 4.0 runtime like this:
<?xml version="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
Here is a post describing the problem, and a more official post on the MSDN Blogs.
精彩评论