Skip to content

Remove delegate casting #936

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 1 commit into from
Aug 26, 2019
Merged

Conversation

jmlidbetter
Copy link
Contributor

What does this implement/fix? Explain your changes.

Fixes an issue where pythonnet attempts to cast one managed delegate to another. This is explicitly forbidden in the documentation: see here. In particular:

You cannot use this method to create a delegate from a function pointer to another managed delegate

I have also removed the usage of the obselete function GetDelegateForFunctionPointer(IntPtr, Type) and replaced it with GetDelegateForFunctionPointer<IntPtr).

Does this close any currently open issues?

No

Any other comments?

It seems like this issue got partially fixed in PR #550 and was mentioned in issue #96. See also this related issue in dotnet core.

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

…n the NET standard documentation for GetDelegateForFunctionPointer
@Cronan
Copy link
Contributor

Cronan commented Aug 12, 2019

@filmor I don't believe I can kick the build ...

@jmlidbetter jmlidbetter reopened this Aug 19, 2019
@lostmsu
Copy link
Member

lostmsu commented Aug 19, 2019

@jmlidbetter can you open a bug for the issue you are trying to fix with repro steps?

@jmlidbetter
Copy link
Contributor Author

@lostmsu You can repro the issue by compiling in dotnet core which I don't believe is officially supported so didnt think an issue is strictly necessary in this case. Check out pr 550 for more background / precedent on the changes as well as the other things mentioned above :)

@lostmsu
Copy link
Member

lostmsu commented Aug 20, 2019

Looks good to me.

@filmor filmor merged commit f1da55e into pythonnet:master Aug 26, 2019
AlexCatarino pushed a commit to QuantConnect/pythonnet that referenced this pull request Jun 18, 2020
…n the NET standard documentation for GetDelegateForFunctionPointer (pythonnet#936)
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.

4 participants