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
{{ message }}
Repository navigation
Duplicating a method with the ICommand attribute breaks source generator #154
Not sure if it's a bigger VS problem or not, but it's a bit disruptive. Add the following to a view model:
[ICommand]privatevoidDoSomething(){}
Now, highlight all three lines and press Ctrl-D (or copy and paste) at least 3 times. The ICommandSourceGenerator breaks, the previously generated files disappear and even after adding a unique suffix to each method, it won't create any new files. The same thing doesn't happen with:
Hey @powerdude, thank you for reporting this!
I can repro this, the issue is a name collision in the name hints for the generated files. This only happens with the [ICommand] generator because it's emitting one file per command, whereas [ObservableProperty] combines all generated properties into the same file. I'll make a PR to fix this 🙂
So, this is also related to dotnet/roslyn#58625, so it needs to be fixed in VS/Roslyn.
That said, I can also add explicit diagnostics for [ICommand] though, with a clearer error message.
This might especially help in cases where people try to use [ICommand] on multiple overloads of a method.
Activity
Sergio0694 commentedon Mar 15, 2022
Hey @powerdude, thank you for reporting this!
I can repro this, the issue is a name collision in the name hints for the generated files. This only happens with the
[ICommand]generator because it's emitting one file per command, whereas[ObservableProperty]combines all generated properties into the same file. I'll make a PR to fix this 🙂Sergio0694 commentedon Mar 16, 2022
So, this is also related to dotnet/roslyn#58625, so it needs to be fixed in VS/Roslyn.
That said, I can also add explicit diagnostics for
[ICommand]though, with a clearer error message.This might especially help in cases where people try to use
[ICommand]on multiple overloads of a method.