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

Exception in RadBook

6 Answers 100 Views
Book
This is a migrated thread and some comments may be shown as answers.
Uwe
Top achievements
Rank 1
Uwe asked on 11 Sep 2013, 05:25 PM
Hello,

I am using a RadBook in kombination with the RadDataPager in my application. I added 55 pages from Word (.png) statically, like this:

        <telerik:RadDataPager x:Name="radDataPager1" Source="{Binding PagedItems, ElementName=book1}" Margin="-1000,585,168,0" VerticalAlignment="Top" Width="1464" HorizontalAlignment="Right" Grid.Column="1"  Grid.ColumnSpan="2" DisplayMode="All"  />
        <telerik:RadBook x:Name="book1" HardPages="None" FoldSize="300,150" Margin="-1000,142.5,168,0" RightPageIndex="55" Grid.ColumnSpan="2" HorizontalAlignment="Right" Width="1464" d:LayoutOverrides="GridBox" Height="443" VerticalAlignment="Top" Grid.Column="1">
            <telerik:RadBookItem>
                <Image Source="/FuelOPTBA20;component/Images/1.png"></Image>
            </telerik:RadBookItem>
            <telerik:RadBookItem>
                <Image Source="/FuelOPTBA20;component/Images/2.png"></Image>
            </telerik:RadBookItem>
            <telerik:RadBookItem>
                <Image Source="/FuelOPTBA20;component/Images/3.png"></Image>
            </telerik:RadBookItem>
                            .
                            .
                            .

                            .

            <telerik:RadBookItem>
                <Image Source="/FuelOPTBA20;component/Images/53.png"></Image>
            </telerik:RadBookItem>
            <telerik:RadBookItem>
                <Image Source="/FuelOPTBA20;component/Images/54.png"></Image>
            </telerik:RadBookItem>
            <telerik:RadBookItem>
                <Image Source="/FuelOPTBA20;component/Images/55.png"></Image>
            </telerik:RadBookItem>
        </telerik:RadBook>



when I start the application and press the << or >> button of the DataPager the program throws an null pointer exception:

System.NullReferenceException wurde nicht behandelt.
  HResult=-2147467261
  Message=Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
  Source=Telerik.Windows.Controls.Navigation
  StackTrace:
       bei Telerik.Windows.Controls.RadBook.OnCurrentSheetIndexChanged(Int32 newValue, Int32 oldValue) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Controls\Navigation\Book\RadBook.cs:Zeile 1302.
       bei Telerik.Windows.Controls.RadBook.set_CurrentSheetIndex(Int32 value) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Controls\Navigation\Book\RadBook.cs:Zeile 528.
       bei Telerik.Windows.Controls.RadBook.OnRightPageIndexChanged(Int32 rightPageIndex) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Controls\Navigation\Book\RadBook.cs:Zeile 2274.
       bei Telerik.Windows.Controls.RadBook.OnRightPageIndexPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Controls\Navigation\Book\RadBook.cs:Zeile 1195.
       bei System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       bei System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       bei System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
       bei System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
       bei System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
       bei System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
       bei Telerik.Windows.Controls.RadBook.set_RightPageIndex(Int32 value) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Controls\Navigation\Book\RadBook.cs:Zeile 353.
       bei Telerik.Windows.Controls.RadBook.NavigateToPage(PageToNavigateTo pageToNavigateTo) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Controls\Navigation\Book\RadBook.cs:Zeile 2240.
       bei Telerik.Windows.Controls.RadBook.FirstPage() in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Controls\Navigation\Book\RadBook.cs:Zeile 616.
       bei Telerik.Windows.Controls.Book.BookPagedCollectionView.MoveToFirstPage() in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Controls\Navigation\Book\BookPagedCollectionView.cs:Zeile 143.
       bei Telerik.Windows.Controls.Data.DataPager.DataPagerViewModel.MoveToFirstPage() in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Controls\Data\DataPager\DataPagerViewModel.cs:Zeile 183.
       bei Telerik.Windows.Controls.RadDataPager.<>c__DisplayClass1.<MoveToPage>b__0(Int32 i) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Controls\Data\DataPager\RadDataPager.cs:Zeile 940.
       bei Telerik.Windows.Controls.RadDataPager.MoveToPage(Int32 pageIndex, Func`2 pageMoveOperation) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Controls\Data\DataPager\RadDataPager.cs:Zeile 972.
       bei Telerik.Windows.Controls.RadDataPager.MoveToPage(Int32 pageIndex, Func`1 pageMoveOperation) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Controls\Data\DataPager\RadDataPager.cs:Zeile 940.
       bei Telerik.Windows.Controls.RadDataPager.MoveToFirstPage() in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Controls\Data\DataPager\RadDataPager.cs:Zeile 841.
       bei Telerik.Windows.Controls.RadDataPager.OnMoveToFirstPage(Object sender, ExecutedRoutedEventArgs e) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Controls\Data\DataPager\RadDataPager.Commands.cs:Zeile 52.
       bei System.Windows.Input.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
       bei System.Windows.Input.CommandManager.ExecuteCommandBinding(Object sender, ExecutedRoutedEventArgs e, CommandBinding commandBinding)
       bei System.Windows.Input.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
       bei System.Windows.Input.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
       bei System.Windows.Input.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
       bei System.Windows.UIElement.OnExecutedThunk(Object sender, ExecutedRoutedEventArgs e)
       bei System.Windows.Input.ExecutedRoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object target)
       bei System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       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 args, Boolean trusted)
       bei System.Windows.Input.RoutedCommand.ExecuteImpl(Object parameter, IInputElement target, Boolean userInitiated)
       bei System.Windows.Input.RoutedCommand.ExecuteCore(Object parameter, IInputElement target, Boolean userInitiated)
       bei MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
       bei System.Windows.Controls.Primitives.ButtonBase.OnClick()
       bei System.Windows.Controls.Button.OnClick()
       bei Telerik.Windows.Controls.RadButton.OnClick() in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Core\Controls\Buttons\RadButton.cs:Zeile 398.
       bei System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
       bei System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
       bei System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
       bei System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       bei System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       bei System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       bei System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
       bei System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
       bei System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
       bei System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       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.RaiseTrustedEvent(RoutedEventArgs args)
       bei System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
       bei System.Windows.Input.InputManager.ProcessStagingArea()
       bei System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
       bei System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
       bei System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
       bei System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       bei System.Windows.Interop.HwndSource.InputFilterMessage(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 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, 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.Threading.Dispatcher.Run()
       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 FuelOPTBA20.App.Main() in c:\Projects\GIT\FuelOPTBA20\FuelOPTBA20\obj\x86\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()
  InnerException: 


when I went step by step throw the pages (from end to beginning) it works, after this I can properly press the << and >> button. This works reliably traceable.

Greetings Uwe







6 Answers, 1 is accepted

Sort by
0
Uwe
Top achievements
Rank 1
answered on 11 Sep 2013, 05:37 PM
... oh the RightPageIndex of the RadBook seems to be wrong if it is set to be 1 it works. :-)
0
Stefan
Telerik team
answered on 16 Sep 2013, 02:14 PM
Hello Uwe,

Unfortunately I was not able to reproduce the described issue. Please examine the attache project, which I created using your code snippet and modify it in order to show us how to reproduce the exception.

Regards,
Stefan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Uwe
Top achievements
Rank 1
answered on 26 Sep 2013, 06:33 PM
Hello Stefan,

thank you very much, but I think it was my fault, for some reason the the RightPageIndex property had a nonsensical value.

Regards Uwe
0
Stefan
Telerik team
answered on 01 Oct 2013, 11:33 AM
Hi Uwe,

After further investigation on the issue I was able to reproduce it and I logged it. I noticed that in the attached project I sent to you if the RightPageIndex is between 0 and 7 there is no problem and the application works correctly. On the other hand if the RightPageIndex has value higher than 7 and you try to go to the first or last page, this page is null and a NullReferenceException is thrown .

I updated your telerik points as a gratitude for your cooperation. 

Regards,
Stefan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
ric
Top achievements
Rank 1
answered on 10 Oct 2013, 10:57 AM
I'm also getting a null reference exception when calling MoveToPage manually, seems to be when I call it with an "out of range" value. This is not helped by the fact that there's no reliable "PageCount" property of the editor or document as I'm trying to do a for loop. (I have to do ChildLayoutBoxes.Count!)
0
Yoan
Telerik team
answered on 15 Oct 2013, 11:41 AM
Hi ric,

Unfortunately, we were not able to reproduce the problem using the provided information. Will it be possible to share some more details on your scenario? A sample demonstrating the problem would be of great help. 

Thank you in advance!

Regards,
Yoan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
Book
Asked by
Uwe
Top achievements
Rank 1
Answers by
Uwe
Top achievements
Rank 1
Stefan
Telerik team
ric
Top achievements
Rank 1
Yoan
Telerik team
Share this question
or