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

clr_loader.ffi.load_hostfxr might not load the latest version of hostfxr #38

Closed
sdao opened this issue Oct 7, 2022 · 4 comments
Closed

Comments

@sdao
Copy link

sdao commented Oct 7, 2022

Environment

  • Pythonnet version: 3.0.0.post1
  • Python version: 3.7.7
  • Operating System: Windows 10 21H2
  • .NET Runtime: 5.0.17

Details

Depending on the contents of C:\Program Files\dotnet\host\fxr (or wherever the dotnet root is), clr_loader might pick up an older version of hostfxr based on the logic in def load_hostfxr(dotnet_root: Path)

e.g. if the contents of the folder are

2.1.7
3.1.26
5.0.5
5.0.17

then it doesn't pick up 5.0.17, but picks up 5.0.5 because Python's lexicographic sort will order the folder as ['2.1.7', '3.1.26', '5.0.17', '5.0.5'].

This is admittedly very minor, but we just ran into this and wanted to give a heads up :)
Thank you!

@sdao
Copy link
Author

sdao commented Oct 7, 2022

Oh crap, I realized this should have probably gone to the clr-loader repo. But I'm not sure if I can move it myself.

@filmor filmor transferred this issue from pythonnet/pythonnet Oct 8, 2022
@filmor
Copy link
Member

filmor commented Oct 14, 2022

Could you check whether the newest fixes this for you? I'll have a look later whether I can just port https://github.com/dotnet/runtime/blob/20e5237104ddd178f12bc501352e45a5e91e5048/src/native/corehost/fxr_resolver.cpp#L12 to Python to get the exact behaviour that the nethost library applies, but this should probably already do.

@sdao
Copy link
Author

sdao commented Oct 14, 2022

Yep, I can confirm that it picks up the expected version of hostfxr (e.g. 6.0.10 over 6.0.9) now. Thank you!

@filmor
Copy link
Member

filmor commented Oct 15, 2022

Fixed in v0.2.4, thank you for the detailed report :)

@filmor filmor closed this as completed Oct 15, 2022
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

No branches or pull requests

2 participants