Skip to content

System.InvalidOperationException: 'Must not change font resolver after is was once used.' #1

@divyesh008

Description

@divyesh008

The print pdf button works fine for the first time but when again I am clicking Print pdf button the app is crashing. I have test this in UWP simulator.

Exception Details

System.InvalidOperationException
  HResult=0x80131509
  Message=Must not change font resolver after is was once used.
  Source=PdfSharpCore
  StackTrace:
   at PdfSharpCore.Fonts.GlobalFontSettings.set_FontResolver(IFontResolver value)
   at PDFDemo.PDFReports.ProductsReport..ctor(List`1 items) in D:\Demos\PDFDemo-master\PDFDemo-master\PDFDemo\PDFDemo\PDFReports\ProductsReport.cs:line 30
   at PDFDemo.ViewModels.ProductListViewModel.<PrintPdf>d__17.MoveNext() in D:\Demos\PDFDemo-master\PDFDemo-master\PDFDemo\PDFDemo\ViewModels\ProductListViewModel.cs:line 46
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at PDFDemo.ViewModels.ProductListViewModel.<<-ctor>b__19_1>d.MoveNext() in D:\Demos\PDFDemo-master\PDFDemo-master\PDFDemo\PDFDemo\ViewModels\ProductListViewModel.cs:line 64

  This exception was originally thrown at this call stack:
    [External Code]
    PDFDemo.PDFReports.ProductsReport.ProductsReport(System.Collections.Generic.List<PDFDemo.Models.Product>) in ProductsReport.cs
    PDFDemo.ViewModels.ProductListViewModel.PrintPdf() in ProductListViewModel.cs
    [External Code]
    PDFDemo.ViewModels.ProductListViewModel..ctor.AnonymousMethod__19_1() in ProductListViewModel.cs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions