WPF GdViewer throws a NullReferenceException

General discussions about GdPicture.NET.
Post Reply
accudave
Posts: 21
Joined: Tue May 12, 2015 6:07 pm

WPF GdViewer throws a NullReferenceException

Post by accudave » Tue May 12, 2015 6:13 pm

I'm having a problem where the new viewer is throwing a NullReferenceException when displaying a PDF. I attached the PDF in question to the post. The PDF is converted from a TIFF image and opens fine in all viewers, and it is converted by using GdPicture.

I can't really debug this because you obfuscate your code which makes it impossible to debug problems with your libraries. The method throwing the exception is the DisplayFromFile method.

this.gdPictureViewer.DisplayFromFile(this.SelectedDocument.FilePath);

Stack Trace:
at GdPicture11.WPF.GdViewer.gdpicture_ᜀ(Boolean A_0, Boolean A_1, Boolean A_2, Boolean A_3, Boolean A_4)
at GdPicture11.WPF.GdViewer.gdpicture_ᜀ(Boolean A_0, Boolean A_1, Boolean A_2, Boolean A_3, Double A_4, Double A_5, Boolean A_6, Boolean A_7, Boolean A_8, Boolean A_9, Boolean A_10, Boolean A_11)
at GdPicture11.Internal.Viewer.ViewerController.gdpicture_ᜀ(Boolean A_0, Boolean A_1, Boolean A_2, Boolean A_3, Boolean A_4, Boolean A_5, Boolean A_6, Boolean A_7, Boolean A_8, Boolean A_9, Boolean A_10, gdpicture_᝗ A_11)
at GdPicture11.Internal.Viewer.ViewerController.gdpicture_ᜠ()
at GdPicture11.WPF.GdViewer.gdpicture_᜶()
at GdPicture11.WPF.GdViewer.᜼()
at GdPicture11.WPF.GdViewer.DisplayFromFile(String FilePath)
at AccuSign.ViewModels.MainViewModel.SelectDocument(DocumentViewModel document) in f:\Capture Products\Code\AccuSign\AccuSign\ViewModels\MainViewModel.cs:line 1346
at AccuSign.ViewModels.MainViewModel.OnDocumentsLoaded() in f:\Capture Products\Code\AccuSign\AccuSign\ViewModels\MainViewModel.cs:line 975
at AccuSign.ViewModels.MainViewModel.LoadDocuments(IEnumerable`1 documents) in f:\Capture Products\Code\AccuSign\AccuSign\ViewModels\MainViewModel.cs:line 942
at AccuSign.App.InitializeDefaultViewState(MainWindowViewModel viewModel, IEnumerable`1 collection) in f:\Capture Products\Code\AccuSign\AccuSign\App.xaml.cs:line 147
at AccuSign.App.OnStartup(StartupEventArgs e) in f:\Capture Products\Code\AccuSign\AccuSign\App.xaml.cs:line 76
at System.Windows.Application.<.ctor>b__1(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
Attachments
test.zip
(695.35 KiB) Downloaded 336 times

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: WPF GdViewer throws a NullReferenceException

Post by Loïc » Sat May 16, 2015 3:58 pm

Hello,

The PDF can be perfectly opened and rendered using the latest version. Could you check you are up to date?

With best regards,

Loïc

accudave
Posts: 21
Joined: Tue May 12, 2015 6:07 pm

Re: WPF GdViewer throws a NullReferenceException

Post by accudave » Tue May 19, 2015 3:34 pm

I am on version 11.1.0.14.

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: WPF GdViewer throws a NullReferenceException

Post by Loïc » Tue May 19, 2015 4:25 pm

OK. Please open a ticket on our helpdesk platform and we will send needed material to trace the issue: http://support.orpalis.com

With best regards,

Loïc

accudave
Posts: 21
Joined: Tue May 12, 2015 6:07 pm

Re: WPF GdViewer throws a NullReferenceException

Post by accudave » Mon Jun 08, 2015 4:19 pm

It turned out that when using the MVVM pattern, you must ensure you are calling the view document api after the view has been fully initialized. In this case, the solution was the extract an interface from the view-model and call the view document api after the GdViewer has been fully loaded.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest