Free Support Forum - aspose.com

Could not load type 'System.Drawing.Drawing2D.HatchStyle'

I have a .NET Core MVC Web API that I’m trying to do some Aspose document conversion within. I grabbed the Aspose.Words_18.8 download of the dlls, and referenced the dll from the net2.0 folder. I get an exception on this line of code:

Document doc = new Document(fileLocation);

The exception says “The type initializer for '\u0003 ’ threw an exception.” and the inner exception says:

{System.TypeLoadException: Could not load type ‘System.Drawing.Drawing2D.HatchStyle’ from assembly ‘System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’.
at …cctor()}

I can’t find anything about this except a single page in japanese.

I tried switching the dll’s I’m using to the ones from the netstandard2.0 folder, and I get a different exception, which says:

“Could not load file or assembly ‘SkiaSharp, Version=1.60.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756’. The system cannot find the file specified.”

@gglenister,

Thanks for your inquiry. Please ZIP and attach your input Word document here for testing. We will investigate the issue on our side and provide you more information.

test files.zip (109.7 KB)
These are the files I’m testing with for now.

@gglenister,

Thanks for sharing the documents. We have not found the shared issue while using latest version of Aspose.Words for .NET 18.8. Could you please share the detail of your use case along with the steps to reproduce this issue at our end? Please also share the detail of your operating system.

I have solved the issue on my own - had to install the SkiaSharp nuget package to get things working.

@gglenister,

Thanks for your feedback. It is nice to hear from you that your problem has been solved. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.