Null Reference Exception

12 posts, 0 answers
  1. Scott
    Scott avatar
    10 posts
    Member since:
    Mar 2013

    Posted 03 Mar 2014 Link to this post

    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: 
  2. Alexander
    Admin
    Alexander avatar
    41 posts

    Posted 06 Mar 2014 Link to this post

    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!

  3. UI for WPF is Visual Studio 2017 Ready
  4. Scott
    Scott avatar
    10 posts
    Member since:
    Mar 2013

    Posted 06 Mar 2014 in reply to Alexander Link to this post

    I created a small project to illustrate the problem; I couldn't upload it here, but the support ticket is:
    795642

    Thanks,
    Scott
  5. Alexander
    Admin
    Alexander avatar
    41 posts

    Posted 11 Mar 2014 Link to this post

    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.

  6. Daniel
    Daniel avatar
    2 posts
    Member since:
    Sep 2012

    Posted 19 Mar 2014 in reply to Alexander Link to this post

    The problem also exists in Silverlight.
  7. Alexander
    Admin
    Alexander avatar
    41 posts

    Posted 21 Mar 2014 Link to this post

    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.

     
  8. Rachel
    Rachel avatar
    2 posts
    Member since:
    May 2014

    Posted 26 May 2014 Link to this post

    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.
  9. Petya
    Admin
    Petya avatar
    975 posts

    Posted 28 May 2014 Link to this post

    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.
     
  10. Rachel
    Rachel avatar
    2 posts
    Member since:
    May 2014

    Posted 28 May 2014 in reply to Petya Link to this post

    I have 2014.1.224.40 version
  11. Petya
    Admin
    Petya avatar
    975 posts

    Posted 29 May 2014 Link to this post

    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.
     
  12. Nisarg
    Nisarg avatar
    25 posts
    Member since:
    Dec 2011

    Posted 14 Sep 2015 in reply to Petya Link to this post

    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
  13. Tanya
    Admin
    Tanya avatar
    405 posts

    Posted 17 Sep 2015 Link to this post

    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
Back to Top
UI for WPF is Visual Studio 2017 Ready