ExpressionEditor NullReferenceException when typing

2 posts, 0 answers
  1. Dwight
    Dwight avatar
    1 posts
    Member since:
    Apr 2016

    Posted 12 May 2016 Link to this post

    Dear all,


    I'm using an expression editor bound against an object which is constructed via emit IL at runtime due to localizing the fields, we're using version 2014.3.1305.40.
    A user now reports that he gets a null ref exception when changing an expression involving datetimes, the following stacktrace is available:
    Top-level Exception
    Type:        System.NullReferenceException
    Message:     Object reference not set to an instance of an object
    Source:      Telerik.Windows.Documents
    Stack Trace:
       at Telerik.Windows.Documents.HierarchicalIndex.GetBoxByHierarchicalIndex(DocumentLayoutBox documentBox, HierarchicalIndex hierarchicalIndex) in c:\TB\534\Sources\Documents\Flow\Core\DocumentPosition\HierarchicalIndex.cs:line 131
       at Telerik.Windows.Documents.DocumentPosition.RestorePositionFromBoxIndex(Nullable`1 raiseEvent) in c:\TB\534\Sources\Documents\Flow\Core\DocumentPosition\DocumentPosition.cs:line 447
       at Telerik.Windows.Documents.Model.RadDocumentEditor.InsertTextInternal(String text, Span currentSpanStyle, Boolean explicitAcceptsReturn) in c:\TB\534\Sources\Documents\Flow\Core\Model\RadDocumentEditor_Editing.cs:line 2104
       at Telerik.Windows.Documents.Model.RadDocumentEditor.InsertFromUI(String text, Span currentSpanStyle, Boolean acceptsReturn) in c:\TB\534\Sources\Documents\Flow\Core\Model\RadDocumentEditor_Editing.cs:line 2072
       at Telerik.Windows.Controls.RadRichTextBox.Telerik.Windows.Documents.UI.ITextInputCommandsHandler.InsertText(String text) in c:\TB\534\Sources\Documents\Flow\Core\UI\RadRichTextBox.cs:line 7599
       at Telerik.Windows.Documents.UI.CaretTextInputHandler.InsertText(String text) in c:\TB\534\Sources\Documents\Flow\Core\UI\Caret\CaretTextInputHandler.cs:line 344
       at Telerik.Windows.Documents.UI.CaretTextInputHandler.HandleTextInsertedWithoutIme(RadDocument document, String text) in c:\TB\534\Sources\Documents\Flow\Core\UI\Caret\CaretTextInputHandler.cs:line 171
       at Telerik.Windows.Documents.UI.CaretTextInputHandler.CaretUI_TextInserted(Object sender, TextInsertedEventArgs e) in c:\TB\534\Sources\Documents\Flow\Core\UI\Caret\CaretTextInputHandler.cs:line 90
       at Telerik.Windows.Documents.UI.Caret.OnTextInserted(Object sender, TextInsertedEventArgs e) in c:\TB\534\Sources\Documents\Flow\Core\UI\Caret\Caret_Common.cs:line 278
       at Telerik.Windows.Documents.UI.Caret.Timer_Tick(Object sender, EventArgs e) in c:\TB\534\Sources\Documents\Flow\Core\UI\Caret\Caret_Common.cs:line 259
       at System.Windows.Threading.DispatcherTimer.FireTick(Object unused)
       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)

    Could you please provide some insights? I'm not able to reproduce the problem on my machine (only once) and fear that it might be a "race condition" involving events in the UI. What I can tell is that it happens when adjusting the date and time part of the expression according to the user, I've seen it multiple times live on screen and was able to invoke it once on my machine. The steps he did were these, he always positions the cursor by using the mouse after the value to change and uses backspace to remove the number and then types the new number, eg position after first 1 in 11, remove the first 1 by using backspace and then typing 0:

    Expression at start, via binding:
    (Fromdate >= #11/05/2016 06:00:00# And Todate <= #12/05/2016 06:00:00#)

    (Fromdate >= #1/05/2016 06:00:00# And Todate <= #12/05/2016 06:00:00#)

    (Fromdate >= #01/05/2016 06:00:00# And Todate <= #12/05/2016 06:00:00#)

    (Fromdate >= #01/0/2016 06:00:00# And Todate <= #12/05/2016 06:00:00#)

    (Fromdate >= #01/04/2016 06:00:00# And Todate <= #12/05/2016 06:00:00#)

    (Fromdate >= #01/04/2016 6:00:00# And Todate <= #12/05/2016 06:00:00#)

    (Fromdate >= #01/05/2016 16:00:00# And Todate <= #12/05/2016 06:00:00#)

    (Fromdate >= #01/05/2016 06:00:00# And Todate <= #2/05/2016 06:00:00#)

    (Fromdate >= #01/05/2016 06:00:00# And Todate <= #02/05/2016 06:00:00#)

    (Fromdate >= #01/05/2016 06:00:00# And Todate <= #02/0/2016 06:00:00#)

    Changing May to April invokes the exception when typing the 4:
    (Fromdate >= #01/05/2016 06:00:00# And Todate <= #12/04/2016 06:00:00#)


    Hope you can help me out with this one since it's bugging the user for quite some time now.


    Kind regards,

  2. Martin Vatev
    Martin Vatev avatar
    143 posts

    Posted 17 May 2016 Link to this post

    Hello Dwight,

    I tried to reproduce the issue with the described steps on my side but, unfortunately, was not able to do so. If I do not reproduce the problem on my side it will be difficult for me to help you. Attached you can find the project I used for the test. Could you please give it a try and let me know in case I am missing something. If possible, could you modify it, so that it demonstrates the unexpected behavior, open a support ticket and send it back to me?
    Thank you in advance for your cooperation.

    Martin Vatev
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top