Partial ObservableProperty in ObservableObject shows error CS0229 ambiguity between property and property
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
Línea de trabajo
No se nombran archivos del repositorio ni pruebas. Empieza reproduciendo el ejemplo parcial mínimo de ObservableProperty con CommunityToolkit.Mvvm 8.4.0 e inspecciona la ruta de generación de código fuente de ObservableProperty; se considera terminado cuando los accesos externos a Item.Returned ya no producen CS0229, mientras la propiedad generada sigue compilando y comportándose correctamente.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
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
- Lenguaje dominante
- C#
- Estrellas
- 3.8k
- Forks
- 403
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de CommunityToolkit/dotnet
-
RelayCommand<T>.CanExecute(null) returns false for value types without a predicatePosiblemente ocupada @apachezy la tomó hace 89 días. Abiertobug :bug:
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
CommunityToolkit/dotnet#1206 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
CommunityToolkit/dotnet#1186 ·
-
bug :bug:
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
CommunityToolkit/dotnet#648 ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
CommunityToolkit/dotnet#1217 ·
-
bug :bug:
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
CommunityToolkit/dotnet#1215 ·
Todos los issues de CommunityToolkit/dotnet
Issues similares
-
bug mcp misleading small
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
Los mantenedores suelen responder en 1 día
-
accessibility help wanted macos
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
dorlugasigal/annotator#42 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
AvaloniaUI/Avalonia#22568 ·
Los mantenedores suelen responder en 2 días
-
[bug] 截图失败日志冲爆硬盘Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 63/100
babalae/better-genshin-impact#3846 · 2 comentarios ·
Los mantenedores suelen responder en 2 días
-
[辞書] ブルアカ->ブルーアーカイブAbierto要トリアージ 辞書
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día