Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
925
Collection modified exception on click Auto-Hide pinned panel
posted

Hi,

On click Auto-hide command in the header of panel crashes with exception "Collection was modified; enumeration operation may not execute". Stack trace is fallowing:

System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
   at System.Collections.Generic.HashSet`1.Enumerator.MoveNext()
   at Infragistics.Controls.Menus.NodeLayout.NotifyNodeManagers_PropertyChanged(PropertyChangedEventArgs e)
   at Infragistics.Controls.Menus.NodeLayout.OnPropertyChanged(String propertyName)
   at Infragistics.Controls.Menus.NodeLayout.Tree_PropertyChanged(Object sender, PropertyChangedEventArgs e)
   at System.ComponentModel.PropertyChangedEventHandler.Invoke(Object sender, PropertyChangedEventArgs e)
   at Infragistics.Controls.Menus.XamDataTree.OnPropertyChanged(String name)
   at Infragistics.Controls.Menus.XamDataTree.IsDraggableChanged(DependencyObject obj, 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, Boolean preserveCurrentValue)
   at System.Windows.StyleHelper.InvalidateContainerDependents(DependencyObject container, FrugalStructList`1& exclusionContainerDependents, FrugalStructList`1& oldContainerDependents, FrugalStructList`1& newContainerDependents)
   at System.Windows.StyleHelper.DoStyleInvalidations(FrameworkElement fe, FrameworkContentElement fce, Style oldStyle, Style newStyle)
   at System.Windows.StyleHelper.UpdateStyleCache(FrameworkElement fe, FrameworkContentElement fce, Style oldStyle, Style newStyle, Style& styleCache)
   at System.Windows.FrameworkElement.OnStyleChanged(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, Boolean preserveCurrentValue)
   at System.Windows.FrameworkElement.UpdateStyleProperty()
   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.VisitNode(FrameworkElement fe, Boolean visitedViaVisualTree)
   at System.Windows.DescendentsWalker`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 Infragistics.Windows.DockManager.SplitPane.Infragistics.Windows.DockManager.ISplitElementCollectionOwner.OnElementRemoved(FrameworkElement oldElement)
   at Infragistics.Windows.DockManager.ObservableSplitElementCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at Infragistics.Collections.ObservableCollectionExtended`1.RemoveItem(Int32 index)
   at System.Collections.ObjectModel.Collection`1.RemoveAt(Int32 index)
   at Infragistics.Windows.DockManager.SplitPane.Infragistics.Windows.DockManager.IContentPaneContainer.RemoveContentPane(ContentPane pane, Boolean replaceWithPlaceholder)
   at Infragistics.Windows.DockManager.XamDockManager.ProcessPinnedState(ContentPane pane, PaneLocation location, Boolean allowShowFlyout)
   at Infragistics.Windows.DockManager.ContentPane.VerifyIsPinnedStateSynchronous(Object allowShowFlyout)

The view contains quite few panels and all other working just fine except only one. How to fix this problem?

Here is part of our view containing 4 panels inside of multiple tabs:

The xaml is created using XamDocManager with SplitPane containing ContentPanes:

	<Grid>
		<igDock:XamDockManager LayoutMode="FillContainer" >
			<igDock:XamDockManager.Panes>
				<igDock:SplitPane Width="250" SplitterOrientation="Horizontal">
					<igDock:ContentPane Header="Toolbox" Style="{StaticResource PinnedPanel}"
								igDock:SplitPane.RelativeSize="100,300"
								help:ContextSensitiveHelpProvider.HelpContent="{Binding Source={x:Static ov:HelpContentOverview.CONFIG_CELL_TOOBOX}}">
						<igDock:ContentPane.Resources>
							<ResourceDictionary Source="../Resources/ComponentsViewResources.xaml"></ResourceDictionary>
						</igDock:ContentPane.Resources>
						<core:XamDataTreeEx x:Name="EquipmentCapaTree"
								ItemsSource="{Binding Path=EquipmentComponentCapabilities}" IsExpandedMemberPath="IsExpanded"
								BorderThickness="0"
								AllowDragDropCopy="True"
								SelectedItem="{Binding SelectedEquipmentComponent}"
								Focusable="True">
							<i:Interaction.Behaviors>
								<coreBehaviors:XamDataTreeDragDropBehavior
									DragDropCommand="{Binding Path=Commands[DoDragDrop]}"
									DragItem="{Binding DragItem}"
									DropItem="{Binding DropItem}"/>
							</i:Interaction.Behaviors>
							<ig:XamDataTree.GlobalNodeLayouts>
								<ig:NodeLayout Key="EquipmentCapabilityViewModel"
												TargetTypeName="EquipmentCapabilityViewModel" DisplayMemberPath="Name">
								</ig:NodeLayout>
								<ig:NodeLayout Key="EquipmentComponentViewModel"
											IsDraggable="True"
											TargetTypeName="EquipmentComponentViewModel"
											DisplayMemberPath="EquipmentComponents.Name">
									<ig:NodeLayout.ItemTemplate>
										<DataTemplate>
											<Grid>
												<StackPanel Orientation="Horizontal" AllowDrop="True" Name="CapaInfo">
													<TextBlock Text="{Binding Data.FriendlyName}"/>
													<ig:DragDropManager.DragSource>
														<ig:DragSource IsDraggable="True" DragChannels="ChannelA"
																	DragEnd="OnEquipmentCapaTreeDragEnd" DragStart="OnDragStart">
														</ig:DragSource>
													</ig:DragDropManager.DragSource>
													<ig:DragDropManager.DropTarget>
														<ig:DropTarget IsDropTarget="False" HighlightOnDragStart="True"/>
													</ig:DragDropManager.DropTarget>
													<StackPanel.ToolTip>
														<ToolTip Content="{Binding Path=Data.Description}"
																	Style="{StaticResource bubbleToolTip}"/>
													</StackPanel.ToolTip>
												</StackPanel>
											</Grid>
										</DataTemplate>
									</ig:NodeLayout.ItemTemplate>
								</ig:NodeLayout>
							</ig:XamDataTree.GlobalNodeLayouts>
							<ig:XamDataTree.SelectionSettings>
								<ig:TreeSelectionSettings NodeSelection="Single" />
							</ig:XamDataTree.SelectionSettings>
						</core:XamDataTreeEx>
					</igDock:ContentPane>

Parents
No Data
Reply
  • 34810
    Verified Answer
    Offline posted

    Hello Tomas,

    I have been investigating into the behavior you are seeing, but at the moment I have not been able to reproduce any sort of exception when auto-hiding the pane that the XamDataTree exists in.

    I have built a sample project to test this that is based upon the code you provided, but there are certain things that I could not include, like the ComponentsViewResources.xaml file or the “XamDataTreeEx” extension of the XamDataTree that you appear to be using. I am curious to know whether or not the extension of the XamDataTree has any effect on reproducing this behavior or if it specifically happens with your extension of the tree?

    I am attaching the sample project I used to test this. My tests were made against version 21.2.20212.9 in the Infragistics for WPF 2021.2 toolset. It will be helpful if you can modify this sample project such that it reproduces the exception you are seeing. Alternatively, if you have an isolated sample project of your own that reproduces the behavior, I will gladly take a look at that.

    Please let me know if you have any other questions or concerns on this matter.

    XamDockManagerDataTreeTest.zip

Children