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

Null Reference Exception

11 Answers 261 Views
PDFViewer
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 03 Mar 2014, 08:12 PM
Hi, I'm experiencing a NRE when using RadPdfViewer. So far, I've not been able to come up with something that's repeatable (however, it's consistently failing), but it does seem to have something to do when closing down a control (i.e. removing the control that contains the RadPdfViewer).

Is there some what I can at least trap this error and prevent it from leaving the Telerik libraries? Or absent that do you have instructions for me to somehow build a debug release of Telerik I can debug with?

I'm using Q1 2014 release.

Thanks,
Scott

This is the exception:

System.NullReferenceException was unhandled
  HResult=-2147467261
  Message=Object reference not set to an instance of an object.
  Source=Telerik.Windows.Controls.FixedDocumentViewers
  StackTrace:
       at Telerik.Windows.Documents.UI.FixedDocumentPresenterBase.UpdateSelectionUILayer()
       at Telerik.Windows.Documents.UI.FixedDocumentPresenterBase.UpdateCaretUI()
       at Telerik.Windows.Documents.UI.FixedDocumentPresenterBase.Presenter_LostFocus(Object sender, RoutedEventArgs e)
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
       at Telerik.Windows.Controls.Input.FocusScope.OnLostFocus(Control element)
       at Telerik.Windows.Controls.Input.FocusScope.FocusNextElement()
       at Telerik.Windows.Controls.Input.FocusScope.RemoveFocusableElement(Control element)
       at Telerik.Windows.Controls.Input.FocusScope.FocusableElement_Unloaded(Object sender, RoutedEventArgs e)
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
       at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
       at System.Windows.BroadcastEventHelper.BroadcastUnloadedEvent(Object root)
       at MS.Internal.LoadedOrUnloadedOperation.DoWork()
       at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
       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 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()
       at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
       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 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 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, 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.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
       at System.Windows.Threading.Dispatcher.Run()
       at System.Windows.Application.RunDispatcher(Object ignore)
       at System.Windows.Application.RunInternal(Window window)
       at System.Windows.Application.Run(Window window)
       at System.Windows.Application.Run()
       at FileNavigator.App.Main() in c:\Dev\Projects\FileWorld\File.App\obj\x86\Debug\App.g.cs:line 50
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       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 System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

11 Answers, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 06 Mar 2014, 11:57 AM
Hello Scott,

Thank you for contacting us.
Could you be more specific about the steps which are required in order to reproduce this issue ? We tried removing RadPdfViewer from the visual tree and also removing the control that contains RadPdfViewer from the visual tree. None of those steps managed to reproduce the issue. Can you determine whether this exception is being thrown only with some specific document ? If this is the case, we will need to examine this document if possible in order to determine what causes this issue.

We're looking forward to hearing from you.  

Regards,
Alexander
Telerik

DevCraft Q1'14 is here! Join the free online conference to see how this release solves your top-5 .NET challenges. Reserve your seat now!

0
Scott
Top achievements
Rank 1
answered on 06 Mar 2014, 09:37 PM
I created a small project to illustrate the problem; I couldn't upload it here, but the support ticket is:
795642

Thanks,
Scott
0
Alexander
Telerik team
answered on 11 Mar 2014, 07:31 AM
Hello Scott,

We have managed to reproduce this issue and found what causes it. The fix will be released for our next LIB.

If you have further questions or some other concerns do not hesitate to contact us again.

Regards,
Alexander
Telerik

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

0
Daniel
Top achievements
Rank 1
answered on 19 Mar 2014, 02:02 PM
The problem also exists in Silverlight.
0
Alexander
Telerik team
answered on 21 Mar 2014, 09:14 AM
Hello Daniel,

Our LIB has fixed this issue for both SL and WPF.  

Let me know if you have other comments or questions.

Regards,
Alexander
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
0
Rachel
Top achievements
Rank 1
answered on 26 May 2014, 05:31 AM
Hi, 
I have the same problem. If I press the control (radPdfViewer), and then moves to another screen (change control visibility) I get the same error.

Maybe you can help me?

Thanks.
0
Petya
Telerik team
answered on 28 May 2014, 11:19 AM
Hi Rachel,

As far as we are aware, this issue is not present in the most recent official version of Telerik UI for WPF - Q1 2014 SP1. Could you please try the version out and let us know of the results?

I hope this helps.

Regards,
Petya
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Rachel
Top achievements
Rank 1
answered on 28 May 2014, 11:40 AM
I have 2014.1.224.40 version
0
Petya
Telerik team
answered on 29 May 2014, 03:50 PM
Hi Rachel,

Did you try upgrading your project to version 2014.1 331? We are unable to provide a workaround for the version you are currently using, but to our knowledge the latest version of RadPdfViewer works correctly in this case.

Let me know how this works for you.

Regards,
Petya
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Nisarg
Top achievements
Rank 1
answered on 14 Sep 2015, 09:55 AM
Hi,

I am using telerik control version 2014.1.331.40.
I got error Object reference not set to an instance of an object.

as per,

I have a window and RadGridView in this window. I am opening another window on double click on gridview row and in the opened window I have
RadTabControl and I took four RadTabItem, I show RadGridView and RadPDFViewer (RadPDFViewer is in small size) in the last 4th tab. when any row
is selected in the gridview, I fill RadPDFViewer DocumentSource based on selected row dynamicaaly. I also open another new window when double click
on RadPDFViewer and new opened window just display RadPDFViewer with full window size to view pdf file. After closing new opened window and I click
on the first RadTabItem of the window and close the window. exactly at this time, I got the error.

I also attached image of exception throw.

Detail of the exception :-

{System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.Windows.Controls.Input.FocusScope.FocusInternal()
   at Telerik.Windows.Controls.Input.FocusScope.FocusNextElement()
   at Telerik.Windows.Controls.Input.FocusScope.RemoveFocusableElement(Control element)
   at Telerik.Windows.Controls.Input.FocusScope.FocusableElement_Unloaded(Object sender, RoutedEventArgs e)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
   at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
   at System.Windows.BroadcastEventHelper.BroadcastUnloadedEvent(Object root)
   at MS.Internal.LoadedOrUnloadedOperation.DoWork()
   at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
   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 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   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 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 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, 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.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.Run()
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)
   at System.Windows.Application.Run()
   at Accumatch.TaxPayment.App.Main(String[] args)

Regards,
Nisarg
0
Tanya
Telerik team
answered on 17 Sep 2015, 07:24 AM
Hello Nisarg,

Please, check the answer in the other forum post on this matter.

Regards,
Tanya
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
PDFViewer
Asked by
Scott
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Scott
Top achievements
Rank 1
Daniel
Top achievements
Rank 1
Rachel
Top achievements
Rank 1
Petya
Telerik team
Nisarg
Top achievements
Rank 1
Tanya
Telerik team
Share this question
or