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