This is a migrated thread and some comments may be shown as answers.

ArgumentNullException in PdfElementToFixedElementTranslator.CreateDestination

4 Answers 108 Views
PDFViewer
This is a migrated thread and some comments may be shown as answers.
Vladimir
Top achievements
Rank 1
Veteran
Vladimir asked on 05 Aug 2019, 06:13 AM

Hi, i'm using PdfViewer and an unhandled ArgumentNullException exception appears periodically on some files.

I saw that there was a already similar error, written in this post   https://www.telerik.com/forums/argumentnullexception-after-scrolling-pdf-document   and that error has been fixed. But i'm using the new version of telerik - 2019.2.618. This error is reproduced in the examples from "xaml-sdk", on FirstLook project.

The error can be reproduced by downloading the file from this link   https://beginners.re/RE4B-EN.pdf. On the 39 page below there is a link that does not have a destination   -   "29 STMFD 30". The 30 link does not link anywhere, and when PdfViewer try to create destination, it falls with exception.
I check the Destination property in GoToActionOld object before create object Destination. It helped for me.

private static GoToAction CreateGoToAction(GoToActionOld source, PdfFormatProvider provider)
{
    Guard.ThrowExceptionIfNull(source, "source");
    if (source.Destination == null)
    {
        return null;
    }
    return new GoToAction
    {
        Destination = CreateDestination(source.Destination, provider)
    };
}

Here is a StackTrace:
System.ArgumentNullException
  HResult=0x80004003
  Сообщение = Значение не может быть неопределенным.
Имя параметра: source
  Источник = Telerik.Windows.Documents.Fixed
  Трассировка стека:
   at Telerik.Windows.Documents.Fixed.FormatProviders.Old.Pdf.PdfElementToFixedElementTranslator.CreateDestination(DestinationOld source, PdfFormatProvider provider)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Old.Pdf.PdfElementToFixedElementTranslator.CreateGoToAction(GoToActionOld source, PdfFormatProvider provider)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Old.Pdf.PdfElementToFixedElementTranslator.CreateLinkAnnotation(LinkOld source, PdfFormatProvider provider)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Old.Pdf.PdfElementToFixedElementTranslator.CreateAnnotation(AnnotationOld source, PageOld page, PdfFormatProvider provider)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider.CopyAnnotationsFromPageSource(PageOld source, AnnotationCollection annotations)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider.LoadPageAnnotations(RadFixedPage page)
   at Telerik.Windows.Documents.Fixed.Model.RadFixedPage.LoadAnnotations()
   at Telerik.Windows.Documents.Fixed.Model.Internal.RadFixedPageInternal.Arrange()
   at Telerik.Windows.Documents.Fixed.FormatProviders.Old.Pdf.PdfReader.ThreadSafePageContentManagerOld.LoadPageContent(RadFixedPage page)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.LoadOnDemandPagesCacheManager.BeginUsingPage(RadFixedPage page)
   at Telerik.Windows.Documents.Fixed.UI.VisiblePagesCacheManager.UpdateCachedPages(IEnumerable`1 visiblePages)
   at Telerik.Windows.Documents.UI.FixedDocumentPagesPresenter.ArrangeOverride(Size arrangeBounds)
   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at System.Windows.ContextLayoutManager.UpdateLayout()
   at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at FirstLook.App.Main()

Please check and correct the error, because I have to keep a separate fixed library.

4 Answers, 1 is accepted

Sort by
0
Peshito
Telerik team
answered on 07 Aug 2019, 10:34 AM
Hello Vladimir,

Thank you for reporting this issue. I was able to reproduce it following your steps and I confirm it as a bug. I logged it in our feedback portal on your behalf where you could subscribe for the item and get notified by email for any status changes - ArgumentNullException in PdfElementToFixedElementTranslator.CreateDestination.

As a gratitude for bringing this to our attention your Telerik points are now updated.

Regards,
Peshito
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Vladimir
Top achievements
Rank 1
Veteran
answered on 08 Aug 2019, 04:34 AM
Thank you Peshito.
0
Andrew
Top achievements
Rank 2
answered on 16 Apr 2020, 12:40 PM
Any idea if this is being worked on. We too are bumping into the exception. The PDF file we have the exception with is generated by our in-house tech writer. What can she do to verify what may be wrong with the document? Thanks.
0
Martin
Telerik team
answered on 17 Apr 2020, 10:21 AM

Hello Andrew,

I already answer your questions in the Bug Report public item. Please, check here: PdfViewer: ArgumentNullException in PdfElementToFixedElementTranslator.CreateDestination.

Regards,
Martin
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
PDFViewer
Asked by
Vladimir
Top achievements
Rank 1
Veteran
Answers by
Peshito
Telerik team
Vladimir
Top achievements
Rank 1
Veteran
Andrew
Top achievements
Rank 2
Martin
Telerik team
Share this question
or