Visual Studio Debugging: Breakpoints not reached

Posted: October 2, 2012 in IDE, Windows
Tags: , ,

To debug in .Net is quite easy, just set the break points and attach Visual Studio to w3wp.exe (or aspnet_wp.exe in xp). But you may find the debugger never hit the break points, sometimes.

There could be a few reasons.

1. Your solution is built as Release, instead of Debug.

2. Debug is disabled in your web.config. The configuration is under compilation section, just set the debug to true.

3. The debugger is trying to debug the wrong type of code. I was debugging C# code, I attached to w3wp.exe and I used to let debugger to determine the code type, but it doesn’t work sometimes. The below screen was shown under the Solution window.

You need set the code type to Managed manually.

Most of times, the above three are caused by oversight, but sometimes it takes hours to figure it out. Hope this can help someone, 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s