I’m using MVVM pattern in a wpf application, when I close a window that contains a video player.
i got the following exception
at VideoOS.UI.Common.WPF.VideoPlayer.Control.UI.ImageOverlay.ImageOverlayContainer.ImageOverlayContainer_OnDataContextChanged(Object sender, DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.RaiseDependencyPropertyChanged(EventPrivateKey key, DependencyPropertyChangedEventArgs args)
at System.Windows.FrameworkElement.OnDataContextChanged(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.TreeWalkHelper.InvalidateTreeDependentProperty(TreeChangeInfo info, DependencyObject d, FrameworkObject& fo, DependencyProperty dp, FrameworkPropertyMetadata fMetadata, Style selfStyle, Style selfThemeStyle, ChildRecord& childRecord, Boolean isChildRecordValid, Boolean hasStyleChanged, Boolean isSelfInheritanceParent, Boolean wasSelfInheritanceParent)
at System.Windows.TreeWalkHelper.InvalidateTreeDependentProperties(TreeChangeInfo info, FrameworkElement fe, FrameworkContentElement fce, Style selfStyle, Style selfThemeStyle, ChildRecord& childRecord, Boolean isChildRecordValid, Boolean hasStyleChanged, Boolean isSelfInheritanceParent, Boolean wasSelfInheritanceParent)
at System.Windows.FrameworkElement.InvalidateTreeDependentProperties(TreeChangeInfo parentTreeState, Boolean isSelfInheritanceParent, Boolean wasSelfInheritanceParent)
at System.Windows.FrameworkElement.OnAncestorChangedInternal(TreeChangeInfo parentTreeState)
at System.Windows.TreeWalkHelper.OnAncestorChanged(DependencyObject d, TreeChangeInfo info, Boolean visitedViaVisualTree)
at System.Windows.DescendentsWalker`1._VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
at MS.Internal.PrePostDescendentsWalker`1._VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
at System.Windows.DescendentsWalker`1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren)
at System.Windows.DescendentsWalker`1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren)
at System.Windows.DescendentsWalker`1.IterateChildren(DependencyObject d)
at System.Windows.DescendentsWalker`1._VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
at MS.Internal.PrePostDescendentsWalker`1._VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
at System.Windows.DescendentsWalker`1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren)
at System.Windows.DescendentsWalker`1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren)
at System.Windows.DescendentsWalker`1.IterateChildren(DependencyObject d)
at System.Windows.DescendentsWalker`1.StartWalk(DependencyObject startNode, Boolean skipStartNode)
at MS.Internal.PrePostDescendentsWalker`1.StartWalk(DependencyObject startNode, Boolean skipStartNode)
at System.Windows.TreeWalkHelper.InvalidateOnTreeChange(FrameworkElement fe, FrameworkContentElement fce, DependencyObject parent, Boolean isAddOperation)
at System.Windows.FrameworkElement.ChangeLogicalParent(DependencyObject newParent)
at System.Windows.FrameworkElement.RemoveLogicalChild(Object child)
at System.Windows.Controls.ContentControl.OnContentChanged(Object oldContent, Object newContent)
at System.Windows.Controls.ContentControl.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.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
at Telerik.Windows.Controls.RadTileView.ClearUserControls(RadTileViewItem container)
at Telerik.Windows.Controls.RadTileView.ClearContainerForItemOverride(DependencyObject element, Object item)
at System.Windows.Controls.ItemsControl.MS.Internal.Controls.IGeneratorHost.ClearContainerForItem(DependencyObject container, Object item)
at System.Windows.Controls.ItemContainerGenerator.UnlinkContainerFromItem(DependencyObject container, Object item, IGeneratorHost host)
at System.Windows.Controls.ItemContainerGenerator.RemoveAllInternal(Boolean saveRecycleQueue)
at System.Windows.Controls.ItemContainerGenerator.OnRefresh()
at System.Windows.Controls.ItemContainerGenerator.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
at System.Windows.WeakEventManager.ListenerList`1.DeliverEvent(Object sender, EventArgs e, Type managerType)
at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)
at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
at System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
at System.Windows.WeakEventManager.ListenerList`1.DeliverEvent(Object sender, EventArgs e, Type managerType)
at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)
at System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
at System.Windows.Data.ListCollectionView.RefreshOverride()
at System.Windows.Data.CollectionView.RefreshInternal()
at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
at Catel.Collections.FastObservableCollection`1.<>c__DisplayClass32_0.b__0() in [C:\CI_WS\Ws\113423\Source\Catel\src\Catel.MVVM\Collections\FastObservableCollection.cs](file:C:/CI_WS/Ws/113423/Source/Catel/src/Catel.MVVM/Collections/FastObservableCollection.cs):line 458
at Catel.Windows.Threading.DispatcherExtensions.BeginInvoke(Dispatcher dispatcher, Action action, Boolean onlyBeginInvokeWhenNoAccess) in [C:\CI_WS\Ws\113423\Source\Catel\src\Catel.MVVM\Windows\Threading\Extensions\DispatcherExtensions.begininvoke.cs](file:C:/CI_WS/Ws/113423/Source/Catel/src/Catel.MVVM/Windows/Threading/Extensions/DispatcherExtensions.begininvoke.cs):line 115
at Catel.Collections.FastObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e) in [C:\CI_WS\Ws\113423\Source\Catel\src\Catel.MVVM\Collections\FastObservableCollection.cs](file:C:/CI_WS/Ws/113423/Source/Catel/src/Catel.MVVM/Collections/FastObservableCollection.cs):line 458
at Catel.Collections.FastObservableCollection`1.b__31_0() in [C:\CI_WS\Ws\113423\Source\Catel\src\Catel.MVVM\Collections\FastObservableCollection.cs](file:C:/CI_WS/Ws/113423/Source/Catel/src/Catel.MVVM/Collections/FastObservableCollection.cs):line 433
at Catel.Windows.Threading.DispatcherExtensions.BeginInvoke(Dispatcher dispatcher, Action action, Boolean onlyBeginInvokeWhenNoAccess) in [C:\CI_WS\Ws\113423\Source\Catel\src\Catel.MVVM\Windows\Threading\Extensions\DispatcherExtensions.begininvoke.cs](file:C:/CI_WS/Ws/113423/Source/Catel/src/Catel.MVVM/Windows/Threading/Extensions/DispatcherExtensions.begininvoke.cs):line 115
at Catel.Collections.FastObservableCollection`1.NotifyChanges() in [C:\CI_WS\Ws\113423\Source\Catel\src\Catel.MVVM\Collections\FastObservableCollection.cs](file:C:/CI_WS/Ws/113423/Source/Catel/src/Catel.MVVM/Collections/FastObservableCollection.cs):line 440
at Catel.Collections.FastObservableCollection`1.<>c.b__30_1(IDisposableToken`1 x) in [C:\CI_WS\Ws\113423\Source\Catel\src\Catel.MVVM\Collections\FastObservableCollection.cs](file:C:/CI_WS/Ws/113423/Source/Catel/src/Catel.MVVM/Collections/FastObservableCollection.cs):line 408
at Catel.DisposableToken`1.Dispose() in [C:\CI_WS\Ws\113423\Source\Catel\src\Catel.Core\DisposableToken.cs](file:C:/CI_WS/Ws/113423/Source/Catel/src/Catel.Core/DisposableToken.cs):line 82
at Orchestra.Examples.Ribbon.ViewModels.MainViewModel.<>c__DisplayClass37_0.<b__0>d.MoveNext() in [C:\projects\HMSFDSCom\src\HMSFDSCom\ViewModels\MainViewModel.cs](file:C:/projects/HMSFDSCom/src/HMSFDSCom/ViewModels/MainViewModel.cs):line 165
How can I avoid this? consider I’m invoking the close on viewmodel which disconnects the video stream from milestone server