-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[regression/8.0.0-preview.7.8842] ArgumentException on OnPropertyChanged #17357
Copy link
Copy link
Closed
Labels
area-xamlXAML, CSS, Triggers, BehaviorsXAML, CSS, Triggers, Behaviorsfixed-in-8.0.0-rc.2.9373Look for this fix in 8.0.0-rc.2.9373!Look for this fix in 8.0.0-rc.2.9373!platform/windowspotential-regressionThis issue described a possible regression on a currently supported version., verification pendingThis issue described a possible regression on a currently supported version., verification pendingt/bugSomething isn't workingSomething isn't working
Milestone
Description
Description
Going from .NET 8 Preview 6 -> RC 1 I've observed the following issue on one of my ViewModels.
I have a IsBlinking property that calls OnPropertyChanged from .NET Community Toolkit MVVM. Whenever OnPropertyChanged gets called, it throws the following stacktrace.
System.ArgumentException: An item with the same key has already been added. Key: Microsoft.Maui.Controls.SetterSpecificity (Parameter 'key')
at System.Collections.Generic.SortedList`2.Add(TKey key, TValue value)
at Microsoft.Maui.Controls.BindableObject.SetBinding(BindableProperty targetProperty, BindingBase binding, SetterSpecificity specificity)
at Microsoft.Maui.Controls.Setter.Apply(BindableObject target, SetterSpecificity specificity)
at Microsoft.Maui.Controls.TriggerBase.OnConditionChanged(BindableObject bindable, Boolean oldValue, Boolean newValue)
at Microsoft.Maui.Controls.BindingCondition.OnBoundPropertyChanged(BindableObject bindable, Object oldValue, Object newValue)
at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent)
at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, SetterSpecificity specificity)
at Microsoft.Maui.Controls.BindingExpression.Apply(Boolean fromTarget)
at Microsoft.Maui.Controls.BindingExpression.BindingExpressionPart.<PropertyChanged>b__50_0()
at Microsoft.Maui.Controls.DispatcherExtensions.DispatchIfRequired(IDispatcher dispatcher, Action action)
at Microsoft.Maui.Controls.BindingExpression.WeakPropertyChangedProxy.OnPropertyChanged(Object sender, PropertyChangedEventArgs e)
at CommunityToolkit.Mvvm.ComponentModel.ObservableObject.OnPropertyChanged(String propertyName)
Unfortunately, I can't easily reproduce this in a sample project, but the problem resolves itself when downgrading back to Preview 6.
Steps to Reproduce
No response
Link to public reproduction project repository
No response
Version with bug
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
8.0.0-preview.6.8686
Affected platforms
Windows
Affected platform versions
No response
Did you find any workaround?
Wrap in try/catch?
Relevant log output
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-xamlXAML, CSS, Triggers, BehaviorsXAML, CSS, Triggers, Behaviorsfixed-in-8.0.0-rc.2.9373Look for this fix in 8.0.0-rc.2.9373!Look for this fix in 8.0.0-rc.2.9373!platform/windowspotential-regressionThis issue described a possible regression on a currently supported version., verification pendingThis issue described a possible regression on a currently supported version., verification pendingt/bugSomething isn't workingSomething isn't working