Null reference exception in XamlFormatProvider Export

1 posts, 0 answers
  1. Saee
    Saee avatar
    1 posts
    Member since:
    Jul 2012

    Posted 27 Jul 2012 Link to this post

    <editing some contents>
    I’ve been getting this weird exception in my Silverlight app which uses Telerik controls and I’ve spent considerable time to resolve this without any success.

    I’ve tabbed control, both tabs have one RadRichTextBox control each. When I change text into one rich text, I do bunch of changes (adding new text, removing some text etc.) in other rich text control on the other tab. When trying to get the XAML after editing the document, I get following error upon xamlProvider.Export

     

    {System.NullReferenceException: Object reference not set to an instance of an object.

        at Telerik.Windows.Documents.Model.RadDocument.ReindexAnnotationMarkers()

        at Telerik.Windows.Documents.FormatProviders.Xaml.XamlFormatProvider.Export(RadDocument document)

        at Portal.StudUtil.GetXamlTextFromRichTextControl(RadRichTextBox richTextBox)}

        at Telerik.Windows.Documents.Model.RadDocument.ReindexAnnotationMarkers()

        at Telerik.Windows.Documents.FormatProviders.Xaml.XamlFormatProvider.Export(RadDocument document)

     Here’s what function does

    public static string ProcessChanges(RadRichTextBox radRichTextControlSource, RadRichTextBox radRichTextControlDestination)

             {

                 //make changes to destination doc

                 PerformChanges(radRichTextControlSource.Document, radRichTextControlDestination.Document);

                 //update layout

                 radRichTextControlDestination.UpdateEditorLayout();

     

                //send new XAML for further processing

                 XamlFormatProvider xamlProvider = new XamlFormatProvider();
                // ERROR

                 return xamlProvider.Export(radRichTextControlDestination.Document);

             }

     I’m guessing the rendering of the rich text control upon changes after UpdateEditorLayout are not being realized completely. Any help would be really appreciated. My Telerik Control version is 2011.1.315.1040 .

Back to Top