Need More Info
Last Updated: 30 Apr 2026 20:14 by Daniel
Daniel
Created on: 10 Apr 2026 15:25
Category: UI for WPF
Type: Bug Report
0
System.NullReferenceException: Object reference not set to an instance of an object. at Telerik.Windows.Documents.UI.DocumentPresenterBase.CaretPosition_PositionChanged(Object sender, EventArgs e)

Since the last update, we receive often the following exception from our users log. I don't know exactly how to reproduce, but I know that when it happens, the user tries to click anywhere in the document and each time the exception is thrown. The users need to close and reopen the document to make it work again.

System.NullReferenceException: Object reference not set to an instance of an object. at Telerik.Windows.Documents.UI.DocumentPresenterBase.CaretPosition_PositionChanged(Object sender, EventArgs e) at Telerik.Windows.Documents.DocumentPosition.MoveToPosition(DocumentPosition newPosition) at Telerik.Windows.Documents.Selection.MouseSelectionHandler.UpdateSelectionAndCaretPosition() at Telerik.Windows.Documents.Selection.MouseSelectionHandler.RegisterDocumentMouseMove(Point position, SourceType source) at Telerik.Windows.Documents.UI.DocumentPresenterBase.HandleMouseMoveOnPosition(Point position, SourceType source) at Telerik.Windows.Documents.UI.DocumentPresenterBase.Owner_MouseMove(Object sender, MouseEventArgs e) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.Input.InputManager.ProcessStagingArea() at System.Windows.Input.MouseDevice.Synchronize() at System.Windows.Input.MouseDevice.PostProcessInput(Object sender, ProcessInputEventArgs e) at System.Windows.Input.InputManager.ProcessStagingArea() at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel) at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at System.Windows.Interop.HwndSource.InputFilterMessage(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 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

We also had this case when we try programatically to move the caret (seems to be the same end result exception):

System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.Windows.Documents.UI.DocumentPresenterBase.CaretPosition_PositionChanged(Object sender, EventArgs e)
   at Telerik.Windows.Documents.DocumentPosition.MoveToDocumentStart()
   at Telerik.Windows.Documents.DocumentPosition.MoveToFirstPositionInDocument()

12 comments
Daniel
Posted on: 30 Apr 2026 20:14

Here's another trace related to DocumentPosition.

On  editor.Document.GetAllRevisions();

System.​InvalidOperationException: Failed to compare two elements in the array.​
---> System.​NullReferenceException: Object reference not set to an instance of an object.​
   at Telerik.​Windows.​Documents.​DocumentPosition.​.​ctor(RadDocument document) in D:\a\1\s\Controls\RichTextBox\Core\DocumentPosition\DocumentPosition.​cs:line 111
   at Telerik.​Windows.​Documents.​Model.​Revisions.​Revision.​CalculateSelectionRange() in D:\a\1\s\Controls\RichTextBox\Core\Model\Revisions\Revision.​cs:line 209
   at Telerik.​Windows.​Documents.​Model.​Revisions.​RevisionCollection.​RevisionComparison(Revision r1, Revision r2) in D:\a\1\s\Controls\RichTextBox\Core\Model\Revisions\RevisionCollection.​cs:line 293
   at System.​Collections.​Generic.​ArraySortHelper`1.​InsertionSort(Span`1 keys, Comparison`1 comparer)
   at System.​Collections.​Generic.​ArraySortHelper`1.​IntroSort(Span`1 keys, Int32 depthLimit, Comparison`1 comparer)
   at System.​Collections.​Generic.​ArraySortHelper`1.​Sort(Span`1 keys, Comparison`1 comparer)
   --- End of inner exception stack trace ---
   at System.​Collections.​Generic.​ArraySortHelper`1.​Sort(Span`1 keys, Comparison`1 comparer)
   at Telerik.​Windows.​Documents.​Model.​Revisions.​RevisionCollection.​Recalculate() in D:\a\1\s\Controls\RichTextBox\Core\Model\Revisions\RevisionCollection.​cs:line 62
   at WorkingPaperSystem.​Controls.​RichText.​ConvertRadToDocx(RichTextEditWindow richTextEditWindow) in E:\Projects2\Composer Suite\Working Paper System\Composer-WPF\Controls\RichText.​xaml.​cs:line 796


Daniel
Posted on: 29 Apr 2026 16:27
I was expecting that you could tell me what could be NULL at line 1063 of DocumentPresenterBase.​cs, to orient my tests? I still don't know how to reproduce. In one case, the user told me that he was trying to adjust column width in a table and row height.
ADMIN
Nadya | Tech Support Engineer
Posted on: 28 Apr 2026 10:54

Hello, Daniel,

I still can not reproduce the issue according to the stack trace. I even tried with 2026.1.415, but to no avail. What comes to my mind is to test the same steps in some of our WPF Demo examples. In case you can replicate the issue there, I could be able to investigate the case further. 

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Daniel
Posted on: 23 Apr 2026 13:23
By the way: version 2026.1.415
Daniel
Posted on: 23 Apr 2026 13:20

With the .pdb, I've got the lines of the errors (still don't know how to reproduce, if you have an idea based on the trace ??):

 

System.​NullReferenceException: Object reference not set to an instance of an object.​

   at Telerik.​Windows.​Documents.​UI.​DocumentPresenterBase.​CaretPosition_​PositionChanged(Object sender, EventArgs e) in D:\a\1\s\Controls\RichTextBox\Core\UI\DocumentPresenterBase.​cs:line 1063

   at Telerik.​Windows.​Documents.​DocumentPosition.​MoveToPosition(DocumentPosition newPosition) in D:\a\1\s\Controls\RichTextBox\Core\DocumentPosition\DocumentPosition.​cs:line 1856
   at Telerik.​Windows.​Documents.​Selection.​MouseSelectionHandler.​UpdateSelectionAndCaretPosition() in D:\a\1\s\Controls\RichTextBox\Core\Selection\MouseSelectionHandler.​cs:line 691
   at Telerik.​Windows.​Documents.​Selection.​MouseSelectionHandler.​RegisterDocumentMouseMove(Point position, SourceType source) in D:\a\1\s\Controls\RichTextBox\Core\Selection\MouseSelectionHandler.​cs:line 417
   at Telerik.​Windows.​Documents.​UI.​DocumentPresenterBase.​HandleMouseMoveOnPosition(Point position, SourceType source) in D:\a\1\s\Controls\RichTextBox\Core\UI\DocumentPresenterBase.​cs:line 734
   at Telerik.​Windows.​Documents.​UI.​DocumentPresenterBase.​Owner_​MouseMove(Object sender, MouseEventArgs e) in D:\a\1\s\Controls\RichTextBox\Core\UI\DocumentPresenterBase.​cs:line 729
   at System.​Windows.​EventRoute.​InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.​Windows.​UIElement.​RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.​Windows.​Input.​InputManager.​ProcessStagingArea()
   at System.​Windows.​Interop.​HwndMouseInputProvider.​ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.​Windows.​Interop.​HwndMouseInputProvider.​FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.​Windows.​Interop.​HwndSource.​InputFilterMessage(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 System.​Windows.​Threading.​ExceptionWrapper.​InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.​Windows.​Threading.​ExceptionWrapper.​TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
ADMIN
Nadya | Tech Support Engineer
Posted on: 20 Apr 2026 06:08

Hi, Daniel,

Yes, use  Telerik.Windows.Documents.Core.pdb and Telerik.Windows.Controls.RichTextBox.pdb.

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Daniel
Posted on: 17 Apr 2026 16:38
I'm using Binaries.NoXaml\WPF80. Do you mean Telerik.Windows.Documents.Core.pdb and Telerik.Windows.Controls.RichTextBox.pdb?
ADMIN
Nadya | Tech Support Engineer
Posted on: 17 Apr 2026 11:19

Hello, Daniel,

In 2026 Q1 there aren't breaking changes in RichTextBox, only several bug fixes: Telerik UI for WPF - Telerik UI for WPF 2026.1.211 (2026 Q1)

To debug and get the exception line in DocumentPresenterBase.CaretPosition_PositionChanged, you need the PDB file for the Documents which is in Telerik.Windows.Documents assembly. So, you need the Telerik.Windows.Documents.pdb.

Also, If the call stack also crosses into the UI layer (RichTextBox), you'd additionally need Telerik.Windows.Controls.RichTextBoxUI.pdb.

  • Telerik.Windows.Documents.dll → Telerik.Windows.Documents.pdb
  • Telerik.Windows.Controls.RichTextBoxUI.dll(UI layer) → Telerik.Windows.Controls.RichTextBoxUI.pdb

These two are the main according to this exception. However, if needed, you can check the other assemblies here needed by RichTextBox in different scenarios and add the respective .pdb files for your case. 

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Daniel
Posted on: 15 Apr 2026 16:11

Thanks for the info.

Any breaking changes in 2026? The problem started after first 2026 update.

I don't want to publish all the .PDB since it will make the application too big. Any minimal ones to include to get the exception line in Telerik.Windows.Documents.UI.DocumentPresenterBase.CaretPosition_PositionChanged?

ADMIN
Nadya | Tech Support Engineer
Posted on: 15 Apr 2026 13:46

Hello, Daniel,

You can check the breaking changes in the RichTextBox component we have made recently here: https://www.telerik.com/products/wpf/documentation/controls/radrichtextbox/breaking-changes 

However, to address a specific issue, we first need to be able to reproduce it locally. That’s why your help in replicating the problem would be greatly appreciated. Thank you in advance for your understanding on that matter. 

That PDB files can be found on your account download page. The zip file containing these files should be named like this: Telerik_UI_for_WPF_(version)_Dev_PDBs.zip. 

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Daniel
Posted on: 13 Apr 2026 15:25

We have users everywhere in the world in different time zone so I'm not able to get in touch with them right away in order to know how to reproduce the problem. I was hoping that you could give me so guidance on what I could try to reproduce the problem based on the CaretPosition_PositionChanged code where object can be null and also on what has changed in the richtexteditor since last version. On our side, nothing changed on the way we use the editor. 

Is it possible to get a .pdb file that we can deploy with your DLLs to at least get the line of the "object reference no set to an instance of an object"?

Meanwhile, I'll try to reproduce in debug, but it will help to know what to try that could affect the caret position.

ADMIN
Nadya | Tech Support Engineer
Posted on: 13 Apr 2026 14:12

Hello, Daniel,

Thank you for contacting us!

It seems you began encountering an issue with the RadRichTextBox component after a recent update. While the stack trace you shared is valuable, it isn’t sufficient for me to reproduce the problem on my end.

Would you be able to provide a sample project that reflects your setup, along with steps to reproduce the issue locally? Do you have any custom code on your side, or can the issue be easily reproduced in a clean environment? If yes, can you share the exact steps to reproduce?  Without being able to replicate the behavior, it’s difficult to determine the root cause. Any details that help recreate the exact scenario would be greatly appreciated in investigating further the undesired behavior. 

Looking forward to your reply. 

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.