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

Object reference not set to an instance of an object

5 Answers 623 Views
PDFViewer
This is a migrated thread and some comments may be shown as answers.
Nisarg
Top achievements
Rank 1
Nisarg asked on 14 Sep 2015, 10:09 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()   

Regards,
Nisarg

5 Answers, 1 is accepted

Sort by
0
Tanya
Telerik team
answered on 17 Sep 2015, 07:23 AM
Hello Nisarg,

We are not aware of a similar issue and couldn't say what may cause it. It would help if you could provide us a sample project with your setup so we could reproduce the behavior on our end and check what may be the reason behind it.

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
0
Adam
Top achievements
Rank 1
answered on 18 Jan 2016, 03:36 PM

Dear Tanya,

  have created a little demo project to reproduce this behavior because m getting the same . I´m using the Version 2014.1.224.45 of your Controls.

you can download the Demo Project here:

*Edited by administrator*

the Exception is only thrown if open the control in a dialog like in the demo project and if the pdf Viewer control is on a hidden tab when close the dialog.

 

Steps:

1. Start the demo Project

2. Click the start Button

3. After Dialog opened select on the first tab a file from the grid

4. switch to the third "file preview" tab -> preview is shown in the pdfViewer control

5. switch back to the secound "some setting" tab and close the dialog

6. and there you go ... here is the Exception ;)

here is the StackTrace:
   bei Telerik.Windows.Controls.Input.FocusScope.FocusInternal()
   bei Telerik.Windows.Controls.Input.FocusScope.FocusNextElement()
   bei Telerik.Windows.Controls.Input.FocusScope.RemoveFocusableElement(Control element)
   bei Telerik.Windows.Controls.Input.FocusScope.FocusableElement_Unloaded(Object sender, RoutedEventArgs e)
   bei System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   bei System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   bei System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   bei System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
   bei System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
   bei System.Windows.BroadcastEventHelper.BroadcastUnloadedEvent(Object root)
   bei MS.Internal.LoadedOrUnloadedOperation.DoWork()
   bei System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
   bei System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   bei System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   bei System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   bei System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   bei System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   bei System.Windows.Threading.DispatcherOperation.InvokeImpl()
   bei System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   bei System.Windows.Threading.DispatcherOperation.Invoke()
   bei System.Windows.Threading.Dispatcher.ProcessQueue()
   bei System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   bei MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   bei MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   bei System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   bei System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   bei System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   bei MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   bei MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   bei System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   bei System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   bei System.Windows.Application.RunDispatcher(Object ignore)
   bei System.Windows.Application.RunInternal(Window window)
   bei System.Windows.Application.Run(Window window)
   bei System.Windows.Application.Run()
   bei TelerikPdfViewerExceptionDemo.App.Main() in c:\Users\anoga\Documents\Visual Studio 2013\Projects\TelerikPdfViewerExceptionDemo\TelerikPdfViewerExceptionDemo\obj\Debug\App.g.cs:Zeile 0.
   bei System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   bei System.Threading.ThreadHelper.ThreadStart()

0
Adam
Top achievements
Rank 1
answered on 21 Jan 2016, 11:23 AM

Dear Administrator,

why did you removed the download link to the demo project ? could you download the solution and reproduce my problem ?

Its really important to me if you could give me a short feedback to this issue.

Kind Regards

Adam

0
Tanya
Telerik team
answered on 21 Jan 2016, 12:54 PM
Hi Adam,

I tested the project and reproduced the issue you are experiencing. Fortunately, it is already fixed and the fix is available since Q3 2014. The only thing I could suggest you is to update the version of the controls you are using.

Your post was edited because I found that the project is uploaded along with the assemblies from our suite. We have a policy to avoid publishing the dev assemblies in publicly accessible sites as they are distributed with a license per developer seat.

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
0
Adam
Top achievements
Rank 1
answered on 21 Jan 2016, 01:21 PM

Hello Tanya,

thank you very much for your fast reply, we will try to update our Controls to the Q3 2014 Version in our next iteration.

 Best Regards

Adam

Tags
PDFViewer
Asked by
Nisarg
Top achievements
Rank 1
Answers by
Tanya
Telerik team
Adam
Top achievements
Rank 1
Share this question
or