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

Editor Crashed with 2012 Q3 Release

6 Answers 85 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Tuo
Top achievements
Rank 1
Tuo asked on 19 Oct 2012, 08:39 PM
Hi Telerik,
   With the latest libraries of RichTextBox, there is exception triggered at DocumentPosition.Dispose.
   No exception is with Q2 2012, but it is with latest Q3 2012.
   As for the Q3 2012, the performance of input and deletion is improved a lot.
   Does the changes made for performance improvement lead to this error? 
   Could you help to check this issue? Thanks.
   In addition, the problem can be reproduced with the latest libs.
   (PS. Silverlight version: 5.0, Telerik:  2012.3.1017.1050)

Best,
Tuo

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
   The exception is as follows:
        Code: 4004    
        Category:   ManagedRuntimeError       
        Message:   System.ArgumentNullException: Value cannot be null.
                      at System.Threading.Monitor.ReliableEnter(Object obj, Boolean& lockTaken)
                      at System.Threading.Monitor.Enter(Object obj, Boolean& lockTaken)
                      at Telerik.Windows.Documents.DocumentPosition.Dispose()
                      at Telerik.Windows.Documents.DocumentPosition.Finalize() 
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    Since the sample project cannot be attached(zip file), some functions have been pasted here for your reference.
    The repeat steps: 1. Type some text(may use left hand keep typing), 2, click mouse left button(may use right hand click mouse), 3.    Repeat 1 & 2 very fast, then after couple of times, exception raised as above.
    
    Xaml file
    -------------------------------------------------------------------
     <UserControl x:Class="MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <telerik:RadRichTextBox Grid.Row="1" x:Name="editor" Margin="24 24 0 0" AllowDrop="True" Drop="editor_Drop"   ShowComments="True" />
        <telerik:DocumentRuler AssociatedRichTextBox="{Binding ElementName=editor, Mode=OneTime}" Grid.Row="1"/>
        <telerik:RadRichTextBoxStatusBar x:Name="statusbar" Grid.Row="2" AssociatedRichTextBox="{Binding ElementName=editor}"/>
    </Grid>
</UserControl>      

    Code behind file:(Just list the major functions)
    ---------------------------------------------------------------------------------------------------------
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
            this.editor.MouseLeftButtonUp += OnMouseLeftButtonUp;
            SetupDocument(this.editor.Document);
        }

        private void OnMouseLeftButtonUp(Object sender, RoutedEventArgs e)
        {
            RadDocument doc = new RadDocument();
            doc.MeasureAndArrangeInDefaultSize ();
            SetupDocument(doc);
            this.editor.Document = doc;
        }

        private void SetupDocument(RadDocument document)
        {        
            document.LayoutMode = DocumentLayoutMode.Paged;
            document.ParagraphDefaultSpacingAfter = 10;
            document.PageViewMargin = new SizeF(10, 10);
            document.SectionDefaultPageMargin = new Telerik.Windows.Documents.Layout.Padding(95);
        }
    }

6 Answers, 1 is accepted

Sort by
0
Tuo
Top achievements
Rank 1
answered on 22 Oct 2012, 09:56 PM
Hello Telerik,
         Have any chance to look into this issue? Thanks.
Best,
Tuo
0
Vasil
Telerik team
answered on 24 Oct 2012, 02:22 PM
Hello Tuo,

Thank you for contacting us regarding this.

With 2012 Q3 we made a lot of performance improvements of RadRichTextBox. One of it was to avoid all unnecessary invoking of the MeasureAndArrange() method. In your code (following the steps to reproduce) MeasureAndArrangeInDefaultSize() method is called too often, which is irregular.

Indeed your code causes a crash, but we are interested what is its end purpose? Could you please elaborate more on your scenario so we could direct you to the most appropriate way to achieve it?

Looking forward to your reply.

Kind regards,
Vasil
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Charles
Top achievements
Rank 1
answered on 25 Oct 2012, 11:05 AM
We are also having this issue with the WPF version of the control.  I'm struggling to create a test project that demonstrates what causes it to happen.

The finalizer is calling Dispose on a DocumentPosition (I have no idea what created this document position, or what it's used for), and throwing an exception because the readonly lockObject is null, which seems impossible.

Because it's the finalizer calling the Dispose method, it's near impossible to debug why this is happening.

For me, this occurs when just clicking around the document.  I have some CustomAnnotationRanges  and other custom bits and bobs, and I have no clue where to look for the cause.

Any insight appreciated.
0
Iva Toteva
Telerik team
answered on 25 Oct 2012, 01:26 PM
Hello Charles,

Thank you for sharing your observations as well.

We have managed to reproduce the problem and have logged it for revision. It is caused by the spell-checker which underlines the words asynchronously. We will try to fix it in an internal build soon.

Until then, you can disable spell-checking until we fix the issue in order to avoid the crash.

Please, excuse us for the inconvenience.

Greetings,
Iva Toteva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Cristiano
Top achievements
Rank 1
answered on 12 Mar 2013, 11:19 AM
Hi!

We too are having the exact same crash (same stack trace) within our application, although it's very difficult to reproduce the problem in debug mode (it was reported in production environment). The current events we have attached in the RadRichTextBox are PreviewTextInput, GotFocus and LostFocus. I would like to know if this issue is already fixed and, if true, in what specific version was it fixed, since our current release is not the latest one. We're currently in the 1328 release (late January).

Thanks.

Cristiano Machado
0
Iva Toteva
Telerik team
answered on 12 Mar 2013, 06:15 PM
Hi Christiano,

This issue was fixed in late November and was included in build 2012 1126 (November 26). Since then we have not observed any issues or had any reported.

Unfortunately, we don't know what may be causing the problem in your case and would need some additional details in order to reproduce the issue.

Regards,
Iva Toteva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
RichTextBox
Asked by
Tuo
Top achievements
Rank 1
Answers by
Tuo
Top achievements
Rank 1
Vasil
Telerik team
Charles
Top achievements
Rank 1
Iva Toteva
Telerik team
Cristiano
Top achievements
Rank 1
Share this question
or