8000 ParameterInfo.Name needs to be checked for null before usage by filmor · Pull Request #1375 · pythonnet/pythonnet · GitHub
[go: up one dir, main page]

Skip to content

ParameterInfo.Name needs to be checked for null before usage #1375

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 4, 2021
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
0