We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

System.NullReferenceException randomly thrown when loading a document from stream

Hi, 

I use the control SfRichtextboxAdv to load documents from a stream. This works mostly perfect but after loading a few (often the third document) the control throws the following error:

Source: "Syncfusion.SfRichTextBoxAdv.WPF"
Message: "Object reference not set to an instance of an object."
Stacktrace:
"   at Syncfusion.Windows.Controls.RichTextBoxAdv.PageLayoutViewer.AddVisiblePage(PageAdv page, Double x, Double y, Boolean addAsInitial)" 
"   at Syncfusion.Windows.Controls.RichTextBoxAdv.PageLayoutViewer.UpdatePageToViewer(PageAdv page, Boolean updateViewerSize)" 
"   at Syncfusion.Windows.Controls.RichTextBoxAdv.LayoutViewer.RemovePage(PageAdv page)" 
"   at Syncfusion.Windows.Controls.RichTextBoxAdv.PageAdv.Dispose()" 
"   at Syncfusion.Windows.Controls.RichTextBoxAdv.BodyWidget.Dispose()" 
"   at Syncfusion.Windows.Controls.RichTextBoxAdv.ParagraphWidget.Dispose()" 
"   at Syncfusion.Windows.Controls.RichTextBoxAdv.BodyWidget.Dispose()" 
"   at Syncfusion.Windows.Controls.RichTextBoxAdv.SectionAdv.Dispose()" 
"   at Syncfusion.Windows.Controls.RichTextBoxAdv.DocumentAdv.Dispose()" 
"   at Syncfusion.Windows.Controls.RichTextBoxAdv.SfRichTextBoxAdv.OnDocumentChanged(DependencyPropertyChangedEventArgs e)" 
"   at Syncfusion.Windows.Controls.RichTextBoxAdv.SfRichTextBoxAdv.OnDocumentChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args)" 
"   at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)" 
"   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)" 
"   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)" 
"   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)" 
"   at System.Windows.DependencyObject.ClearValueCommon(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata)" 
"   at System.Windows.DependencyObject.ClearValue(DependencyProperty dp)" 
"   at Syncfusion.Windows.Controls.RichTextBoxAdv.DocumentAdv.Dispose()" 
"   at Syncfusion.Windows.Controls.RichTextBoxAdv.SfRichTextBoxAdv.InitDocumentLoad()" 
"   at Syncfusion.Windows.Controls.RichTextBoxAdv.SfRichTextBoxAdv.LoadInternal(Stream documentStream, FormatType formatType)" 
"   at Syncfusion.Windows.Controls.RichTextBoxAdv.SfRichTextBoxAdv.Load(Stream stream, FormatType formatType)" 

The control itself is embedded into an windows forms project using elementhost. Version of the control is 17.4460.0.39

Any idea what is causing this crash? Is it a bug or do I miss something? First time loading the doucment seems to work always but after the second or third time the chances are high to hit this issue. 

Thanks!


1 Reply

PS Premkumar Sundaramoorthy Syncfusion Team February 10, 2020 06:04 AM UTC

Hi Stefan, 

Thank you for using syncfusion products, 
We have tried to reproduce the reported issue in our control with windows forms application. But we couldn’t face any exception while loading the documents and we suspect this issue is an application and document specific. So, please share your application and input documents you are using. It will help us to provide you the appropriate solution at the earliest. 

Regards, 
Premkumar 


Loader.
Live Chat Icon For mobile
Up arrow icon