Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
ParameterInfo.Name needs to be checked for null before usage
This occured in trying to use F# code from Python. As the `.Name` property
returns `null`, `ContainsKey` fails.

Related documentation:
https://docs.microsoft.com/en-us/dotnet/api/system.reflection.parameterinfo.name
  • Loading branch information
filmor authored Feb 4, 2021
commit cc194443384e0dcffc58bdcdf8b1535a3fc89da1
2 changes: 1 addition & 1 deletion src/runtime/methodbinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ static object[] TryConvertArguments(ParameterInfo[] pi, bool paramsArray,
for (int paramIndex = 0; paramIndex < pi.Length; paramIndex++)
{
var parameter = pi[paramIndex];
bool hasNamedParam = kwargDict.ContainsKey(parameter.Name);
bool hasNamedParam = parameter.Name != null ? kwargDict.ContainsKey(parameter.Name) : false;
bool isNewReference = false;

if (paramIndex >= pyArgCount && !(hasNamedParam || (paramsArray && paramIndex == arrayStart)))
Expand Down