Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

WPF Viewer 13.0.4 to 13.0.5 Differences

When updating a WPF project from 13.0.4 to 13.0.5, I get an error.  My project doesn't show up in the stack dump, and I make no changes to the project other than the version of Crystal that it is installed with.  The error shows up on a clean machine using Win XP and Win 7.

Before I show the error, I would like to list a few questions:

  • Can this be confirmed as a bug, or am I doing something wrong?
  • If this is a bug, is there a way to remove 13.0.5 and reinstall 13.0.4?  (It seems like once 13.0.5 is installed, I can't go back and repair the machine)

Code that Causes the Crash

The last line of this sequence worked in 13.0.4, but indirectly causes the crash in 13.0.5:

var reportSource = this.CrystalReportsViewerMain.ViewerCore.ReportSource as CrystalDecisions.CrystalReports.Engine.ReportDocument;

//...modify reportSource

this.CrystalReportsViewerMain.ViewerCore.ReportSource = reportSource;

The Error Message

Object reference not set to an instance of an object.

The Error Message Location

Void UserControl_IsVisibleChanged(System.Object, System.Windows.DependencyPropertyChangedEventArgs)

The Stack Dump

Note, the stack dump doesn't contain a reference to my software.  This happens when the visibility changes when resetting the report source.

at SAPBusinessObjects.WPF.Viewer.DocumentView.UserControl_IsVisibleChanged(Object sender, DependencyPropertyChangedEventArgs e)

  at System.Windows.UIElement.RaiseDependencyPropertyChanged(EventPrivateKey key, DependencyPropertyChangedEventArgs args)

  at System.Windows.UIElement.OnIsVisibleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)

  at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)

  at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)

  at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)

  at System.Windows.UIElement.UpdateIsVisibleCache()

  at System.Windows.UIElement.SynchronizeForceInheritProperties(UIElement uiElement, ContentElement contentElement, UIElement3D uiElement3D, DependencyObject parent)

  at System.Windows.UIElement.OnVisualParentChanged(DependencyObject oldParent)

  at System.Windows.FrameworkElement.OnVisualParentChanged(DependencyObject oldParent)

  at System.Windows.Media.Visual.FireOnVisualParentChanged(DependencyObject oldParent)

  at System.Windows.Media.Visual.RemoveVisualChild(Visual child)

  at System.Windows.FrameworkElement.set_TemplateChild(UIElement value)

  at System.Windows.StyleHelper.ClearGeneratedSubTree(HybridDictionary[] instanceData, FrameworkElement feContainer, FrameworkContentElement fceContainer, FrameworkTemplate oldFrameworkTemplate)

  at System.Windows.StyleHelper.DoTemplateInvalidations(FrameworkElement feContainer, FrameworkTemplate oldFrameworkTemplate)

  at System.Windows.Controls.ContentPresenter.OnTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)

  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.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)

  at System.Windows.Controls.ContentPresenter.OnContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)

  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.InvalidateProperty(DependencyProperty dp)

  at System.Windows.StyleHelper.InvalidateDependents(Style ownerStyle, FrameworkTemplate frameworkTemplate, DependencyObject container, DependencyProperty dp, FrugalStructList`1& dependents, Boolean invalidateOnlyContainer)

  at System.Windows.StyleHelper.OnTriggerSourcePropertyInvalidated(Style ownerStyle, FrameworkTemplate frameworkTemplate, DependencyObject container, DependencyProperty dp, DependencyPropertyChangedEventArgs changedArgs, Boolean invalidateOnlyContainer, FrugalStructList`1& triggerSourceRecordFromChildIndex, FrugalMap& propertyTriggersWithActions, Int32 sourceChildIndex)

  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.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)

  at System.Windows.DependencyObject.SetValue(DependencyPropertyKey key, Object value)

  at System.Windows.Controls.TabControl.UpdateSelectedContent()

  at System.Windows.Controls.TabControl.OnGeneratorStatusChanged(Object sender, EventArgs e)

  at System.EventHandler.Invoke(Object sender, EventArgs e)

  at System.Windows.Controls.ItemContainerGenerator.SetStatus(GeneratorStatus value)

  at System.Windows.Controls.ItemContainerGenerator.Generator.System.IDisposable.Dispose()

  at System.Windows.Controls.Panel.GenerateChildren()

  at System.Windows.Controls.Panel.OnItemsChangedInternal(Object sender, ItemsChangedEventArgs args)

  at System.Windows.Controls.Panel.OnItemsChanged(Object sender, ItemsChangedEventArgs args)

  at System.Windows.Controls.ItemContainerGenerator.OnRefresh()

  at System.Windows.Controls.ItemContainerGenerator.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)

  at System.Windows.Controls.ItemContainerGenerator.System.Windows.IWeakEventListener.ReceiveWeakEvent(Type managerType, Object sender, EventArgs e)

  at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list)

  at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)

  at System.Collections.Specialized.CollectionChangedEventManager.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)

  at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)

  at System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)

  at System.Windows.Controls.ItemCollection.System.Windows.IWeakEventListener.ReceiveWeakEvent(Type managerType, Object sender, EventArgs e)

  at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list)

  at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)

  at System.Collections.Specialized.CollectionChangedEventManager.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)

  at System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)

  at System.Windows.Data.ListCollectionView.RefreshOverride()

  at System.Windows.Data.CollectionView.RefreshOrDefer()

  at System.Windows.Data.ListCollectionView.ProcessCollectionChanged(NotifyCollectionChangedEventArgs args)

  at System.Windows.Data.CollectionView.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)

  at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)

  at System.Collections.ObjectModel.ObservableCollection`1.ClearItems()

  at System.Collections.ObjectModel.Collection`1.Clear()

  at SAPBusinessObjects.WPF.Viewer.ReportAlbum.SetMainDoc(MainReportDocument mainDoc)

  at SAPBusinessObjects.WPF.Viewer.ViewerCore.OnLoadingComplete(Boolean bSuccess)

  at SAPBusinessObjects.WPF.Viewer.DelegateMarshaler.<>c__DisplayClass6`1.<Invoke>b__4(Object )

  at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)

  at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

Tags:
Former Member
Former Member replied

I've had this same issue - they seem to be disposing a tooltip and setting it to null, which causes this error. You're not going to like this (I didn't either) but the best work-around I could find was:

                    _viewer.Visibility = Visibility.Collapsed;

                    _viewer.ViewerCore.ReportSource = _reportSource;

                    FieldInfo tooltipField = typeof(DocumentView).GetField("m_tooltip", BindingFlags.Instance | BindingFlags.NonPublic);

                    if (tooltipField != null)

                    {

                        FieldInfo reportAlbumField = typeof(ViewerCore).GetField("reportAlbum", BindingFlags.Instance | BindingFlags.NonPublic);

                        if (reportAlbumField != null)

                        {

                            DocumentView currentView = ((ReportAlbum)reportAlbumField.GetValue(_viewer.ViewerCore)).ReportViews[0];

                            if (tooltipField.GetValue(currentView) == null)

                                tooltipField.SetValue(currentView, new System.Windows.Controls.ToolTip());

                        }

                    }

                    _viewer.Visibility = Visibility.Visible;

Where '_viewer' is the WPF Crystal Reports viewer. I'm effectively re-creating the disposed tool tip. The only other work-around was to always re-create the viewer, but that didn't perform as well.

1 View this answer in context
Not what you were looking for? View more on this topic or Ask a question