AsposeTasks:TypeInitializationException:The type initializer for 'Gdip' threw an exception

I’m building an application that runs on both windows and macos.

This application converts mpp to pdf.

On Windows (10) it works but on MacOs I get:

TypeInitializationException:The type initializer for ‘Gdip’ threw an exception.

We’re using the latest AsposeTasks and the app is built in .net 6.

See code example:

AsposeTasks.zip (28.4 KB)

@nielsbosma,

Aspose.Tasks currently uses System.Drawing to render (in particular, to save to PDF) projects.
Microsoft marked System.Drawing as a Windows-specific library and now classes from System.Drawing assembly throw exception you’ve observed.

More details are on Microsoft site .

As a temporary fix you can disable this behavior and enable support for non-Windows platforms by setting configuration switch (see the link above).

We are going to remove usages of System.Drawing in future release, but cannot provide an exact E.T.A.

Workaround doesn’t work.

We are going to remove usages of System.Drawing in future release, but cannot provide an exact E.T.A.

Can you add a ticket reference to this thread?

@nielsbosma

Which version of .NET do you use?

Thank you for noticing. I’ve linked the ticket.

Any progress on this ticket? Any ETA?

@nielsbosma,

we still cannot provide any E.T.A. (see also our free support policies).

The task is quite labor-intensive because we should modify all codebase to replace usages of classes from System.Drawing to usages of third-party drawing lib.

The issues you have found earlier (filed as TASKSNET-10579) have been fixed in this update.