Free Support Forum -

Exception when loading a diagram under Mac OS (Xamarin Mac)

Hi, I’m getting an exception when trying to load a VSD file with Aspose.Diagram under Mac OS Sierra (10.12). The application works fine when run from Xamarin Studio, but when run as a standalone application and when the Aspose code for loading a diagram (new Diagram(…)) is called the following exception is thrown:

Error in element VisioDocument in \VisioDocument. Error in element Colors in \VisioDocument\Colors. The type initializer for ‘System.Drawing.KnownColors’ threw an exception.

Full exception info (including stack trace) is attached below. Checking the stack trace I saw that you are using reflection. Maybe it causes the issue under Mac. Thank you in advance for your response. (1.0 KB)

Kindly send us your source VSD drawing. We will investigate and share our findings with you.

Hi, sorry, I forgot to attach it to the previous message. Here’s the VSD drawing:

Visio 2007 (45.1 KB)

I’m loading it using the following code:

Diagram diagram = new Diagram(inputStream, LoadFileFormat.VSD);

I’m using the latest currently available evaluation version of Aspose Diagram for .NET - 17.9 and Xamarin Studio 6.1.5 (with Mono 4.6.2) under Mac OS 10.12 Sierra. Let me know if you need more information.

We have logged an investigation under the ticket ID DIAGRAMNET-51360 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates.

Hi, have you managed to reproduce the problem on your side?

I have also created a .NET Standard 2.0 version of our project and compiled it with the latest version of Visual Studio for MAC (version 7.2 build 6.3.6) using the latest version of Xamarin.Mac ( and got the same result. The application works fine when run from Visual Studio for MAC and the Aspose.Diagram DLL loads old Visio Drawings (VSD) files fine, but when I run the application directly (double click it in Finder) I get the same TypeInitializer exception mentioned in my first post.

Based on the initial investigation, we are unable to replicate this error with MAC 10.12.6 and Xamarin Studio 6.3. Kindly create a small project application which reproduces this error in your environment, and then send us a Zip of this project. We will investigate and share our findings with you.

Hi, I have attached to this post a simple application that demonstrates the error. I’ve created it using the latest version of Visual Studio for Mac (version 7.2, build 636) on macOS High Sierra (10.13), but I’m pretty sure that you will get the same exception on older versions, too. A sample diagram is also included in the attached project, as well as the latest version of Aspose.Diagram for NET 4.0 (version 17.9.1).

As I’ve mentioned in a previous post, Aspose.Diagram loads the diagram just fine when the application is run from Visual Studio for Mac but when the application is run outside of the Visual Studio IDE, for example from Finder, an exception is thrown. I suspect that one or more assemblies Aspose.Diagram depends on are missing from the application package Visual Studio for Mac creates. Please take a look at the attached project and let me know what do you think. The code that loads the diagram is in the file “MainWindow.cs”. (2.4 MB)

Thank you for sharing a sample project. We have logged your sample project under the same ticket ID DIAGRAMNET-51360 and will investigate as per the given details. We will let know once a significant progress has been made in this regard.

Hi, I just wanted to check whether you have managed to reproduce the issue on your side.


We can find the issue and our product team will investigate further as per their development schedules.

1 Like

Hi, I was wondering whether you have any new information about this issue. I have tested it with version 18.1 of Aspose.Diagram for .NET and I have attached the exception message and the stack trace attached to this post. The stack trace is not very readable, because of the obfuscation of your assembly, but I hope you’ll be able to reproduce it on your side with the original source code of Aspose.Diagram. Let me know if you need more information.

AsposeDiagram-error-message.png (133.6 KB)


We can replicate the issue in our environment. Our product team will investigate as per their development schedules. We will let you know once a significant progress has been made in this regard.

Hi. I was wondering if there are any news regarding this issue with Apsose.Diagram under Mac.


Thanks for your inquiry.

We were able to replicate the issue and found that it could be resolved by adding support for Aspose.Diagram_Mac.Xamarin. I regret to share that we do not plan to add such support in near future however, we have recorded your concerns under the earlier logged ticket and will definitely let you know once there is some significant update in this regard. Please spare us little time.

We are sorry for the inconvenience.