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

Null reference exception in XamlFormatProvider Export

0 Answers 109 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Saee
Top achievements
Rank 1
Saee asked on 27 Jul 2012, 10:05 PM

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

No answers yet. Maybe you can help?

Tags
RichTextBox
Asked by
Saee
Top achievements
Rank 1
Share this question
or