Hello!
I'm occasionally getting unhandled ArgumentNullException, with source "ActiproSoftware.Grids.Wpf", crashing my application.
After some debugging, it seems to me that this happens when the RootItem becomes null (due to a binding in my case) while the TreeListBox is doing some other action.
I've noticed two types of callstacks when this happens, the first:
System.ArgumentNullException: Value cannot be null. (Parameter 'item')
at ActiproSoftware.Windows.Controls.Grids.TreeListBox.CanSelect(TreeMultiSelectionKind kind, TreeNode treeNode, Boolean compareToActive)
at ActiproSoftware.Windows.Controls.Grids.TreeListBox.OnSelectedItemPropertyValueChanged(DependencyObject sender, 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.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView, Object newValue, Boolean isASubPropertyChange)
at System.Windows.DependentList.InvalidateDependents(DependencyObject source, DependencyPropertyChangedEventArgs sourceArgs)
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.SetValue(DependencyProperty dp, Object value)
[Own code removed. It mentions the setter of a view model property with a two way binding to the "SelectedItem" of the TreeListBox]
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at ActiproSoftware.Windows.Controls.Grids.TreeListBox.<>c__DisplayClass73_0.<RequestApplyFilter>b__0()
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
The second:
System.ArgumentNullException: Value cannot be null. (Parameter 'item')
at ActiproSoftware.Windows.Controls.Grids.TreeListBox.CanSelect(TreeMultiSelectionKind kind, TreeNode treeNode, Boolean compareToActive)
at ActiproSoftware.Windows.Controls.Grids.TreeListBox.AddToSelection(TreeNode treeNode, Boolean append, Boolean updateAnchor)
at ActiproSoftware.Windows.Controls.Grids.TreeListBox.UpdateAllTreeNodeVisibility()
at ActiproSoftware.Windows.Controls.Grids.TreeListBox.<>c__DisplayClass73_0.<RequestApplyFilter>b__0()
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
My item adapter overrides "bool GetIsSelectable(TreeListBox ownerControl, object item)" to return false if the item is null and, looking at the control's source code, I don't see what more I could do on my side to avoid those exceptions.
Note:
I'm using .NET 10, but the platoform version dropdown stops at .NET 9.
I also can't use the latest version of Actipro WPF controls at the moment as it's not currently available for use internally in my company. If this issue is fixed in that version, I can try to request for it to be made available.
[Modified 2 days ago]