mono / SkiaSharp

SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library. It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
MIT License
4.4k stars 535 forks source link

Unable to load assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' through COM #1990

Open vinodd30 opened 2 years ago

vinodd30 commented 2 years ago

Description I am trying to use SkiaSharp through Codecrete.SwissQRBill.Generator package. But when I am accessing this dll through COM compoenent I am getting errors as below:

System.TypeInitializationException HResult=0x80131534 Message=The type initializer for 'PerTypeValues`1' threw an exception. Source=System.Memory StackTrace: at System.SpanHelpers.IsReferenceOrContainsReferences[T]() at SkiaSharp.SKString.ToString() at SkiaSharp.SKTypeface.getFamilyName() at Codecrete.SwissQRBill.PixelCanvas.PNGCanvas.FindInstalledFontFamily(String fontFamilyList) in //PixelCanvas/Canvas/PNGCanvas.cs:line 110 at Codecrete.SwissQRBill.PixelCanvas.PNGCanvas..ctor(Double width, Double height, Int32 resolution, String fontFamilyList) in //PixelCanvas/Canvas/PNGCanvas.cs:line 57 at Codecrete.SwissQRBill.PixelCanvas.PNGCanvasFactory.Codecrete.SwissQRBill.Generator.Canvas.ICanvasFactory.Create(BillFormat format, Double width, Double height) in //PixelCanvas/Canvas/PNGCanvasFactory.cs:line 25 at Codecrete.SwissQRBill.Generator.Canvas.CanvasCreator.Create(BillFormat format, Double width, Double height) in //Core/Canvas/CanvasCreator.cs:line 50 at Codecrete.SwissQRBill.Generator.QRBill.CreateCanvas(BillFormat format) in //Core/QRBill.cs:line 309 at Codecrete.SwissQRBill.Generator.QRBill.Generate(Bill bill) in /_/Core/QRBill.cs:line 132 at Util.QRCodeGenerator.QRCodeGen.GenerateQRCode(String input) in C:\Nova\NovaProd\Source\DEV\4_Kailash_Scrum\Jd\Src\Util\QRCodeGen.cs:line 96

Inner Exception 1: FileLoadException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Inner Exception 2: FileLoadException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

So can you please help me to resolve this issue?

Regards, Vinod

Magenta94 commented 1 year ago

Same problem here

veprim commented 10 months ago

Have you fixed that anynone ?