March 03, 2011

Debugging ASP.NET Application events

Lately, I've been working on some ASP.NET sites. I wanted to debug items that get created during the Application.* events (in this case, OnStart specifically).

Sadly, if you just put a breakpoint in the code and hit F5, you get the maddening experience of the debugger not stopping on your breakpoint.

Thankfully, through the magic of System.Diagnostics.Debugger.Break(), you can force a window to popup, asking which version of Visual Studio you want to attach as a debugger!

Happy debugging!

February 18, 2011

HOWTO: Remove linebreaks in VS.NET

This little trick helped me while working on a JsUnit test…thought I’d pass it on.

I was taking a long chunk of HTML in a unit test, pulled it into, formatted it so it was human readable, and then needed to ‘unformat’ it. Instead of manually deleting the new line characters, I did this:

1. Control-H to open the find & replace dialog

2. Put in the regular expression \n (newline)

3. Selected the ‘Use’ checkbox and Regular expressions from the dropdown

4. Clicked replace all

5. Postponed carpel tunnel surgery for a bit longer… J



adapted from: