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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

System.NullReferenceException randomly thrown when loading a document from stream

Thread ID:





151348 Feb 7,2020 11:07 AM UTC Feb 10,2020 06:04 AM UTC WPF 1
Tags: SfRichTextBoxAdv
Stefan Doerr
Asked On February 7, 2020 11:07 AM UTC


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


Premkumar Sundaramoorthy [Syncfusion]
Replied On 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. 



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon