Debugging Application_Start()

Today, I was trying to hit a breakpoint within global.asax in a .NET 4.6 MVC project. Typically, I would be using Visual Studio, open up the code and place my breakpoint and hit F5 (or I much prefer to use AttachToAny extension and attach to the w3c process).  After I do this I run and VS.NET will stop on my breakpoint.  Well today things were acting more stubborn.  The application would not break, even after recycling IIS.

The solution, was to place my breakpoint like normal in the code. Start the application either with F5 (run with debug) or attach to the process.  Then make a modification (like adding a space) within the global.asax file then hit another page.

Presto.  This small change to the asax file (not the code behind global.asax.cs) cause the application to be rebuilt from scratch and it hit the breakpoint to allow me to step through the code of interest.




comments powered by Disqus


Recent Tweets

Maybe resolved itself, after resetting emulator and couple restarts - will let you know
@MillerMark A few weeks ago you tweeted that something huge/incredible was coming....what is/was it? (I am hoping s……
Oddly, it won't hit breakpoints in XF .net standard 2 project now either
@JamesMontemagno Updated to 15.7 preview 2 Visual Studio - now having lots of odd thread issues when starting debug……