File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -317,9 +317,16 @@ private static bool IsCommandDefinitionUnique(IMethodSymbol methodSymbol, Immuta
317
317
foreach ( ISymbol symbol in methodSymbol . ContainingType . GetMembers ( methodSymbol . Name ) )
318
318
{
319
319
if ( symbol is IMethodSymbol otherSymbol &&
320
- ! SymbolEqualityComparer . Default . Equals ( methodSymbol , otherSymbol ) &&
321
320
otherSymbol . HasAttributeWithFullyQualifiedName ( "global::CommunityToolkit.Mvvm.Input.ICommandAttribute" ) )
322
321
{
322
+ // If the first [ICommand] overload is the current symbol, return immediately. This makes it so
323
+ // that if multiple overloads are present, only the ones after the first declared one will have
324
+ // diagnostics generated for them, while the first one will remain valid and will keep working.
325
+ if ( SymbolEqualityComparer . Default . Equals ( methodSymbol , otherSymbol ) )
326
+ {
327
+ return true ;
328
+ }
329
+
323
330
diagnostics . Add (
324
331
MultipleICommandMethodOverloadsError ,
325
332
methodSymbol ,
You can’t perform that action at this time.
0 commit comments