Apryse PDFTron SetDoc method throws AccessViolationException

17 Views Asked by At

This is a UWP application and the requirement is to open a document from a list of documents with the click of next and previous buttons.

private async void Open(PDFDoc doc)
    {
        try
        {
            PDFViewCtrl.DocUnlock();
            PDFViewCtrl.CloseDoc();
            PDFViewCtrl.SetDoc(doc);
        }
        catch (Exception e)
        {
            pdftron.Common.PDFNetException ex = new pdftron.Common.PDFNetException(e.HResult);
            if (ex.IsPDFNetException)
            {
                errorMessage = ex.ToString();
            }
            else
            {
                errorMessage = e.ToString();
            }
            System.Diagnostics.Debug.WriteLine(ex.ToString());
        }
    }

When the user frequently clicks on a button (Next or Previous) after loading some documents app suddenly crashes with the following error.

System.AccessViolationException
  HResult=0x80004003
  Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
  Source=<Cannot evaluate the exception source>
  StackTrace:
<Cannot evaluate the exception stack trace>

Any idea on how to fix this is highly appreciated.

0

There are 0 best solutions below