You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a weird bug that I came across by accident.
If an observable property annotated with the ObservablePropertyAttribute has another attribute for the generated property and that attribute has an enum with a negative value, the code generation stops working. I'm assuming there might be a crash with the code generator when it encounters this case and no code is generated further.
This bug can be easily reproduced with the code below.
Regression
No response
Steps to reproduce
This bug occurred when I tested in .NET 7 in a WPF project with Visual Studio 17.5.5 and the latest CommunityToolkit.Mvvm 8.2.0. It probably would happen with other versions.
Using the following code the bug can be reproduced:
Changing the default value for _test3 to NegativeEnum.OK will allow the code to compile without errors, changing back to NegativeEnum.Problem and the code generator stops working.
Also note that if using the NegativeEnum.Problem, removing the 'property:' before the DefaultValueAttribute doesn't seem to have the problem. It only occurs for attributes passed to the property generated.
Expected behavior
An enum with a negative value in a property attribute shouldn't stop the code generator.
Activity