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.

AsposeExceptionOnMac.zip (1.0 KB)

@pavel_nevron,
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 Flowchart_start.zip (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.

@pavel_nevron,
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 (3.8.0.49) 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.

@pavel_nevron,
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”.

AsposeSample.zip (2.4 MB)

@pavel_nevron,
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.

@pavel_nevron,

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)

@pavel_nevron,

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.

@pavel_nevron

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.

Hello and Happy New Year 2023!

Five years have passed since I started this forum thread and I wondered if there are any updates in Aspose.Diagram’s macOS support. Here’s a screenshot of the exception I’m getting with Aspose.Diagram 18.10 on macOS:
aspose-diagram-mac-exception.png (47.8 KB)

I also added the Nuget package System.Drawing.Common 5.0.3, since version 6.0.0 and later work only on Windows according to following Microsoft’s documentation topic, but I’m still getting the “PlatformNotSupportedException” from the screenshot above:
System.Drawing.Common only supported on Windows

Please let me know if the latest version of Aspose.Diagram can be used in a Xamarin.Mac project with Visual Studio 2022 for Mac or if there’s any workaround to make it work on macOS.

Thank you!

@pavel_nevron

Please accept our humble apology for the inconvenience caused due to this issue. Please note that the ticket can only be resolved by the development of an entirely new component and we are afraid that due to other parallel issues and tasks in the queue, it could not be made. Nevertheless, the ticket has been revived again with your latest concerns and we will let you know once we have some updates.

We apologize for your inconvenience.

@pavel_nevron
Hello and Happy New Year 2023!
Please use version 22.12 of our Python via .NET, which includes the version used on macOS.
https://releases.aspose.com/diagram/python-net/new-releases/aspose.diagram-for-python-via-.net-22.12/
Thanks.