Dead ASP.NET Debugger? It's All About Location!

I came across a weird issue working on some code this weekend. Everything had been moving along fine in my project but then I encountered a problem.

Of course, being a big fan of the debugger, I immediately placed a break point in the suspect line of code, pressed F5 and then... nothing.

No debugger, no breakpoint. Just generated markup rendered onto the the page...

Now this was a head scratcher. Could debug in other applications like Console applications. Even other websites were debugging fine. I dug through the project checking for anything that could be the culprit - but everything was turned on as it should be.

As it turns out, the location tag was the source of my grief.

The location tag is a very interesting element for your web.config files. It allows you to set special configurations for different sections of the same site or even inheriting web applications.

It doesn't appear to be a tag that you use very often so it is possible that you've never seen it before. In my case I was using the inheritInChildApplications option so I could install other web applications into the same directory as the main site.

I've tried this in Visual Studio 2008 and 2010 with the same results. So if you happen to run into the problem then you might check that first.

So how do you fix this problem so that you can enable debugging and use the location tag...

... well... How?

Yeah, I haven't figured out how you can fix this problem. As far as I can tell you can't do much about it. My web.config was already applying the location to the entire site (like a wild card) so if that didn't do the trick then I'm not entirely sure what will.

I'll have to mess around with it might be possible to fix this using web.config transforms when you publish your site... I'll test it and post if it worked or not later.

July 11, 2010

Dead ASP.NET Debugger? It's All About Location!

Post titled "Dead ASP.NET Debugger? It's All About Location!"