forked from QuestPDF/QuestPDF
-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Describe the bug
I'm trying to generate a pdf file on api call. it does work on the first request but the second one throw a fatal error
Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at SkiaSharp.SkiaApi.sk_fontstyle_get_width(IntPtr)
To Reproduce
[HttpGet("id")]
public IActionResult Get(int id)
{
var myobject= myobjectService.GetById(id);
var document = Document.Create(container =>
{
container.Page(page =>
{
page.Content()
.Column(col =>
{
col.Item().Text($"Title: {myobject.Title}");
col.Item().Text($"Description : {myobject.Description}");
});
});
});
return new FileContentResult(document.GeneratePdf(), "application/pdf");After the second call the error is thrown
Expected behavior
The pdf should generate every time
Additional context
Everything works in 2022.12.10 but if i upgrade to 2024.5.1 the bug occurs
Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Repeat 2 times:
--------------------------------
at SkiaSharp.SkiaApi.sk_fontstyle_get_width(IntPtr)
--------------------------------
at SkiaSharp.SKFontStyle.get_Width()
at FossPDF.Drawing.FontStyleSet.IsBetterMatch(SkiaSharp.SKFontStyle, SkiaSharp.SKFontStyle, SkiaSharp.SKFontStyle)
at FossPDF.Drawing.FontStyleSet.Match(SkiaSharp.SKFontStyle)
at FossPDF.Drawing.DocumentSpecificFontManager.GetTypeface(FossPDF.Infrastructure.TextStyle)
at FossPDF.Drawing.DocumentSpecificFontManager.<ToPaint>b__42_0(FossPDF.Infrastructure.TextStyle)
at System.Collections.Concurrent.ConcurrentDictionary`2[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].GetOrAdd(System.__Canon, System.Func`2<System.__Canon,System.__Canon>)
at FossPDF.Drawing.DocumentSpecificFontManager.ToPaint(FossPDF.Infrastructure.TextStyle)
at FossPDF.Drawing.TextShaper.get_Paint()
at FossPDF.Drawing.TextShaper.PopulateBufferWithText(HarfBuzzSharp.Buffer, System.String)
at FossPDF.Drawing.TextShaper.Shape(System.String)
at FossPDF.Elements.Text.Items.TextBlockSpan.MeasureWithoutCache(FossPDF.Elements.Text.Calculation.TextMeasurementRequest)
at FossPDF.Elements.Text.Items.TextBlockSpan.Measure(FossPDF.Elements.Text.Calculation.TextMeasurementRequest)
at FossPDF.Elements.Text.TextBlock.<DivideTextItemsIntoLines>g__GetNextLine|30_0(<>c__DisplayClass30_0 ByRef)
at FossPDF.Elements.Text.TextBlock+<DivideTextItemsIntoLines>d__30.MoveNext()
at System.Collections.Generic.List`1[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]..ctor(System.Collections.Generic.IEnumerable`1<System.__Canon>)
at System.Linq.Enumerable.ToList[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
at FossPDF.Elements.Text.TextBlock.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Drawing.Proxy.CacheProxy.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Elements.Column.PlanLayout(FossPDF.Infrastructure.Size)
at FossPDF.Elements.Column.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Drawing.Proxy.CacheProxy.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Elements.Extend.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Drawing.Proxy.CacheProxy.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Elements.Extend.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Drawing.Proxy.CacheProxy.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Elements.Decoration+<PlanLayout>d__20.MoveNext()
at System.Collections.Generic.List`1[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]..ctor(System.Collections.Generic.IEnumerable`1<System.__Canon>)
at System.Linq.Enumerable.ToList[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
at FossPDF.Elements.Decoration.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Drawing.Proxy.CacheProxy.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Elements.Padding.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Drawing.Proxy.CacheProxy.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Elements.Constrained.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Elements.Layers.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Drawing.Proxy.CacheProxy.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Elements.Column.PlanLayout(FossPDF.Infrastructure.Size)
at FossPDF.Elements.Column.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Infrastructure.ContainerElement.Measure(FossPDF.Infrastructure.Size)
at FossPDF.Drawing.DocumentGenerator.RenderPass[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](FossPDF.Infrastructure.PageContext, System.__Canon, FossPDF.Elements.Container, FossPDF.Drawing.Proxy.DebuggingState)
at FossPDF.Drawing.DocumentGenerator.RenderDocument[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon, FossPDF.Infrastructure.IDocument)
at FossPDF.Drawing.DocumentGenerator.GeneratePdf(System.IO.Stream, FossPDF.Infrastructure.IDocument)
at FossPDF.Fluent.GenerateExtensions.GeneratePdf(FossPDF.Infrastructure.IDocument, System.IO.Stream)
at FossPDF.Fluent.GenerateExtensions.GeneratePdf(FossPDF.Infrastructure.IDocument)
at Api.Controllers.PdfController.Get(Int32)
at DynamicClass.lambda_method2(System.Runtime.CompilerServices.Closure, System.Object, System.Object[])
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor+SyncActionResultExecutor.Execute(Microsoft.AspNetCore.Mvc.ActionContext, Microsoft.AspNetCore.Mvc.Infrastructure.IActionResultTypeMapper, Microsoft.Extensions.Internal.ObjectMethodExecutor, System.Object, System.Object[])
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker+<<InvokeActionMethodAsync>g__Logged|12_1>d.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker+<<InvokeActionMethodAsync>g__Logged|12_1>d, Microsoft.AspNetCore.Mvc.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]](<<InvokeActionMethodAsync>g__Logged|12_1>d ByRef)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker+<<InvokeActionMethodAsync>g__Logged|12_1>d, Microsoft.AspNetCore.Mvc.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]](<<InvokeActionMethodAsync>g__Logged|12_1>d ByRef)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State ByRef, Scope ByRef, System.Object ByRef, Boolean ByRef)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State ByRef, Scope ByRef, System.Object ByRef, Boolean ByRef)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State ByRef, Scope ByRef, System.Object ByRef, Boolean ByRef)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State ByRef, Scope ByRef, System.Object ByRef, Boolean ByRef)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker+<<InvokeAsync>g__Logged|17_1>d.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker+<<InvokeAsync>g__Logged|17_1>d, Microsoft.AspNetCore.Mvc.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]](<<InvokeAsync>g__Logged|17_1>d ByRef)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker+<<InvokeAsync>g__Logged|17_1>d, Microsoft.AspNetCore.Mvc.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]](<<InvokeAsync>g__Logged|17_1>d ByRef)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeAsync()
at Microsoft.AspNetCore.Mvc.Routing.ControllerRequestDelegateFactory+<>c__DisplayClass12_0.<CreateRequestDelegate>b__0(Microsoft.AspNetCore.Http.HttpContext)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext)
at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware+<Invoke>d__5.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware+<Invoke>d__5, Microsoft.AspNetCore.Localization, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]](<Invoke>d__5 ByRef)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware+<Invoke>d__5, Microsoft.AspNetCore.Localization, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]](<Invoke>d__5 ByRef)
at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext)
at Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext)
at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext)
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware+<Invoke>d__5.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware+<Invoke>d__5, Swashbuckle.AspNetCore.SwaggerUI, Version=6.6.2.0, Culture=neutral, PublicKeyToken=4232c99127b3c254]](<Invoke>d__5 ByRef)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware+<Invoke>d__5, Swashbuckle.AspNetCore.SwaggerUI, Version=6.6.2.0, Culture=neutral, PublicKeyToken=4232c99127b3c254]](<Invoke>d__5 ByRef)
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware+<Invoke>d__6.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware+<Invoke>d__6, Swashbuckle.AspNetCore.Swagger, Version=6.6.2.0, Culture=neutral, PublicKeyToken=62657d7474907593]](<Invoke>d__6 ByRef)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware+<Invoke>d__6, Swashbuckle.AspNetCore.Swagger, Version=6.6.2.0, Culture=neutral, PublicKeyToken=62657d7474907593]](<Invoke>d__6 ByRef)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext, Swashbuckle.AspNetCore.Swagger.ISwaggerProvider)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware+<Invoke>d__11.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Microsoft.AspNetCore.Authorization.AuthorizationMiddleware+<Invoke>d__11, Microsoft.AspNetCore.Authorization.Policy, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]](<Invoke>d__11 ByRef)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[Microsoft.AspNetCore.Authorization.AuthorizationMiddleware+<Invoke>d__11, Microsoft.AspNetCore.Authorization.Policy, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]](<Invoke>d__11 ByRef)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware+<Invoke>d__6.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Microsoft.AspNetCore.Authentication.AuthenticationMiddleware+<Invoke>d__6, Microsoft.AspNetCore.Authentication, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]](<Invoke>d__6 ByRef)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[Microsoft.AspNetCore.Authentication.AuthenticationMiddleware+<Invoke>d__6, Microsoft.AspNetCore.Authentication, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]](<Invoke>d__6 ByRef)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl+<Invoke>d__14.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl+<Invoke>d__14, Microsoft.AspNetCore.Diagnostics, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]](<Invoke>d__14 ByRef)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl+<Invoke>d__14, Microsoft.AspNetCore.Diagnostics, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]](<Invoke>d__14 ByRef)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(Microsoft.AspNetCore.Http.HttpContext)
at Microsoft.AspNetCore.HostFiltering.HostFilteringMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol+<ProcessRequests>d__238`1[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.
AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol+<ProcessRequests>d__238`1[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Microsoft.AspNetCore.Server.Kestrel.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].ExecutionContextCallback(System.Object)
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread, System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.
AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol+<ProcessRequests>d__238`1[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Microsoft.AspNetCore.Server.Kestrel.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext(System.Threading.Thread)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.
AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol+<ProcessRequests>d__238`1[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Microsoft.AspNetCore.Server.Kestrel.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].ExecuteFromThreadPool(System.Threading.Thread)
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()
Process finished with exit code -1,073,741,819.
Metadata
Metadata
Assignees
Labels
No labels