-
Notifications
You must be signed in to change notification settings - Fork 748
Crash when calling back through method with ref ValueType
parameter
#965
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
Comments
Thank you very much for the detailed analysis :) A hard crash is of course not acceptable, so we'll need to fix this soon. I'll see if I understand enough of this to do something about the issue. |
@filmor I don't know the status of fiscal sponsorship for Python.net, but if this is a problem where a fix can be expedited by throwing money at the problem, I may be in a position to supply that money. |
The status of fiscal sponsorship for Python.NET is that there is none. The main issue with throwing money at the problem is finding someone to throw money at. It's not like we have a wealth of programmers with a lot of free time eager to work on problems that are not necessarily their own here. |
@freakboy3742 I am sure if you list a bounty here somebody may pick it up. |
I have no idea what amount of money would get this job done; if you're interested in doing this as work-for-hire, get in touch. |
This should have been fixed by #1364 |
Hi. In response to this query I had one of my colleagues debug an issue, and he found that PythonNet does not correctly generate code when calling into a function with a "ref ValueType" parameter. In his words:
The problem is here in the PythonNet code:
The code is trying to store all of the incoming arguments in an array of type Object[]. The cases are:
o On the way in, the byref needs to read (via ldobj if the underlying type is a struct, or ldind.ref otherwise) to load the actual argument data that needs to flow through.
o On the way out, the byref needs to written (via stobj or stind.ref) to make sure any updates applied by the callee are reflected back to the caller.
The code above handles #1 and #2, but doesn’t handle #3.
Hopefully that's enough for someone to create or contribute a fix.
The text was updated successfully, but these errors were encountered: