Skip to content

Commit

Permalink
Merge pull request #368 from 0xced/Better-SelfLogs
Browse files Browse the repository at this point in the history
Improve SelfLog when a configuration method is not found
  • Loading branch information
nblumhardt authored Mar 21, 2023
2 parents ae0e57e + 4ab71a9 commit eae1ded
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -470,17 +470,27 @@ static bool HasImplicitValueWhenNotSpecified(ParameterInfo paramInfo)
.ToList();

if (!methodsByName.Any())
SelfLog.WriteLine($"Unable to find a method called {name}. Candidate methods are:{Environment.NewLine}{string.Join(Environment.NewLine, candidateMethods)}");
{
if (candidateMethods.Any())
{
SelfLog.WriteLine($"Unable to find a method called {name}. Candidate methods are:{Environment.NewLine}{string.Join(Environment.NewLine, candidateMethods)}");
}
else
{
SelfLog.WriteLine($"Unable to find a method called {name}. No candidates found.");
}
}
else
{
SelfLog.WriteLine($"Unable to find a method called {name} "
+ (suppliedArgumentNames.Any()
? "for supplied arguments: " + string.Join(", ", suppliedArgumentNames)
: "with no supplied arguments")
+ ". Candidate methods are:"
+ Environment.NewLine
+ string.Join(Environment.NewLine, methodsByName));
}
}

return selectedMethod;
}

Expand Down

0 comments on commit eae1ded

Please sign in to comment.