`[RelayCommand]` does not work with default/optional arguments as the command parameter
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
Línea de trabajo
Comienza por las rutas de generación y del analizador de [RelayCommand] en CommunityToolkit.Mvvm y, después, reproduce el comando informado con un bool opcional y un CancellationToken predeterminado. Confirma si el comando generado puede manejar el argumento opcional; se considera terminado cuando el comando se despacha correctamente o el analizador informa de un error claro del compilador para argumentos opcionales no compatibles.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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 RelayCommands 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
- Lenguaje dominante
- C#
- Estrellas
- 3.8k
- Forks
- 401
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de CommunityToolkit/dotnet
-
bug :bug:
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
CommunityToolkit/dotnet#1206 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
CommunityToolkit/dotnet#1186 ·
-
bug :bug:
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
CommunityToolkit/dotnet#648 ·
-
bug :bug:
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
CommunityToolkit/dotnet#1215 ·
-
feature request :mailbox_with_mail:
Dificultad 5/5 Más de una semana Aptitud para principiantes 45/100
CommunityToolkit/dotnet#1214 ·
Todos los issues de CommunityToolkit/dotnet
Issues similares
-
go 🏃 testing 🧪
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
valkey-io/valkey-glide#7239 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
SubtitleEdit/subtitleedit#15462 ·
Los mantenedores suelen responder en 1 día
-
:watch: Not Triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
comp:instrumentation.aspnetcore
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
open-telemetry/opentelemetry-dotnet-contrib#5427 ·
Los mantenedores suelen responder en 1 día
-
[feature request] Condier making `TelemetrySpan`'s constructor and `Activity` property publicAbiertoenhancement needs-triage pkg:OpenTelemetry
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
open-telemetry/opentelemetry-dotnet#7851 · 4 comentarios ·
Los mantenedores suelen responder en 1 día