Minor
4.7
4.7.1
NotPlanned
An T:System.InvalidOperationException
can occur in the following scenario:
- The ItemsSource for a
T:System.Windows.Controls.Primitives.Selector
is a collection with a custom implementation ofT:System.Collections.Specialized.INotifyCollectionChanged
. - The selected item is removed from the collection.
- The
T:System.Collections.Specialized.NotifyCollectionChangedEventArgs
hasP:System.Collections.Specialized.NotifyCollectionChangedEventArgs.OldStartingIndex
= -1 (indicating an unknown position).
The exception's callstack begins at System.Windows.Threading.Dispatcher.VerifyAccess() at System.Windows.DependencyObject.GetValue(DependencyProperty dp) at System.Windows.Controls.Primitives.Selector.GetIsSelected(DependencyObject element)
This exception can occur in .NET Framework 4.5 if the application has more than one Dispatcher thread. In .NET Framework 4.7 the exception can also occur in applications with a single Dispatcher thread. The issue is fixed in .NET Framework 4.7.1.
- Quirked
- Build-time break
Upgrade to .NET Framework 4.7.1.
- Not detectable via API analysis
Windows Presentation Foundation (WPF)