QuestPDF / QuestPDF

QuestPDF is a modern open-source .NET library for PDF document generation. Offering comprehensive layout engine powered by concise and discoverable C# Fluent API. Easily generate PDF reports, invoices, exports, etc.
https://www.questpdf.com
Other
11.65k stars 604 forks source link

Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1 #799

Closed Zach488 closed 6 months ago

Zach488 commented 6 months ago

Describe the bug Trying to generate a document to file stream, but as soon as the doc.GeneratePdf is hit it throws an error that it is looking for that version of the Unsafe one. I did upgrade it to version 6. Please do let me know what info u further need.

Environment What version of the library do you use? 2023.12.6 What operating system do you use? (OS type, x64 vs x86 vs arm64) Windows 11

Zach488 commented 6 months ago

using .NETFramework,Version=v4.8'

Zach488 commented 6 months ago

Full exception

System.IO.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)\r\nFile name: 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'\r\n at System.Span1..ctor(T[] array, Int32 start, Int32 length)\r\n at SkiaSharp.Utils.RentedArray1..ctor(Int32 length) in D:\a\1\s\binding\Binding\Util.cs:line 80\r\n at SkiaSharp.SKManagedStream.OnReadManagedStream(IntPtr buffer, IntPtr size) in D:\a\1\s\binding\Binding\SKManagedStream.cs:line 110\r\n at SkiaSharp.SKAbstractManagedStream.ReadInternal(IntPtr s, Void context, Void buffer, IntPtr size) in D:\a\1\s\binding\Binding\SKAbstractManagedStream.cs:line 88\r\n at SkiaSharp.SKData.Create(SKStream stream, Int64 length) in D:\a\1\s\binding\Binding\SKData.cs:line 173\r\n at SkiaSharp.SKData.Create(Stream stream, Int64 length) in D:\a\1\s\binding\Binding\SKData.cs:line 140\r\n at QuestPDF.Drawing.FontManager.RegisterFont(Stream stream)\r\n at QuestPDF.Drawing.FontManager.RegisterLibraryDefaultFonts()\r\n at QuestPDF.Drawing.FontManager..cctor()\r\n\r\nWRN: Assembly binding logging is turned OFF.\r\nTo enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.\r\nNote: There is some performance penalty associated with assembly bind failure logging.\r\nTo turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].\r\n

Zach488 commented 6 months ago

Shouldn't by using the latest version also make the Drawing.Fontamanger use the latest version of the unsafe package too?

Zach488 commented 6 months ago
Zach488 commented 6 months ago

Nvm