Upgrading to version 21.3 caused regression

When trying to create a new Diagram object from a existing file that contains diagram, this exception is thrown System.InvalidOperationException: ‘Cannot find resource ‘Aspose.Diagram.PresetTheme0.xml’.’

I’ve create a project where you can reproduce the error.

TestAspose.zip (6.2 MB)

@llesage

While creating a new Diagram, you do not need to initialize it with a stencil file. The stencil file would be used for adding master and then shapes in it. For example, please check below sample code snippet:

Aspose.Diagram.Diagram diagram = new Aspose.Diagram.Diagram();
Aspose.Diagram.Page page = diagram.Pages[0];

string masterName = "Bridge";
diagram.AddMaster(dataDir + "NetworkPeripherals.vssx", masterName);

For more information, please check “Create, Update, Layout and Auto-Fit Shapes” article(s) in the API documentation.

Creating the Diagram is fine, it the shape retrieving that is not working. Open the projet and run it, you will se right away what is the problem.

When trying to fetch a shape from a stencil file, either by using the .AddMaster() function or by the constructor, it throw the exception.

@llesage

Please try to use the following correct code snippet to create a Diagram with stencil file:

var diagram = new Aspose.Diagram.Diagram();

// add a new dynamic connector
diagram.AddMaster(dataDir + "test.vssx", "3DDynamic connector");
long shapeId = diagram.Pages[0].AddShape(4.25, 5.5, 2, 2, "3DDynamic connector");
var shape = diagram.Pages[0].Shapes.GetShape(shapeId);

The above shared code snippet is same as in your shared project except the initialization of Diagram has been modified. We tested this code snippet with 21.3v of the API and it did not throw any exception. Also, the shape was added successfully.

outputvsdx.zip (16.2 KB)

Wow, this is really weird, I just ran the exact code you sent, with my dataDir, and it threw the exception. I also asked my coworker to run the project on his computer and it threw the same exception, showing that it’s not only on my computer… Do you have any idea what might cause this?
image.png (36.8 KB)

Also, it is working if i downgrade the version of Aspose.Diagrams to 21.2.0
Im using Nuget package manager on a .net core project if that is of any help.

@llesage
Please try the latest fix 21.3.1. We have fixed this issue in the fix.
Thanks.
https://downloads.aspose.com/diagram/net/new-releases/aspose.diagram-for-.net-21.3.1-(dlls-only)/

1 Like