Thursday, June 9, 2011

VS Tip Incremental Search

Most of us use Ctrl + F or Ctrl + Shift + F to find code. However you can also use a Ctrl + I which is the Incremental Search. The nice thing about this is you don’t have to wait for the dialog. Just hit Ctrl + i , and as you type it will match the string being typed.

Visual Studio Break When Exception Thrown

Maybe some of you know this, maybe some of you don’t. But I just learned about it. Apparently I’m a old man programmer because I normally just look at the code and try to solve it without debugging the application, or I write it out somewhere.

I’ve been trying to track down this wiggly bug in my factory pattern code, but it was a slippery bugger. I finally asked somebody for some help and they suggested that instead of all my try/catch’s I use the Break when Exception is thrown. By default Visual Studio only breaks when the exception is unhandled in the user code. For me this was some distance from where the exception was thrown.

So if you want to throw the error in the code where the error occurs and not wait for it to catch. You can select the Debug menu, then Exceptions (or use Ctrl-Alt-E) which will bring up this dialog box:

image

Check the box under Thrown for the “Common Language Runtime Exceptions and viola. You are set.

Replacing NaN in XSLT 1.0

image