@@ -55,7 +55,8 @@ internal static class Execute
5555 out string ? delegateType ,
5656 out bool supportsCancellation ,
5757 out ImmutableArray < string > commandTypeArguments ,
58- out ImmutableArray < string > delegateTypeArguments ) )
58+ out ImmutableArray < string > commandTypeArgumentsWithNullabilityAnnotations ,
59+ out ImmutableArray < string > delegateTypeArgumentsWithNullabilityAnnotations ) )
5960 {
6061 goto Failure ;
6162 }
@@ -115,8 +116,8 @@ internal static class Execute
115116 commandInterfaceType ,
116117 commandClassType ,
117118 delegateType ,
118- commandTypeArguments ,
119- delegateTypeArguments ,
119+ commandTypeArgumentsWithNullabilityAnnotations ,
120+ delegateTypeArgumentsWithNullabilityAnnotations ,
120121 canExecuteMemberName ,
121122 canExecuteExpressionType ,
122123 allowConcurrentExecutions ,
@@ -444,7 +445,8 @@ public static (string FieldName, string PropertyName) GetGeneratedFieldAndProper
444445 /// <param name="delegateType">The delegate type name for the wrapped method.</param>
445446 /// <param name="supportsCancellation">Indicates whether or not the resulting command supports cancellation.</param>
446447 /// <param name="commandTypeArguments">The type arguments for <paramref name="commandInterfaceType"/> and <paramref name="commandClassType"/>, if any.</param>
447- /// <param name="delegateTypeArguments">The type arguments for <paramref name="delegateType"/>, if any.</param>
448+ /// <param name="commandTypeArgumentsWithNullabilityAnnotations">Same as <paramref name="commandTypeArguments"/>, but with nullability annotations.</param>
449+ /// <param name="delegateTypeArgumentsWithNullabilityAnnotations">The type arguments for <paramref name="delegateType"/>, if any, with nullability annotations.</param>
448450 /// <returns>Whether or not <paramref name="methodSymbol"/> was valid and the requested types have been set.</returns>
449451 private static bool TryMapCommandTypesFromMethod (
450452 IMethodSymbol methodSymbol ,
@@ -454,7 +456,8 @@ private static bool TryMapCommandTypesFromMethod(
454456 [ NotNullWhen ( true ) ] out string ? delegateType ,
455457 out bool supportsCancellation ,
456458 out ImmutableArray < string > commandTypeArguments ,
457- out ImmutableArray < string > delegateTypeArguments )
459+ out ImmutableArray < string > commandTypeArgumentsWithNullabilityAnnotations ,
460+ out ImmutableArray < string > delegateTypeArgumentsWithNullabilityAnnotations )
458461 {
459462 // Map <void, void> to IRelayCommand, RelayCommand, Action
460463 if ( methodSymbol . ReturnsVoid && methodSymbol . Parameters . Length == 0 )
@@ -463,8 +466,9 @@ private static bool TryMapCommandTypesFromMethod(
463466 commandClassType = "global::CommunityToolkit.Mvvm.Input.RelayCommand" ;
464467 delegateType = "global::System.Action" ;
465468 supportsCancellation = false ;
466- commandTypeArguments = ImmutableArray < string > . Empty ;
467- delegateTypeArguments = ImmutableArray < string > . Empty ;
469+ commandTypeArguments = ImmutableArray < string > . Empty ;
470+ commandTypeArgumentsWithNullabilityAnnotations = ImmutableArray < string > . Empty ;
471+ delegateTypeArgumentsWithNullabilityAnnotations = ImmutableArray < string > . Empty ;
468472
469473 return true ;
470474 }
@@ -478,8 +482,9 @@ private static bool TryMapCommandTypesFromMethod(
478482 commandClassType = "global::CommunityToolkit.Mvvm.Input.RelayCommand" ;
479483 delegateType = "global::System.Action" ;
480484 supportsCancellation = false ;
481- commandTypeArguments = ImmutableArray . Create ( parameter . Type . GetFullyQualifiedNameWithNullabilityAnnotations ( ) ) ;
482- delegateTypeArguments = ImmutableArray . Create ( parameter . Type . GetFullyQualifiedNameWithNullabilityAnnotations ( ) ) ;
485+ commandTypeArguments = ImmutableArray . Create ( parameter . Type . GetFullyQualifiedName ( ) ) ;
486+ commandTypeArgumentsWithNullabilityAnnotations = ImmutableArray . Create ( parameter . Type . GetFullyQualifiedNameWithNullabilityAnnotations ( ) ) ;
487+ delegateTypeArgumentsWithNullabilityAnnotations = ImmutableArray . Create ( parameter . Type . GetFullyQualifiedNameWithNullabilityAnnotations ( ) ) ;
483488
484489 return true ;
485490 }
@@ -496,7 +501,8 @@ private static bool TryMapCommandTypesFromMethod(
496501 delegateType = "global::System.Func" ;
497502 supportsCancellation = false ;
498503 commandTypeArguments = ImmutableArray < string > . Empty ;
499- delegateTypeArguments = ImmutableArray . Create ( "global::System.Threading.Tasks.Task" ) ;
504+ commandTypeArgumentsWithNullabilityAnnotations = ImmutableArray < string > . Empty ;
505+ delegateTypeArgumentsWithNullabilityAnnotations = ImmutableArray . Create ( "global::System.Threading.Tasks.Task" ) ;
500506
501507 return true ;
502508 }
@@ -512,7 +518,8 @@ private static bool TryMapCommandTypesFromMethod(
512518 delegateType = "global::System.Func" ;
513519 supportsCancellation = true ;
514520 commandTypeArguments = ImmutableArray < string > . Empty ;
515- delegateTypeArguments = ImmutableArray . Create ( "global::System.Threading.CancellationToken" , "global::System.Threading.Tasks.Task" ) ;
521+ commandTypeArgumentsWithNullabilityAnnotations = ImmutableArray < string > . Empty ;
522+ delegateTypeArgumentsWithNullabilityAnnotations = ImmutableArray . Create ( "global::System.Threading.CancellationToken" , "global::System.Threading.Tasks.Task" ) ;
516523
517524 return true ;
518525 }
@@ -522,8 +529,9 @@ private static bool TryMapCommandTypesFromMethod(
522529 commandClassType = "global::CommunityToolkit.Mvvm.Input.AsyncRelayCommand" ;
523530 delegateType = "global::System.Func" ;
524531 supportsCancellation = false ;
525- commandTypeArguments = ImmutableArray . Create ( singleParameter . Type . GetFullyQualifiedNameWithNullabilityAnnotations ( ) ) ;
526- delegateTypeArguments = ImmutableArray . Create ( singleParameter . Type . GetFullyQualifiedNameWithNullabilityAnnotations ( ) , "global::System.Threading.Tasks.Task" ) ;
532+ commandTypeArguments = ImmutableArray . Create ( singleParameter . Type . GetFullyQualifiedName ( ) ) ;
533+ commandTypeArgumentsWithNullabilityAnnotations = ImmutableArray . Create ( singleParameter . Type . GetFullyQualifiedNameWithNullabilityAnnotations ( ) ) ;
534+ delegateTypeArgumentsWithNullabilityAnnotations = ImmutableArray . Create ( singleParameter . Type . GetFullyQualifiedNameWithNullabilityAnnotations ( ) , "global::System.Threading.Tasks.Task" ) ;
527535
528536 return true ;
529537 }
@@ -538,8 +546,9 @@ private static bool TryMapCommandTypesFromMethod(
538546 commandClassType = "global::CommunityToolkit.Mvvm.Input.AsyncRelayCommand" ;
539547 delegateType = "global::System.Func" ;
540548 supportsCancellation = true ;
541- commandTypeArguments = ImmutableArray . Create ( firstParameter . Type . GetFullyQualifiedNameWithNullabilityAnnotations ( ) ) ;
542- delegateTypeArguments = ImmutableArray . Create ( firstParameter . Type . GetFullyQualifiedNameWithNullabilityAnnotations ( ) , "global::System.Threading.CancellationToken" , "global::System.Threading.Tasks.Task" ) ;
549+ commandTypeArguments = ImmutableArray . Create ( firstParameter . Type . GetFullyQualifiedName ( ) ) ;
550+ commandTypeArgumentsWithNullabilityAnnotations = ImmutableArray . Create ( firstParameter . Type . GetFullyQualifiedNameWithNullabilityAnnotations ( ) ) ;
551+ delegateTypeArgumentsWithNullabilityAnnotations = ImmutableArray . Create ( firstParameter . Type . GetFullyQualifiedNameWithNullabilityAnnotations ( ) , "global::System.Threading.CancellationToken" , "global::System.Threading.Tasks.Task" ) ;
543552
544553 return true ;
545554 }
@@ -552,7 +561,8 @@ private static bool TryMapCommandTypesFromMethod(
552561 delegateType = null ;
553562 supportsCancellation = false ;
554563 commandTypeArguments = ImmutableArray < string > . Empty ;
555- delegateTypeArguments = ImmutableArray < string > . Empty ;
564+ commandTypeArgumentsWithNullabilityAnnotations = ImmutableArray < string > . Empty ;
565+ delegateTypeArgumentsWithNullabilityAnnotations = ImmutableArray < string > . Empty ;
556566
557567 return false ;
558568 }
0 commit comments