-
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
The following command compiles, but causes a runtime error when called.
public override async Task SomeCommandAsync(bool optional = false, CancellationToken cancellationToken = default)
{
}
The same command without the first optional argument does work, i.e. the optional CancellationToken
is handled correctly, as far as I can tell.
If it isn't possible to dispatch the command with that default/optional argument, then the analyzer should probably produce a compiler error notifying the user that RelayCommand
s cannot have optional arguments.
Regression
No response
Steps to reproduce
- Paste the code above into a class inside a project that references the CommunityToolkit
- Run the application
Expected behavior
Either pass in the provided value or the default or generate a compiler error to notify the user that commands cannot have optional arguments.
Screenshots
No response
IDE and version
VS 2022
IDE version
No response
Nuget packages
- CommunityToolkit.Common
- CommunityToolkit.Diagnostics
- CommunityToolkit.HighPerformance
- CommunityToolkit.Mvvm (aka MVVM Toolkit)
Nuget package version(s)
CommunityToolkit.Mvvm 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