RadRickText box crashes when table is pasted from MS word to Table in RadRichTextBox

8 posts, 0 answers
  1. Abdul
    Abdul avatar
    7 posts
    Member since:
    Feb 2016

    Posted 22 Jun Link to this post

    We are using Telerik WPF controls Version 2015.3.1104.45
    In our application, RadRichTexbox is used to create templates.
    For a particular template, when we try to replace a table in RadRichTextBox from table in word by following these steps, radrichtextbox crashes our whole application

    Steps:
    * copy table from word document
    * select table in RadRichTexbox by highlighting it
    * Paste either by CTRL+V or by using right click context menu
    * Application will crash

    Detailed Exception StackTrace:

    Object reference not set to an instance of an object.

    Type: System.NullReferenceException:
    Source:Telerik.Windows.Documents
    Data: System.Object: 

    Stack Trace:    at Telerik.Windows.Documents.Layout.DocumentLayoutBox.UpdateChildIndexesDownToParagraph(LayoutBox layoutBox, HashSet`1 documentLists) in D:\Work\MISC tasks\DMS template window crash\Telerik.Windows.Documents\Documents\Layout\DocumentLayoutBox.cs:line 169
       at Telerik.Windows.Documents.Layout.DocumentLayoutBox.UpdateChildIndexesDownToParagraph(LayoutBox layoutBox, HashSet`1 documentLists) in D:\Work\MISC tasks\DMS template window crash\Telerik.Windows.Documents\Documents\Layout\DocumentLayoutBox.cs:line 182
       at Telerik.Windows.Documents.Layout.DocumentLayoutBox.UpdateChildIndexesDownToParagraph(LayoutBox layoutBox, HashSet`1 documentLists) in D:\Work\MISC tasks\DMS template window crash\Telerik.Windows.Documents\Documents\Layout\DocumentLayoutBox.cs:line 182
       at Telerik.Windows.Documents.Layout.DocumentLayoutBox.UpdateParagraphInListSorting() in D:\Work\MISC tasks\DMS template window crash\Telerik.Windows.Documents\Documents\Layout\DocumentLayoutBox.cs:line 157
       at Telerik.Windows.Documents.Layout.DocumentLayoutBox.MeasureOverrideInternal(SizeF availableSize) in D:\Work\MISC tasks\DMS template window crash\Telerik.Windows.Documents\Documents\Layout\DocumentLayoutBox.cs:line 129
       at Telerik.Windows.Documents.Layout.DocumentLayoutBox.MeasureOverride(SizeF availableSize) in D:\Work\MISC tasks\DMS template window crash\Telerik.Windows.Documents\Documents\Layout\DocumentLayoutBox.cs:line 117
       at Telerik.Windows.Documents.Layout.LayoutElement.MeasureCore(SizeF availableSize) in D:\Work\MISC tasks\DMS template window crash\Telerik.Windows.Documents\Documents\Layout\LayoutElement.cs:line 711
       at Telerik.Windows.Documents.Layout.LayoutElement.Measure(SizeF availableSize) in D:\Work\MISC tasks\DMS template window crash\Telerik.Windows.Documents\Documents\Layout\LayoutElement.cs:line 640
       at Telerik.Windows.Documents.Model.RadDocument.Measure(SizeF measureSize) in D:\Work\MISC tasks\DMS template window crash\Telerik.Windows.Documents\Documents\Model\RadDocument.cs:line 1447
       at Telerik.Windows.Documents.UI.DocumentPrintLayoutPresenter.MeasureOverride(Size availableSize) in D:\Work\MISC tasks\DMS template window crash\Telerik.Windows.Documents\Documents\UI\DocumentPrintLayoutPresenter.cs:line 476
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.ContextLayoutManager.UpdateLayout()
       at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
       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 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

       
    I have tried to resolve this by cancelling PasteCommand and writing my own logic in CommandExecuting Event

    void radRichTextBox_CommandExecuting(object sender, CommandExecutingEventArgs e)
    {
        if (e.Command is PasteCommand)
        {
            e.Cancel = true;
            try
            {
                this.txtMsgBody.Editor.Paste(); // this will throw exception in above mentioned test case
            }
            catch(Exception)
            {
                //Even this blank catch is not preventing application from crashing
            }
        }
    }
     
    void radRichTextBox_CommandError(object sender, CommandErrorEventArgs e)
    {
        e.Handled = true;     //e.Handled = true is not stopping exception propogation
        //TODO: add logging
    }

    I have also debugged this crash by generating symbols using DotPeek and found that many internal different exceptions are also occurring due to which regardless of the catch in the radRichTextBox_CommandExecuting the application crashed.
    Screen shots of which are attached

    Please provide a workaround or solution for this issue. Moreover, it would be helpful if you can suggest that upgrading the version will fix this. Thanks.

    Note: Our application is in production so upgrade will only be the last resort for us. 

  2. Abdul
    Abdul avatar
    7 posts
    Member since:
    Feb 2016

    Posted 22 Jun Link to this post

    Exception catched in catch block is 

    Object reference not set to an instance of an object.

    Type: System.NullReferenceException:
    Source:Telerik.Windows.Documents
    Data: System.Object: 

    Stack Trace:    at Telerik.Windows.Documents.Layout.LayoutBox.get_ValidParent()
       at Telerik.Windows.Documents.DocumentPosition.GetCurrentParagraphBox()
       at Telerik.Windows.Controls.RichTextBoxUI.RadRichTextBoxRulerController.GetCurrentParagraphBox()
       at Telerik.Windows.Controls.RichTextBoxUI.RadRichTextBoxRulerController.AssociatedRichTextBox_LayoutUpdated(Object sender, EventArgs e)
       at System.Windows.ContextLayoutManager.fireLayoutUpdateEvent()
       at System.Windows.ContextLayoutManager.UpdateLayout()
       at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
       at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
       at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
       at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
       at System.Windows.Media.MediaContext.AnimatedRenderMessageHandler(Object resizedCompositionTarget)
       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)

     

     

     

  3. Tanya
    Admin
    Tanya avatar
    577 posts

    Posted 26 Jun Link to this post

    Hello,

    I tested the scenario following the steps from the first post but couldn't reproduce an issue either in the version you mentioned or in the latest one. Could you please check whether you can reproduce the issue using our examples? If the issue is observable there as well, could you capture a video showing your steps? Any additional information on how we could replicate the behavior would be much appreciated.

    Regards,
    Tanya
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  4. Abdul
    Abdul avatar
    7 posts
    Member since:
    Feb 2016

    Posted 29 Jun Link to this post

    Please find link to sample project together with accompanying videos of the problematic scenarios.

    https://drive.google.com/file/d/0B8YQPUJNvwckSWp1ZWw3NEdQSUE/view?usp=sharing

    The demo is based on WPF controls Version 2015.3.1104.45.

    The CrashDemo.zip file contains the following:
    1) Videos (two cases with steps)
    2) Source (VS Project)
    3) header.docx

    Writing steps to reproduce issue demonstrated in Video:
    Case 1:
    1) Open CrashDemo.exe
    2) Proceed to 2nd Page of document 
    3) Copy using mouse
    4) Select text from header.docx file and copy Ctrl+C
    5) Paste in Control using Ctrl+V
    6) Crash

    Case 2:
    1) Open CrashDemo.exe
    2) Proceed to 2nd Page of document 
    3) Select header region text and delete using Delete button (Cursor is moved to the center of the previous page)
    4) Select text from header.docx file and copy using Ctrl+C
    5) Paste in Control using Ctrl+V
    6) Crash


    Let us know of any solution at the mentioned version. As already mentioned we are in production so upgrade would be as a last resort (patch on this version with back porting would be great etc.)

    Thanks.

  5. Tanya
    Admin
    Tanya avatar
    577 posts

    Posted 03 Jul Link to this post

    Hi,

    Thank you for the details. 

    I tested again but I am afraid I couldn't reproduce the issues although I strictly followed the steps. I am attaching videos showing the steps I performed. Please, check them and let me know if I am missing something.

    Regards,
    Tanya
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  6. Abdul
    Abdul avatar
    7 posts
    Member since:
    Feb 2016

    Posted 11 Jul Link to this post

    Hi,

    We have re-verified the issue at our end after observing the video you attached. The only difference in the video we sent and yours seems to be the office version. We retested with Word 2016 and it was the case. 

    Could you please perform the above mentioned steps on Word 2013 and let us know of the outcome.

     

    If the issue is reproduced a fix on the 2015.3.1104.45 version of telerik controls would be good.

     

    Thanks.

  7. Abdul
    Abdul avatar
    7 posts
    Member since:
    Feb 2016

    Posted 11 Jul in reply to Abdul Link to this post

    Abdul said:

    Hi,

    We have re-verified the issue at our end after observing the video you attached. The only difference in the video we sent and yours seems to be the office version. We retested with Word 2016 and it was the case. 

    Could you please perform the above mentioned steps on Word 2013 and let us know of the outcome.

     

    If the issue is reproduced a fix on the 2015.3.1104.45 version of telerik controls would be good.

     

    Thanks.

    P.S: As per the recommended approach its good it the verification with MS 2013 is done on a separate machine not having MS 2016.

  8. Tanya
    Admin
    Tanya avatar
    577 posts

    Posted 13 Jul Link to this post

    Hello Abdul,

    Indeed, using MS Word 2013 I was able to reproduce the error on my side as well. The issue is already fixed and, since we are unable to provide you with a fix for the version you are using, I would suggest you upgrade to the latest version of RadRichTextBox. 

    Hope this is helpful.

    Regards,
    Tanya
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top