@@ -55,7 +55,8 @@ internal static class Execute
55
55
out string ? delegateType ,
56
56
out bool supportsCancellation ,
57
57
out ImmutableArray < string > commandTypeArguments ,
58
- out ImmutableArray < string > delegateTypeArguments ) )
58
+ out ImmutableArray < string > commandTypeArgumentsWithNullabilityAnnotations ,
59
+ out ImmutableArray < string > delegateTypeArgumentsWithNullabilityAnnotations ) )
59
60
{
60
61
goto Failure ;
61
62
}
@@ -115,8 +116,8 @@ internal static class Execute
115
116
commandInterfaceType ,
116
117
commandClassType ,
117
118
delegateType ,
118
- commandTypeArguments ,
119
- delegateTypeArguments ,
119
+ commandTypeArgumentsWithNullabilityAnnotations ,
120
+ delegateTypeArgumentsWithNullabilityAnnotations ,
120
121
canExecuteMemberName ,
121
122
canExecuteExpressionType ,
122
123
allowConcurrentExecutions ,
@@ -444,7 +445,8 @@ public static (string FieldName, string PropertyName) GetGeneratedFieldAndProper
444
445
/// <param name="delegateType">The delegate type name for the wrapped method.</param>
445
446
/// <param name="supportsCancellation">Indicates whether or not the resulting command supports cancellation.</param>
446
447
/// <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>
448
450
/// <returns>Whether or not <paramref name="methodSymbol"/> was valid and the requested types have been set.</returns>
449
451
private static bool TryMapCommandTypesFromMethod (
450
452
IMethodSymbol methodSymbol ,
@@ -454,7 +456,8 @@ private static bool TryMapCommandTypesFromMethod(
454
456
[ NotNullWhen ( true ) ] out string ? delegateType ,
455
457
out bool supportsCancellation ,
456
458
out ImmutableArray < string > commandTypeArguments ,
457
- out ImmutableArray < string > delegateTypeArguments )
459
+ out ImmutableArray < string > commandTypeArgumentsWithNullabilityAnnotations ,
460
+ out ImmutableArray < string > delegateTypeArgumentsWithNullabilityAnnotations )
458
461
{
459
462
// Map <void, void> to IRelayCommand, RelayCommand, Action
460
463
if ( methodSymbol . ReturnsVoid && methodSymbol . Parameters . Length == 0 )
@@ -463,8 +466,9 @@ private static bool TryMapCommandTypesFromMethod(
463
466
commandClassType = "global::CommunityToolkit.Mvvm.Input.RelayCommand" ;
464
467
delegateType = "global::System.Action" ;
465
468
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 ;
468
472
469
473
return true ;
470
474
}
@@ -478,8 +482,9 @@ private static bool TryMapCommandTypesFromMethod(
478
482
commandClassType = "global::CommunityToolkit.Mvvm.Input.RelayCommand" ;
479
483
delegateType = "global::System.Action" ;
480
484
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 ( ) ) ;
483
488
484
489
return true ;
485
490
}
@@ -496,7 +501,8 @@ private static bool TryMapCommandTypesFromMethod(
496
501
delegateType = "global::System.Func" ;
497
502
supportsCancellation = false ;
498
503
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" ) ;
500
506
501
507
return true ;
502
508
}
@@ -512,7 +518,8 @@ private static bool TryMapCommandTypesFromMethod(
512
518
delegateType = "global::System.Func" ;
513
519
supportsCancellation = true ;
514
520
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" ) ;
516
523
517
524
return true ;
518
525
}
@@ -522,8 +529,9 @@ private static bool TryMapCommandTypesFromMethod(
522
529
commandClassType = "global::CommunityToolkit.Mvvm.Input.AsyncRelayCommand" ;
523
530
delegateType = "global::System.Func" ;
524
531
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" ) ;
527
535
528
536
return true ;
529
537
}
@@ -538,8 +546,9 @@ private static bool TryMapCommandTypesFromMethod(
538
546
commandClassType = "global::CommunityToolkit.Mvvm.Input.AsyncRelayCommand" ;
539
547
delegateType = "global::System.Func" ;
540
548
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" ) ;
543
552
544
553
return true ;
545
554
}
@@ -552,7 +561,8 @@ private static bool TryMapCommandTypesFromMethod(
552
561
delegateType = null ;
553
562
supportsCancellation = false ;
554
563
commandTypeArguments = ImmutableArray < string > . Empty ;
555
- delegateTypeArguments = ImmutableArray < string > . Empty ;
564
+ commandTypeArgumentsWithNullabilityAnnotations = ImmutableArray < string > . Empty ;
565
+ delegateTypeArgumentsWithNullabilityAnnotations = ImmutableArray < string > . Empty ;
556
566
557
567
return false ;
558
568
}
0 commit comments