Installieren und betreiben Sie Ihre eigene Configuration Manager-Umgebung! 3-tägige Intensivschulung! Mehr hier.

Erweiterung von Shapes in VMPD nicht funktionsfähig–MP Authoring

15. February 2014 in Allgemein

Zum ersten Mal in der Geschichte der SystemCenterInternals Community möchte ich einen Beitrag in englisch verfassen. Der Produktgruppe von Microsoft soll es ermöglicht werden, an der Stelle nochmals nachzuarbeiten. Grundlage dieses Artikels ist der Blogartikel von Brian Wren zum Erweitern des VMPD.

After click on “Generate Management Pack” button


will be executed code in Generate_Click method:


Here is code part:


Most interesting is this line:

Diagram diagram = new DrawingParser(this._app.Application.ActivePage).GetDiagram();

DrawingParser.GetDiagram() method is used for retrieving Diagram object, which contains all shapes(both custom and predefined) and connections data. It calls DrawingParser.Process() method to iterate through all elements on the surface and create instances of appropriate shapes.

Code part of DrawingParser.Process() method:


The most interesting part of this listing is checking of element’s IsExtention property condition. IsExtention property looks like on picture below:


As you can see from picture, it checks for User.IsExtention property value. If it is defined and has “true” value – this element will be considered as extension(Custom shape element). This this property should be defined by user inside User-defined Cells section in ShapeSheet. This point wasn’t described in article.

After determining that object is custom shape (IsExtention is defined and IsExtention == “true”) parser tried to determine which object type should be build – Model or Monitor. This part of work is under responsibility of DrawingParser.ExtensionPresenter property, which is of ExtensionPresenter type. Here is part of code in property ExtensionPresenter, which will call after outer code will try to get current property value:


Here the most important part of code – is creation of new instance of ExtensionPresenter class, which has two parameters – long assembly name of assembly with custom shape and custom shape object class name. Both of these properties should be defined in User-defined cells section in ShapeSheet in Visio. There is also no description about these actions in article.

Next step is calling ExtensionPresenter.Load() method:


Here VMPD trying to load assembly with custom shape and create a custom shape object using assembly and type name provided in custom Visio shape User-defined data section.

The most important part of this code is cast of created object instance to ExtendedShape type. In case if it is not derived from ExtendedShape type – exception will be raised.

Let’s take a look into custom shape type hierarchy from article:


As you can see, there is no ExtendedShape type in FolderMonitor inheritance chain, which contains only classes from MPDesigner.Core.dll library, which isn’t included in default VMPD installation package. It means, that even if user will correctly add IsExtention, Assambly and Class properties into shape’s User-defined cells section and provide correct values for them – anyway, VMPD will not be able to generate management pack with such shape – it will never pass following condition, and exception will be thrown during management pack generation:


Schönes Wochenende,


Leave a reply

You must be logged in to post a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.