Skip to content
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

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

Merged
merged 2 commits into from Feb 4, 2021

Conversation

filmor
Copy link
Member

@filmor filmor commented Feb 4, 2021

What does this implement/fix? Explain your changes.

This occured in trying to use F# code from Python. As the .Name property returns null, ContainsKey fails.

Does this close any currently open issues?

I don't think so.

Any other comments?

Related documentation: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.parameterinfo.name

I don't know if there is a way to create a C# method without a parameter name. I'll try to set up a few simple F# test-cases in the future in a separate PR (follow-up ticket: #1374).

Checklist

Check all those that are applicable and complete.

  • Make sure to include one or more tests for your change
  • If an enhancement PR, please create docs and at best an example
  • Add yourself to AUTHORS
  • Updated the CHANGELOG

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
@filmor filmor requested a review from lostmsu February 4, 2021 08:27
@lostmsu
Copy link
Member

lostmsu commented Feb 4, 2021

Can you add a test?

@lostmsu
Copy link
Member

lostmsu commented Feb 4, 2021

I see #1374

@lostmsu lostmsu merged commit d86bf3c into master Feb 4, 2021
@lostmsu lostmsu deleted the parameter-name-may-be-null branch February 4, 2021 20:33
filmor added a commit that referenced this pull request Feb 4, 2021
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
@noambonnieclear
Copy link

noambonnieclear commented Feb 11, 2021

I tried testing this with the latest 2.5.2 release. Could it be that there was something wrong with the distribution of the package? We checked on multiple environments and it looks like when we install 2.5.2 we still get 2.5.1. Really odd but we're running out of ideas of what we might be doing wrong for a straight forward upgrade... :-) Also tried fresh installs...

For example:

PS C:\Users\user> pip install --upgrade pythonnet==2.5.2
Collecting pythonnet==2.5.2
  Downloading https://files.pythonhosted.org/packages/0c/b3/e136267c9299ac5572286ccb807f4b0a6bad9b882e7ca94691004a6acc83/pythonnet-2.5.2-cp36-cp36m-win_amd64.whl (81kB)
     |████████████████████████████████| 92kB 737kB/s
Requirement already satisfied, skipping upgrade: pycparser in c:\users\apaganini\appdata\local\programs\python\python36\lib\site-packages (from pythonnet==2.5.2) (2.20)
Installing collected packages: pythonnet
  Found existing installation: pythonnet 2.5.1
    Uninstalling pythonnet-2.5.1:
      Successfully uninstalled pythonnet-2.5.1
Successfully installed pythonnet-2.5.2
WARNING: You are using pip version 19.3.1; however, version 21.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
PS C:\Users\user> py
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import clr
>>> clr.__version__
'2.5.1'

@filmor
Copy link
Member Author

filmor commented Feb 11, 2021

It's possible that I missed one version string somewhere, sorry about that. The process on the backports branch is completely manual.

@noambonnieclear
Copy link

Thank you @filmor - what's the path forward? is it going to be re-released as 2.5.2 or changed to 2.5.3? i.e. - will I get notified of a new release when this is corrected?

@noambonnieclear
Copy link

@filmor I apologize but I actually commented on the wrong issue. It was supposed to be on #1364 - But regardless looks like something in the distribution is wrong based on the above comment.

@filmor
Copy link
Member Author

filmor commented Feb 11, 2021

I don't intend to do a 2.5.3 release just for this. 2.5 is frozen, only patches for regressions are backported. Work is happening on master. The issue you wanted to comment on is not merged into backports-2.5 anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants