SkiaSharp

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

Unhandled Exception: System.TypeInitializationException: The type initializer for ‘SkiaSharp.SKAbstractManagedStream’ threw an exception. —> System.DllNotFoundException: Unable to load DLL ‘libSkiaSharp’ or one of its dependencies: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at SkiaSharp.SkiaApi.sk_managedstream_set_delegates(IntPtr pRead, IntPtr pPeek, IntPtr pIsAtEnd, IntPtr pHasPosition, IntPtr pHasLength, IntPtr pRewind, IntPtr pGetPosition, IntPtr pSeek, IntPtr pMove, IntPtr pGetLength, IntPtr pCreateNew, IntPtr pDestroy)
at SkiaSharp.SKAbstractManagedStream…cctor()
— End of inner exception stack trace —
at SkiaSharp.SKAbstractManagedStream…ctor(Boolean owns)
at SkiaSharp.SKManagedStream…ctor(Stream managedStream, Boolean disposeManagedStream, Boolean owns)
at SkiaSharp.SKManagedStream…ctor(Stream managedStream, Boolean disposeManagedStream)
at SkiaSharp.SKManagedStream…ctor(Stream managedStream)
at ??.(Stream )
at ??..ctor(Stream )
at Aspose.BarCode.Bitmap…ctor(Stream stream)
at Aspose.BarCode.BarCodeRecognition.BarCodeReader…ctor(Stream stream, BaseDecodeType type)
at process.Assist.SCANS.Program.ImageExtract(MemoryStream imageStream) in C:\git\RcG.Assist.Tools\process.Assist.SCANS\process.Assist.SCANS\Program.cs:line 386
at process.Assist.SCANS.Program.PageExtract(Page page, Int32 pgno, String fileName) in C:\git\RcG.Assist.Tools\process.Assist.SCANS\process.Assist.SCANS\Program.cs:line 326
at process.Assist.SCANS.Program.<>c__DisplayClass4_1.<b__0>d.MoveNext() in C:\git\RcG.Assist.Tools\process.Assist.SCANS\process.Assist.SCANS\Program.cs:line 234
— End of stack trace from previous location where exception was thrown —
at process.Assist.SCANS.Program.pdfExtract(String pdfFile) in C:\git\RcG.Assist.Tools\process.Assist.SCANS\process.Assist.SCANS\Program.cs:line 240
at process.Assist.SCANS.Program.<>c__DisplayClass3_0.<b__1>d.MoveNext() in C:\git\RcG.Assist.Tools\process.Assist.SCANS\process.Assist.SCANS\Program.cs:line 133
— End of stack trace from previous location where exception was thrown —
at process.Assist.SCANS.Program.KKK() in C:\git\RcG.Assist.Tools\process.Assist.SCANS\process.Assist.SCANS\Program.cs:line 147
at process.Assist.SCANS.Program.Main(String[] args) in C:\git\RcG.Assist.Tools\process.Assist.SCANS\process.Assist.SCANS\Program.cs:line 64
at process.Assist.SCANS.Program.(String[] args)

i’ve removed “Aspose.Total.lic” file from the project

@erikg,

Could you please share how is this related to Aspose.Barcode API? If you are using Aspose.Barcode API and facing any issue with it, please share your sample code and input files with us for further investigation at our end.

process.Assist.SCANS.zip (1.7 MB)

i couldn’t upload the zip (probably to big),
so i’ve removed “Aspose.BarCode.dll”, “Aspose.Pdf.dll”, both are of version 18.7, from the published project

i’ve already tried removing all references of ASPOSE and adding them again via NUGET

when in debug (visual studio), there is no problem, but when i create a publish build in the same comp., i get an error

dotnet process.Assist.SCANS.dll

@erikg

We were able to observe the same exception in our environment (Exception_SkiaSharp.png (21.2 KB)), which you have mentioned in your first post. However, it is vague why published version of the application is throwing this exception unless we have source code of the program. We request you to please share a sample console application, with minimum code snippet, able to reproduce the error in any environment. We will test it in both debug and published mode, and share our findings with you.

process.Assist.SCANS.zip (315.5 KB)
here’s the source code

@erikg

Thanks for sharing sample source code.

We are working over testing the scenario in our environment and will update you in a while.

@erikg

We have tested the scenario by executing your program in both debug and published modes. We were unable to reproduce the issue in our environment. Please check attached screenshot of running program with published version. PublishedVersionOutput.png (3.7 KB) Furthermore, you can also check published application (generated in our enviornment) from this link and check by running it in your environment. Please also include your license file before running the application.

In case you still face issue in your environment, please share if there are any publish profile settings/configurations which you are using while publishing the application via Visual Studio. Also, please share complete environment details i.e. OS Version, Visual Studio detailed Version, etc. We will again test the scenario in specific environment and share our feedback accordingly.

PS: We tested the scenario in Windows 10 EN x64 using VS Community 2017 Version 15.7.5. Application was published using default configurations.

when i’v created publish profile i’ve set it (target runtime) to win-x64 (no libSkiaSharp.dll),
but when i’ve changed it to Portable, published solution worked (runtimes folder was created)

thx

image.png (21.2 KB)

@erikg

It is good to know that your issue has been resolved. Please keep using our APIs and in case of any further assistance, please feel free to let us know.