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

Partial ObservableProperty in ObservableObject shows error CS0229 ambiguity between property and property #1056

Open
1 of 4 tasks
jpageacsys opened this issue Feb 26, 2025 · 0 comments
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior

Comments

@jpageacsys
Copy link

jpageacsys commented Feb 26, 2025

Describe the bug

I'm developing a WinUI application with Community Toolkit MVVM 8.4.0.
I switched the properties in my application to use the new format. Here's one example:

[ObservableProperty]
public partial bool Returned { get; set; } = returned;

And this is a simplified version of the constructor for the object:
public partial class Item(bool returned) : ObservableObject

This all works as expected and compiles fine but all uses of the property elsewhere show the Compiler Error CS0229. In this case it shows:
Ambiguity between Item.Returned and Item.Returned.
I only have the one property called Returned.
As I said, it all compiles fine and works correctly but I'm not able to get rid of the error.

Regression

No response

Steps to reproduce

Create a class with the type ObservableObject and create a partial Observable Property. Use it elsewhere in the app.

Example:

public partial class Item(bool returned) {
    [ObservableProperty]
    public partial bool Returned { get; set; } = returned;
}

Then access the property somewhere else in the app.

Example:

var newItem = new Item(false);
newItem.Returned = true;

This shows the compiler error.

Expected behavior

I would like to remove the false alarm.

Screenshots

Image

IDE and version

VS 2022

IDE version

Version 17.13.1

Nuget packages

  • CommunityToolkit.Common
  • CommunityToolkit.Diagnostics
  • CommunityToolkit.HighPerformance
  • CommunityToolkit.Mvvm (aka MVVM Toolkit)

Nuget package version(s)

8.4.0

Additional context

No response

Help us help you

Yes, but only if others can assist

@jpageacsys jpageacsys added the bug 🐛 An unexpected issue that highlights incorrect behavior label Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior
Projects
None yet
Development

No branches or pull requests

1 participant