Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[regression/8.0.0-preview.7.8842] ArgumentException on OnPropertyChanged #17357

Closed
daltzctr opened this issue Sep 13, 2023 · 2 comments · Fixed by #17365
Closed

[regression/8.0.0-preview.7.8842] ArgumentException on OnPropertyChanged #17357

daltzctr opened this issue Sep 13, 2023 · 2 comments · Fixed by #17365
Assignees
Labels
area-xaml XAML, CSS, Triggers, Behaviors fixed-in-8.0.0-rc.2.9373 Look for this fix in 8.0.0-rc.2.9373! platform/windows 🪟 potential-regression This issue described a possible regression on a currently supported version., verification pending t/bug Something isn't working
Milestone

Comments

@daltzctr
Copy link
Contributor

daltzctr commented Sep 13, 2023

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

8.0.0-preview.7.8842

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

@daltzctr daltzctr added the t/bug Something isn't working label Sep 13, 2023
@PureWeen PureWeen added the potential-regression This issue described a possible regression on a currently supported version., verification pending label Sep 13, 2023
@PureWeen PureWeen added this to the .NET 8 GA milestone Sep 13, 2023
@PureWeen PureWeen added the area-xaml XAML, CSS, Triggers, Behaviors label Sep 13, 2023
@samhouts
Copy link
Member

Unable to reproduce without a project, but the stack trace implicates #13818.

@samhouts samhouts changed the title ArgumentException on OnPropertyChanged [regression/8.0.0-preview.7.8842] ArgumentException on OnPropertyChanged Sep 14, 2023
@StephaneDelcroix
Copy link
Contributor

I think it happens when you apply a style for which one of the setter is a Binding. it's an easy fix, but harder to come up with a unit test

StephaneDelcroix added a commit that referenced this issue Sep 14, 2023
We don't have a test for that

-fixes #17357
@github-project-automation github-project-automation bot moved this from Todo to Done in MAUI SDK Ongoing Sep 14, 2023
PureWeen pushed a commit that referenced this issue Sep 14, 2023
We don't have a test for that

-fixes #17357
samhouts pushed a commit that referenced this issue Sep 17, 2023
* Removed references to GraphicsTester.Skia.Tizen from Maui-dev and Maui-vscode sln files. (#17334)

* Enable requesting the full preview size on iOS drag shadow & iOS and Windows Samples (#17282)

* Enable requesting the full preview size on iOS drag shadow

* Add in windows drag and drop sample

* Move itemssource class into main class

---------

Co-authored-by: TJ Lambert (HE/HIM/HIS) <[email protected]>

* Wait for parent to get set before realizing titleview (#17360)

* [create-pull-request] automated change (#17362)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Make the taps work on all platforms (#17325)

* Added integration test for maui blazor maccatalyst codesign verification. (#17331)

* Added integration test for maui blazor maccatalyst codesign verification.

* Created new Codesign class and moved SearchForExpectedEntitlements to it.

* Updated to DotNetCurrent

* [C] Replace value with same specificity (#17365)

We don't have a test for that

-fixes #17357

* Enable Mac Catalyst Controls Device Tests in CI (#17229)

* Enable Mac Catalyst Controls Device Tests in CI

* Disable failing tests

* [C] Port the specificity concept to Bindings (#17215)

* [C] Port the specificity concept to Bindings

Allow having multiple layers of Bindings, useful for e.g.
AppThemeBinding, Style, VSM

- fixes #16538

* test for 17354

* Revert changes to setting context and add tests (#17348)

* Remove macOS as that is not installed by default (#17379)

* Increase timeouts to 4 hours (#17386)

* Bump the aspnetcore group with 7 updates (#17345)

Bumps the aspnetcore group with 7 updates:

| Package | From | To |
| --- | --- | --- |
| [Microsoft.AspNetCore.Authorization](https://github.com/dotnet/aspnetcore) | `7.0.10` | `7.0.11` |
| [Microsoft.AspNetCore.Components.WebView](https://github.com/dotnet/aspnetcore) | `7.0.10` | `7.0.11` |
| [Microsoft.JSInterop](https://github.com/dotnet/aspnetcore) | `7.0.10` | `7.0.11` |
| [Microsoft.AspNetCore.Components.Web](https://github.com/dotnet/aspnetcore) | `7.0.10` | `7.0.11` |
| [Microsoft.AspNetCore.Authentication.Facebook](https://github.com/dotnet/aspnetcore) | `7.0.10` | `7.0.11` |
| [Microsoft.AspNetCore.Authentication.Google](https://github.com/dotnet/aspnetcore) | `7.0.10` | `7.0.11` |
| [Microsoft.AspNetCore.Authentication.MicrosoftAccount](https://github.com/dotnet/aspnetcore) | `7.0.10` | `7.0.11` |


Updates `Microsoft.AspNetCore.Authorization` from 7.0.10 to 7.0.11
- [Release notes](https://github.com/dotnet/aspnetcore/releases)
- [Changelog](https://github.com/dotnet/aspnetcore/blob/main/docs/ReleasePlanning.md)
- [Commits](dotnet/aspnetcore@v7.0.10...v7.0.11)

Updates `Microsoft.AspNetCore.Components.WebView` from 7.0.10 to 7.0.11
- [Release notes](https://github.com/dotnet/aspnetcore/releases)
- [Changelog](https://github.com/dotnet/aspnetcore/blob/main/docs/ReleasePlanning.md)
- [Commits](dotnet/aspnetcore@v7.0.10...v7.0.11)

Updates `Microsoft.JSInterop` from 7.0.10 to 7.0.11
- [Release notes](https://github.com/dotnet/aspnetcore/releases)
- [Changelog](https://github.com/dotnet/aspnetcore/blob/main/docs/ReleasePlanning.md)
- [Commits](dotnet/aspnetcore@v7.0.10...v7.0.11)

Updates `Microsoft.AspNetCore.Components.Web` from 7.0.10 to 7.0.11
- [Release notes](https://github.com/dotnet/aspnetcore/releases)
- [Changelog](https://github.com/dotnet/aspnetcore/blob/main/docs/ReleasePlanning.md)
- [Commits](dotnet/aspnetcore@v7.0.10...v7.0.11)

Updates `Microsoft.AspNetCore.Authentication.Facebook` from 7.0.10 to 7.0.11
- [Release notes](https://github.com/dotnet/aspnetcore/releases)
- [Changelog](https://github.com/dotnet/aspnetcore/blob/main/docs/ReleasePlanning.md)
- [Commits](dotnet/aspnetcore@v7.0.10...v7.0.11)

Updates `Microsoft.AspNetCore.Authentication.Google` from 7.0.10 to 7.0.11
- [Release notes](https://github.com/dotnet/aspnetcore/releases)
- [Changelog](https://github.com/dotnet/aspnetcore/blob/main/docs/ReleasePlanning.md)
- [Commits](dotnet/aspnetcore@v7.0.10...v7.0.11)

Updates `Microsoft.AspNetCore.Authentication.MicrosoftAccount` from 7.0.10 to 7.0.11
- [Release notes](https://github.com/dotnet/aspnetcore/releases)
- [Changelog](https://github.com/dotnet/aspnetcore/blob/main/docs/ReleasePlanning.md)
- [Commits](dotnet/aspnetcore@v7.0.10...v7.0.11)

---
updated-dependencies:
- dependency-name: Microsoft.AspNetCore.Authorization
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: aspnetcore
- dependency-name: Microsoft.AspNetCore.Components.WebView
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: aspnetcore
- dependency-name: Microsoft.JSInterop
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: aspnetcore
- dependency-name: Microsoft.AspNetCore.Components.Web
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: aspnetcore
- dependency-name: Microsoft.AspNetCore.Authentication.Facebook
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: aspnetcore
- dependency-name: Microsoft.AspNetCore.Authentication.Google
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: aspnetcore
- dependency-name: Microsoft.AspNetCore.Authentication.MicrosoftAccount
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: aspnetcore
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* [create-pull-request] automated change (#17388)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* [X] fix CollectionItems enumeration (#17364)

- fixes #17333

* passing test for #16960 (#17397)

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dustin-wojciechowski <[email protected]>
Co-authored-by: TJ Lambert <[email protected]>
Co-authored-by: TJ Lambert (HE/HIM/HIS) <[email protected]>
Co-authored-by: Shane Neuville <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: E.Z. Hart <[email protected]>
Co-authored-by: Stephane Delcroix <[email protected]>
Co-authored-by: Gerald Versluis <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@samhouts samhouts added the fixed-in-8.0.0-rc.2.9373 Look for this fix in 8.0.0-rc.2.9373! label Oct 10, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Nov 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-xaml XAML, CSS, Triggers, Behaviors fixed-in-8.0.0-rc.2.9373 Look for this fix in 8.0.0-rc.2.9373! platform/windows 🪟 potential-regression This issue described a possible regression on a currently supported version., verification pending t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants