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.