Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio breakpoints not being hit

I'm working with an ASP.NET MVC project that seems to be having some issues when attaching to the IIS process (w3wp.exe). I'm running the solution and IIS 8.5 on my own local machine so I wouldn't think that this has anything to do with our network. What's strange to me is that I'm able to hit the breakpoints on any other solution I debug locally.

The issue I'm having exactly is that the breakpoints turn to red, hollow circles and never get hit. Usually the fix for this is a Clean/Rebuild of the solution but this hasn't worked. I've confirmed the code is being updated by adding "throw new Exception" to a page and ensuring it shows the exception. Again, this problem is only happening with this one solution. Any other solution I run the debugger with works fine. I've also tried restarting the app pool, the website, IIS, and also my computer.

A few of the articles I read mentioned that anti-virus programs can block a remote debugger from accessing the process. However, the entire setup is contained on my local machine so it doesn't sound like that would be the issue. It does concern me a bit though because we recently hired a new IT guy that's been making a lot of changes to everyone's machine.

One other point to add that's unique about this web application is the binding in IIS. The binding is "*" in order to leverage some custom functionality related to subdomains.

In the meantime, I'll continue to look for a solution but if anybody has any ideas what may be causing this one solution to not debug properly I'd really appreciate it.

EDIT: Found a solution that suggested deleting the ASP.NET temporary files. No luck.

like image 204
My Stack Overfloweth Avatar asked Feb 05 '14 15:02

My Stack Overfloweth


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 fix breakpoint in Visual Studio?

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.

How do you fix the breakpoint will not currently be hit C++?

solution -> Properties -> Startup Project -> startup projects -> Start action , Debug/General settings -> uncheck Just My Code , quit VC++, reload, restart PC.


2 Answers

Solved. Ended up being an incorrect configuration selected in the debug menu. I had mistakenly switched it to a release configuration that could not load the symbols for the document. Switched it to a debug configuration and the breakpoints hit just fine now.

To add on to what Abacus mentioned below, it could also be a web.config transform that is messing with your build. In our case, we have Release configurations that remove the debug attribute from the web.config's compilation section. Below is a screenshot of an example and Visual Studio's dropdown list of build configurations.

NOTE: Also make sure your Platform is correct along with the configuration. In my case, Dev.Debug|Mixed Platforms does not correctly build the solution but Dev.Debug|Any CPU will.

Build Configuration List

like image 97
My Stack Overfloweth Avatar answered Oct 29 '22 02:10

My Stack Overfloweth


Enable 'Managed Compatibility Mode'. Go to Tools->Options->Debugging and enable Managed Compatibility Mode.

like image 23
Javier Rodriguez Avatar answered Oct 29 '22 01:10

Javier Rodriguez