Describe the bug
[RelayCommand] attribute source generator error, for the function-name's first character can't be lowered.
Regression
No response
Steps to reproduce
- A Dotnet6 project with MVVM toolkit 8.0.0 installed
- A function with its name's first character can't be lowered, such as:
[RelayCommand]
private void 中文() {}
[RelayCommand]
private void c中文() {}
- Build and see the error:CS0102 类型“MainViewModel”已经包含“中文Command”的定义.
- Generated code snippet that causing the error:
partial class MainViewModel{
[global::System.CodeDom.Compiler.GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.RelayCommandGenerator", "8.0.0.0")]
private global::CommunityToolkit.Mvvm.Input.RelayCommand<bool?>? 中文Command;
[global::System.CodeDom.Compiler.GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.RelayCommandGenerator", "8.0.0.0")]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
public global::CommunityToolkit.Mvvm.Input.IRelayCommand<bool?> 中文Command => 中文Command ??= new global::CommunityToolkit.Mvvm.Input.RelayCommand<bool?>(new global::System.Action<bool?>(中文));
}
Expected behavior
No error, just like when the function name is changed to "C中文".
Maybe it should use '_' to name the background field instead, because [ObservableProperty] works fine with "_中文".
Expected generated code snippet:
partial class MainViewModel{
[global::System.CodeDom.Compiler.GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.RelayCommandGenerator", "8.0.0.0")]
private global::CommunityToolkit.Mvvm.Input.RelayCommand<bool?>? _中文Command;
[global::System.CodeDom.Compiler.GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.RelayCommandGenerator", "8.0.0.0")]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
public global::CommunityToolkit.Mvvm.Input.IRelayCommand<bool?> 中文Command => _中文Command ??= new global::CommunityToolkit.Mvvm.Input.RelayCommand<bool?>(new global::System.Action<bool?>(中文));
}
Screenshots
No response
IDE and version
VS 2022
IDE version
VS Community 2022 17.3.4
Nuget packages
Nuget package version(s)
8.0.0
Additional context
No response
Help us help you
Yes, but only if others can assist
Describe the bug
[RelayCommand] attribute source generator error, for the function-name's first character can't be lowered.
Regression
No response
Steps to reproduce
Expected behavior
No error, just like when the function name is changed to "C中文".
Maybe it should use '_' to name the background field instead, because [ObservableProperty] works fine with "_中文".
Expected generated code snippet:
Screenshots
No response
IDE and version
VS 2022
IDE version
VS Community 2022 17.3.4
Nuget packages
Nuget package version(s)
8.0.0
Additional context
No response
Help us help you
Yes, but only if others can assist