We're sorry GroupDocs doesn't work properply without JavaScript enabled.

Free Support Forum - groupdocs.com

Application Crash on Linux when Processing a File with a Form Element

When processing this file test.docx (37.6 KB) on Linux, our service is killed with an unhandled exception from SkiaSharp. The stack trace does not contain any of our code, and can’t seem to be trapped (the triggering code is in a try-catch, and nothing is caught).

The service threw an unhandled exception, System.ArgumentNullException: Value cannot be null. (Parameter 'buffer')
       at SkiaSharp.SKManagedStream.OnReadManagedStream(IntPtr buffer, IntPtr size)
       at SkiaSharp.SKManagedStream.OnRead(IntPtr buffer, IntPtr size)
       at SkiaSharp.SKAbstractManagedStream.ReadInternal(IntPtr s, Void* context, Void* buffer, IntPtr size)

Removing the form element (the checkbox in the grey area near the top) and the file processes successfully. Other documents process successfully on Linux. The same code on Windows can process the document successfully.

The relevant code snippet (try-catch removed):

var pages = new List<MemoryStream>();
var pageStreamFactory = new ContentPageStreamFactory(pages);
using (var viewer = new Viewer(stream))
     var options = new JpgViewOptions(pageStreamFactory)
           Quality = 50
     viewer.View(options, 1);

var image = Image.FromStream(pages.FirstOrDefault());

Linux version is Red Hat Enterprise Linux release 8.4 (Ootpa) 4.18.0-305.19.1.el8_4.x86_64
.NET is version 5.0.11
GroupDocs.Viewer version is 21.10.0
SkiaSharp version is 2.80.3
SkiaSharp.NativeAssets.Linux version is 2.80.3


Thank you for providing the sample file, code snippet and SkiaSharp versions. I’m able to reproduce this issue with this sample_app.zip (96.2 KB) in a Docker container with SkiaSharp.NativeAssets.Linux.NoDependencies 2.80.3.

I’ve also tried to use 2.80.2 and it worked well, can you please try running your app with SkiaSharp.NativeAssets.Linux.NoDependencies 2.80.2 instead of referencing SkiaSharp version is 2.80.3 and SkiaSharp.NativeAssets.Linux version is 2.80.3?

Thanks. That works.


Great, thanks for the response.

Unfortunately, I haven’t found any documented confirmation that the version of the SkiaSharp.NativeAssets.* should be the same as SkiaSharp version but it seems that the versions should match with the version we depend on.

Possibly we could include SkiaSharp.NativeAssets.* as a dependency in our NuGet package but according to SkiaSharp-Native-Assets-for-Linux it is not recommended:

The overall result of this is that you will do everything as usual, but in the “app” part of the solution, just add the package. You should not release a NuGet to nuget.org that depends on this directly as you will then force all your uses to use my binary.

The NuGet page says >= 2.80.2 - should we take that as “=” rather than latest? We can then make sure the build uses that.


This issue has been already reported to SkiaShap, the issue ID is #1846. So, for now, it would be reasonable to use 2.80.2.