ExpressionEditor NullReferenceException when typing

4 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#)

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

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

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

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

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

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

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

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

    Intermediate:
    (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,
    Dwight

  2. Martin
    Admin
    Martin avatar
    160 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.

    Regards,
    Martin Vatev
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. Manuela Dvorak
    Manuela Dvorak avatar
    2 posts
    Member since:
    Jan 2010

    Posted 20 Mar Link to this post

    Hi!

    My users get the same Exception in the same function. Some of them got it never ... some of them once per day ... I never got it in debug-mode. Is it possible to rewrite this function a little bit more defensive and throw a catchable Exception with more informations about the object which is null? It is very frustating that the App will be destroyed and nobody can tell me what to do to avoid that.

    Thx

    Manuela

  4. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    1037 posts

    Posted 25 Mar Link to this post

    Hi Manuela,

    Could you please clarify which version of the controls you're using as we recently fixed a similar issue?

    If you're using a version prior to 2018.2.813, would you find it possible to update to this version of the suite and see if the issue persists? If that is the case, please try isolating the exception in a small sample project so that I have the best chance of assisting you further.

    I will be looking forward to your reply.

    Regards,
    Dilyan Traykov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top