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

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

9 Answers 144 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Abdul
Top achievements
Rank 1
Abdul asked on 22 Jun 2017, 08:21 AM

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. 

9 Answers, 1 is accepted

Sort by
0
Abdul
Top achievements
Rank 1
answered on 22 Jun 2017, 12:42 PM

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)

 

 

 

0
Tanya
Telerik team
answered on 26 Jun 2017, 10:30 AM
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 you to write beautiful native mobile apps using a single shared C# codebase.
0
Abdul
Top achievements
Rank 1
answered on 29 Jun 2017, 07:40 AM

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.

0
Tanya
Telerik team
answered on 03 Jul 2017, 01:28 PM
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 you to write beautiful native mobile apps using a single shared C# codebase.
0
Abdul
Top achievements
Rank 1
answered on 11 Jul 2017, 06:58 AM

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.

0
Abdul
Top achievements
Rank 1
answered on 11 Jul 2017, 07:08 AM
[quote]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.

[/quote]

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.

0
Tanya
Telerik team
answered on 13 Jul 2017, 03:58 PM
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 you to write beautiful native mobile apps using a single shared C# codebase.
0
Sajid
Top achievements
Rank 1
answered on 04 Jan 2019, 06:15 AM

Hi,

We are facing the same issue on 2017.1.222.45. Let us know if we need to upgrade or it is supposed to be fixed in this version. Thank you

0
Tanya
Telerik team
answered on 08 Jan 2019, 01:23 PM
Hi Sajid,

The issue is fixed in version 2017.2.614 (R2 2017 SP1). I would suggest you to directly test the latest version of the control so you can take advantage of all the features and bug fixes which have been implemented. 

Regards,
Tanya
Progress Telerik
Get quickly and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
RichTextBox
Asked by
Abdul
Top achievements
Rank 1
Answers by
Abdul
Top achievements
Rank 1
Tanya
Telerik team
Sajid
Top achievements
Rank 1
Share this question
or