Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When debugging ASP.NET MVC app, breakpoints are not hit

When trying to debug a ASP.NET MVC app, the breakpoints in my controllers arent getting hit. When entering debug mode they just show an empty red circle with a warning triangle instead of the normal full circle. This is strange because debugging was working fine until now, and no configuration changes have been made in my environment for a while.

I have seen this question and had a look at my modules view and the correct ones aren't being loaded, however I'm not sure how to remedy this. Also all the relevant pdb files are in the bin folder of the site.

Any suggestions on how to fix this?

Cheers!

EDIT: The app is running as a local site on IIS7 and I'm debugging with VS 2008

like image 1000
Darko Z Avatar asked Apr 09 '09 03:04

Darko Z


People also ask

Why are my breakpoints not being hit?

If a source file has changed and the source no longer matches the code you're debugging, the debugger won't set breakpoints in the code by default. Normally, this problem happens when a source file is changed, but the source code wasn't rebuilt. To fix this issue, rebuild the project.

How do I hit a breakpoint in Visual Studio?

Set breakpoints in source code To set a breakpoint in source code, click in the far left margin next to a line of code. You can also select the line and press F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert breakpoint. The breakpoint appears as a red dot in the left margin.

Why does Visual Studio not stop at breakpoint?

This problem occurs because ASP.NET debugging isn't enabled on the application.


2 Answers

Ok so after 4 hours wasted, I find that setting my web project as the startup project solves the issue! This surely must be a bug...

I hope I save someone out there half a day :)

like image 67
Darko Z Avatar answered Sep 17 '22 08:09

Darko Z


Few more possibilities:

  • If you have a client and server in your solution (lets say a WPF and WCF app) you should make sure you select 'multiple startup projects'. [this one is similar to your accepted answer, but useful if you need a client running too]

  • Release mode is selected for the project. When doing a fresh get (as I discovered today) on a new machine VS seems to like to switch to 'Release' configuration profile.

like image 36
Simon_Weaver Avatar answered Sep 21 '22 08:09

Simon_Weaver