DevTeach 2009 Vancouver

The schedule for DevTeach 2009 Vancouver has been announced (  There’s lots of great software development sessions from some of the leaders in our industry. If you’re planning on improving yourself, this is the conference to go to.  Not only can you attend excellent sessions; but you can hob-knob with the presenters and pick their brains. If you have a friend or co-worker who’s interested, there’s a limited-time two-for-one offer for an even better price:

Unable To Step Into .NET Source

I began getting a problem a while ago that I was unable to step into the .NET source in Visual Studio 2008.  It happened suddenly, and I noticed it shortly after installing SP1.  Given my observation it appears to be due to upgrading the SP1; but I couldn’t find anyone else not having the same problem.  I had another computer where it worked, so I basically put it aside. Today I had a chance to have a closer look.  I had configured 2008 (RTM, not SP1) to get the .NET source based on Shawn Burke’s blog and had not encountered … Continue reading Unable To Step Into .NET Source

Bugs Are Features Too

It’s surprising how many bugs on Microsoft Connect are closed as Won’t Fix with a reason that fixing the bug would be a breaking change. The logic is that someone could be dependant on the errant behaviour and thus changing it would cause their code to break. Here’s some samples. TypeConverter.IsValid(Object).  This method is described as “Returns whether the given value is valid for this type”.  But, this results in true:             TypeConverter typeConverter = TypeDescriptor.GetConverter(typeof(int));             Console.WriteLine(typeConverter.IsValid(“ten”)); Based on the description of IsValid that this is what was intended:              Debug.Assert(false == typeConverter.IsValid(“ten”), … Continue reading Bugs Are Features Too

Becoming a Visual Studio Jedi Part 1

Becoming a Visual Studio 2008 (and often Visual Studio 2005) Jedi In much the same grain as James’ Resharper Jedi posts, I’m beginning a series of posts on becoming a Visual Studio Jedi.  It involves getting the most out of Visual Studio off-the-shelf, doing things as quickly as possible and with as little friction as possible.  I think it’s useful for all users; but especially useful for those who are in situations where they can’t install refactoring tools like Refactor Pro! or Resharper. First, familiarize yourself with Sara’s Visual Studio Tips blog; then subscribe to her blog. I’ll attempt to … Continue reading Becoming a Visual Studio Jedi Part 1

Drag and drop of control selections onto forms designer toolbox

A while back I blogged about the ability we have in Visual Studio to select text in a text editor and drag it onto the toolbox.  Once on the toolbox you could drag those items back into the text editor to effectively “paste” frequently needed snippets of code into other text files. Imagine my surprise when we didn’t have this ability in the forms designer.  When writing code, it’s a bit specious to want to have multiple copies of hard-coded snippets of code (DRY should come to mind).  But, for forms, the only alternative is to create user controls to … Continue reading Drag and drop of control selections onto forms designer toolbox

Working with Resharper’s External Annotation XML Files

Resharper 4.0 has external annotation XML files that you can create to give Resharper more information about your code.  For example, you can tell Resharper that a particular method does not accept a null argument.  For example, the following method does not accept a null argument: using System;   namespace Utility {     public static class Text     {         public static int GetLength(String text)         {             if (text == null) throw new ArgumentNullException(“text”);             return text.Length;         }     } } An external annotation file can be created to inform Resharper … Continue reading Working with Resharper’s External Annotation XML Files

Drag-copying in Visual Studio Solution Explorer.

NOTE: I’ve tried this in Visual Studio 2008 (VS2k8), I’m assuming the same thing happens in Visual Studio 2005 (VS2k5). In the process of refactoring, it’s *very* common for me to rename a type.  This is most easily done by renaming the file in the Solution Explorer (SE)–which renames the file, the type, and and any uses of the type in the entire solution. Occasionally, I need to create a new type based on another.  Copying an abstract type in order to implement the abstract type is often handy–I just fill in the abstract members (and delete “abstract”) in the … Continue reading Drag-copying in Visual Studio Solution Explorer.

Nested Types

Recently Michael Features blogged about nested types.  The title was almost “nested types considered harmful”. I don’t agree.  I don’t agree that they’re any more harmful than any other C# construct (except goto…).  Nested types are like anything else in our tool-belt: they have a time and place and can be abused. But, when to use them?  Well, for the most part I agree with Michael, you should avoid them. But, there are times when they’re simply the best solution in a given set of circumstances. Let’s look at asynchronous programming model (APM) in .NET.         // Paraphrased from … Continue reading Nested Types

Trace to output window without adding code.

Want to trace some run-time data to the output window while debugging without changing and recompiling your code?  Use Tracepoints:

No "Add Method Stub" When Passing or Assigning Delegates

I finally noticed the other day the “Add method stub” SmartTag wasn’t appearing for a new method name I type in.  I decided I’d have a closer look… When you’re practicing Test-Driven Development (TDD) you want to write a test for methods before you write the methods.  This means you write a test method that calls several other methods that don’t exist yet.  The Visual Studio IDE, in an effort to promote TDD, recognizes this and when you have your caret over a call to one of these methods a SmartTag shows up and you can select Generate method stub … Continue reading No "Add Method Stub" When Passing or Assigning Delegates