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.AddShape(4.25, 5.5, 2, 2, "3DDynamic connector");
var shape = diagram.Pages.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)