Free Support Forum - aspose.com

Aspose words with net core 2.0.3 on openshift

Hey,
I have a net core 2.0.3 project with aspose words 18.0.1 and skiasharp 1.6 that works fine on my computer but iam trying to run my project on openshift and getting the following exception:

The type initializer for ‘SkiaSharp.SKImageInfo’ threw an exception.

Here is my code:
public string PostWord(IFormFile file)
{
try
{
using(MemoryStream postFile = new MemoryStream())
using(MemoryStream htmlStream = new MemoryStream())
using(MemoryStream xmlStream = new MemoryStream())
{
file.CopyTo(postFile);
Document doc = new Document(postFile);
doc.Save(xmlStream, SaveFormat.WordML);

            doc.Save(htmlStream, new HtmlSaveOptions
            {
                  ExportImageAsBase64 = true,
                  Encoding = Encoding.UTF8,
                  SaveFormat = SaveFormat.Html
            });

      return "succ";
}
}
catch (System.Exception e)
{
return e.Message;
}
}

any idea why this happens?

@Jopa,

Thanks for your inquiry. We suggest you please always install Aspose.Words for .NET via NuGet.

I changed to skiasharp 1.59.1 and now my aspose is like the nuget version

The inner exception iam getting is
Unable to load DLL ‘libSkiaSharp’: The specified module or on of its dependencies could not be found

@Jopa,

Please uninstall/delete all old Aspose.Words.dll references from your Visual Studio project (and related DLLs from Bin folder). After that please use NuGet Package Manager UI to install Aspose.Words for .NET NuGet package. This will also install external references such as SkiaSharp to your project. Hope this helps you.

Thanks for your help but iam not using any dll references,only nuget packages. The skiasharp 1.59.1 is installed automatically with my aspose version (18.1.0)

@Jopa,

Thanks for your inquiry. Please try latest version of Aspose.Words for .NET 18.4. If you still face problem, please share following detail here for testing:

  • Your input Word document.
  • The operating system on which you are facing this issue.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.