Please stick with me, this is a strange one.
Since upgrading from VS2008 to VS2010, some guys at work (and myself) found that we could no longer debug into our code. None of our breakpoints were being hit.
Without giving too much away, my work consists of writing .NET apps which run on top of a custom platform application we’ve developed. These apps are compiled to .NET 2.0. Debugging typically involves setting our platform app's exe as the startup program to debug into, and launching from there.
Interestingly, none of our developers working on Vista/Windows 7 machines had any issue – just the Windows 2003/XP crowd.
Something about the combination of Visual Studio 2010, .NET 2.0, and Windows XP meant that we could no longer debug into our applications.
I have absolutely no idea why this issue should arise only in Windows 2003 and XP machines. Can anyone shed any light?
I've managed to find a workaround, thanks to this post. The issue seems to be that when debugging into code which is invoked from a native exe, Visual Studio will assume you’re debugging in .NET 4.0. Subsequently all your .NET 2.0 code will run, but the debugger won’t hit any of your breakpoints.
The fix is to give the debugger a helpful hint, in the form of a .exe.config file in the directory you’re launching your startup exe from. Something along the lines of:
<?xml version="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v2.0.50727" />
</startup>
</configuration>
This works as a fix, but doesn't actually answer why this happened in the first place.
Try deleting the user option files for the projects and solution. Delete all obj and bin folders. More importantly, clear out the temporary files.
Using Visual Studio 2008 temporary files, for example:
I was debugging the Coding4Fun's Searching the Desktop VB.NET code at http://blogs.msdn.com/b/coding4fun/archive/2007/01/05/1417884.aspx. I noticed that on some source code files, the Navigation Bar was missing. Moreover, on the Editor's context menu the "Go To Definition" menu item was disabled. I closed Visual Studio, deleted the solution .suo file and all project .user files, re-opened the solution, and everything was back to normal.
I struggled with this problem and could not use the config file with Outlook. Outlook complained when it tried to launch. So, I did find another work-around. I change the target platform to 4.0 instead of 2.0. This brings back my debug mode. I change it back before publishing and then do additional testing on another 2.0 machine without debug.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With