Closed GetGet99 closed 1 year ago
Observable Property used on a field with an escaped name (the name starting with the @ sign such as @event @param @int) is not generating correctly.
@
@event
@param
@int
[ObservableProperty] double @event;
Event
Ctrl + Click
/// <inheritdoc cref="event"/> [global::System.CodeDom.Compiler.GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator", "8.2.0.0")] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] public double Event { get => event; set { if (!global::System.Collections.Generic.EqualityComparer<double>.Default.Equals(event, value)) { OnEventChanging(value); OnEventChanging(default, value); OnPropertyChanging(global::CommunityToolkit.Mvvm.ComponentModel.__Internals.__KnownINotifyPropertyChangingArgs.Event); event = value; OnEventChanged(value); OnEventChanged(default, value); OnPropertyChanged(global::CommunityToolkit.Mvvm.ComponentModel.__Internals.__KnownINotifyPropertyChangedArgs.Event); } } }
Every single event in the generated code should be replaced with @event because event is treated as a C# keyword.
event
/// <inheritdoc cref="@event"/> [global::System.CodeDom.Compiler.GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator", "8.2.0.0")] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] public double Event { get => @event; set { if (!global::System.Collections.Generic.EqualityComparer<double>.Default.Equals(@event, value)) { OnEventChanging(value); OnEventChanging(default, value); OnPropertyChanging(global::CommunityToolkit.Mvvm.ComponentModel.__Internals.__KnownINotifyPropertyChangingArgs.Event); @event = value; OnEventChanged(value); OnEventChanged(default, value); OnPropertyChanged(global::CommunityToolkit.Mvvm.ComponentModel.__Internals.__KnownINotifyPropertyChangedArgs.Event); } } }
VS 2022
17.6.2
8.2.0
No, just wanted to report this
Describe the bug
Observable Property used on a field with an escaped name (the name starting with the
@
sign such as@event
@param
@int
) is not generating correctly.Steps to reproduce
Event
somewhere in a method andCtrl + Click
it to go to the definitionExpected behavior
Every single
event
in the generated code should be replaced with@event
becauseevent
is treated as a C# keyword.Screenshots
IDE and version
VS 2022
IDE version
17.6.2
Nuget packages
Nuget package version(s)
8.2.0
Help us help you
No, just wanted to report this