Editor Crashed with 2012 Q3 Release

7 posts, 0 answers
  1. Tuo
    Tuo avatar
    20 posts
    Member since:
    Oct 2011

    Posted 19 Oct 2012 Link to this post

    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)


       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"
        d:DesignHeight="300" d:DesignWidth="400">

        <Grid x:Name="LayoutRoot" Background="White">
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
            <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}"/>

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

            private void OnMouseLeftButtonUp(Object sender, RoutedEventArgs e)
                RadDocument doc = new RadDocument();
                doc.MeasureAndArrangeInDefaultSize ();
                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);
  2. Tuo
    Tuo avatar
    20 posts
    Member since:
    Oct 2011

    Posted 22 Oct 2012 Link to this post

    Hello Telerik,
             Have any chance to look into this issue? Thanks.
  3. Vasil
    Vasil avatar
    124 posts

    Posted 24 Oct 2012 Link to this post

    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,
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  4. Charles
    Charles avatar
    41 posts
    Member since:
    Mar 2012

    Posted 25 Oct 2012 Link to this post

    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.
  5. Iva Toteva
    Iva Toteva avatar
    1319 posts

    Posted 25 Oct 2012 Link to this post

    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.

    Iva Toteva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. Cristiano
    Cristiano avatar
    13 posts
    Member since:
    Feb 2012

    Posted 12 Mar 2013 Link to this post


    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).


    Cristiano Machado
  7. Iva Toteva
    Iva Toteva avatar
    1319 posts

    Posted 12 Mar 2013 Link to this post

    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.

    Iva Toteva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top