-
Notifications
You must be signed in to change notification settings - Fork 344
Open
Labels
bug 🐛An unexpected issue that highlights incorrect behaviorAn unexpected issue that highlights incorrect behavior
Description
Describe the bug
Given two types, where one is derived from the other, adding a private field to the derived type with the same name as a private field on the base type will generate a property on each type's generated partial definition. Because code analysis is disabled on these generated files, no indication is given that the property on the derived type is hiding the property on the base type.
Regression
No response
Steps to reproduce
The following code should demonstrate the problem:
public class TypeA : ObservableObject
{
[ObservableProperty]
private bool _someField; // will generate TypeA.SomeField
}
public class TypeB : TypeA
{
[ObservableProperty]
private bool _someField; // will generate TypeB.SomeField, hiding TypeA.SomeField
}
Expected behavior
Some indication should be given that TypeB._someField causes hiding of the property generated for TypeA, either CS0108 on the field or some MVVM specific warning that explains exactly what is happening.
Screenshots
No response
IDE and version
VS 2022
IDE version
17.13.6
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
No, just wanted to report this
Metadata
Metadata
Assignees
Labels
bug 🐛An unexpected issue that highlights incorrect behaviorAn unexpected issue that highlights incorrect behavior