Do Not Throw A Nullreferenceexception When Validing This In An Extension Method

One pattern I’ve started running into is developers explicitly throwing a NullReferenceException when validating the ‘this’ parameter of an extension method.

Avoiding Automation Bugs When Implementing IOleCommandTarget

Shortly after Visual Studio 2010 shipped I wanted to experiment with the new VSIX format for traditional Package extensions. I fired up my copy of Visual Studio, ran through the new package project wizard. But instead of a nice shiny new project I was greeted with a project load error dialog. After a bit of investigation I found the generated project file was corrupt. The majority of the template code was not replaced.

Newlines In The Immediate Window

A question came up recently on stack overflow concerning the display of newlines in the immediate window.’? The author noted that any .ToString method which contained a newline printed incorrectly when evaluated in the immediate window. For example given the following ToString implementation

My Next Adventure

After 4+ years on the languages team it’s time for me to move onto the next adventure. I joined the languages team in the winter of 2006. Since then I’ve worked on pretty much every part of the language experience including the compiler, debugger and IDE, shipped 2 releases of Visual Studio, several independent projects and fixed the occasional bug.

Using Lambdas To Create Generic Factories

One item I find to be limiting in C# is the new generic constraint. The syntax construct specifies that the type backing a given generic parameter contains a parameter less constructor.’? It allows methods to create instances of generic parameters in a type safe manner.