I recently gave a talk at the Microsoft Architect Insight Conference held in London recently. I gave a demo of the visualization and modeling tools in Visual Studio 2010, and received some very positive feedback about the tools from a number of those attending.

In the final part of my demo, I showed how to create an extension of the UML tools, but couldn’t work out why the extension seemed not to work when I installed it in Visual Studio. On the train home, I figured out the reason. The extension was designed to work with the Use Case UML designer, but I forgot to change the attribute on the class defining the extension to reference the Use Case Designer. As far as it was concerned, this was an extension registered to be used with the Class Designer. That is, instead of:

// Custom gesture (drag-drop and/or double-click) extension
// See
http://msdn.microsoft.com/en-us/library/ee534033(VS.100).aspx
[Export(typeof(IGestureExtension))]
[ClassDesignerExtension] // TODO: Add any other diagram-types on which you want your gesture to work
class GestureExtension : IGestureExtension
{

}

I should have had:

// Custom gesture (drag-drop and/or double-click) extension
// See
http://msdn.microsoft.com/en-us/library/ee534033(VS.100).aspx
[Export(typeof(IGestureExtension))]
[UseCaseDesignerExtension] // TODO: Add any other diagram-types on which you want your gesture to work
class GestureExtension : IGestureExtension
{

}

I changed this on the train and it worked immediately. I won’t make that mistake again!