We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Re: Invalid Master Shape reference


how did you solve the problem?
we encounter a similar behavior. once we add a shape from type SHAPE to our page, it automatically adds this “MasterShape” attribute, but this creates a warning during loading. When we set it to null (shape.setMasterShape(null);), the master is also set to null which is causing other problems. When we remove the MasterShape attribute from the xml all is working fine.

we add our shape like this:

final Shape newShape = new Shape();
drawingPage.addShape( newShape, ( (AsposeMaster) master ).getMaster().getName());
newShape.setName( componentName );

//do some adaptions
final AsposeShape shape = new AsposeShape(newShape); //wrapper class
shape.setLocation(pinX, pinY);
shape.setAngle( transformation[0] * Math.PI / 180 * - 1 );
shape.setFlip( flipX, flipY );

//adapt IDs
incrementIDs( newShape );

Berst regards


Hi Gerald,

Thank you for contacting and using Aspose.Diagram APIs. Please provide us some other details like how you are placing shapes on the Visio diagram page. Their masters are already available in the source Visio drawing or using a separate stencil file. Please provide us the source diagram, stencil file and complete source code. It’ll help us to be more specific in reference of reproducing the problem on our side and perfection in the defect fixing. We’ll investigate it and reply you accordingly.

This is a .Net issue, not a Java issue.

I was not able to get permission to provide sample code for them to fix this issue or my other issues. I ended up relying on using some client side macros to finish the drawing after the server side populated the data into the diagram. So the shapes that caused this issue were not being created any more on the server side. I did however try to fix it server side by generating the XML, then using some code to remove the extra Master tags before emitting the file.

The master shapes that have the issue are defined in the visio file loaded and have a single shape as the only shape in the master.

Andy Bay

Yes, i can commit, that it happens for masters with a single shape…
so its also a Java issue here. i think it leads to the same core… we also do a postprocessing and remove this MasterShape attribute, but it would be nice that it is supported by this api which is quite cost intensive.

Hi Imran,

we are loading stencils from separate files and map them by their name (Map<String, Master>). Then we load the template and add all the masters to the template with new unique IDs to have no duplicates.

after that we loop through our graph framework and export all the occuring forms like in the sample of the original post. We are using the method Page#addShape(Shape shape, String masterName)

As mentioned from Andrew, it happens to Shapes where the master only has one shape. in this case we dont need the Attribute “MasterShape”.

sure its nice to have all sources, but our sources are quite complex (2GB) and please respect that company sources are mostly confidental.

I will need to ask for a shape we can give to you and try to snip out a sample of code for it.

Best regards


Hi Gerald,

Thank you for the details. We managed to replicate the warning message said. We have this problem for both .NET and Java platforms. These issues are logged as follows:

DIAGRAMNET-50540 - Warning message when opening resultant VDX diagram
DIAGRAMJAVA-50215 - Warning message when opening resultant VDX diagram

Your post has also been linked to this issue. We’ll keep you informed regarding any available updates. We’re sorry for the inconvenience caused.

Note: we reproduced this problem by using our own sample diagram and stencil file. It is recommended to post source files for confirmation purposes.

Hi Gerald,

Thank you for being patient. We have a good news for you that the issue ids DIAGRAMNET-50540 and DIAGRAMJAVA-50215 have now been resolved. If there is no issue in the QA phase, then their fixes will be included in the next version of Aspose.Diagram for .NET/Java 5.6.0. We’ll inform you via this forum thread as soon as the new release is published.

The issues you have found earlier (filed as DIAGRAMNET-50540) have been fixed in Aspose.Diagram for .NET 5.6.0.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

The issues you have found earlier (filed as DIAGRAMJAVA-50215) have been fixed in Aspose.Diagram for Java 5.6.0.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan