-
Notifications
You must be signed in to change notification settings - Fork 748
Calling overridden method with out parameter from C# to python results in 0xC0000005 (Access Violation) #1481
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
Can you please test this with the current |
I just retried with master (ea61b03) . Same error. |
You are not just override method, you are returning Tuple instead of a String, what whould you expect for that? return type String: return type Tuple<String,Int> |
This is a very involved issue, that requires dynamic code generation to be rewritten to support byref arguments. For now unless somebody wants to pick it up, I suggest we document it and move along. As a workaround one can define another interface in .NET that does not have |
…Python new code is emitted to 1. unpack the tuple returned from Python to extract new values for byref parameters and modify args array correspondingly 2. marshal those new values from the args array back into arguments in IL fixes pythonnet#1481
…Python new code is emitted to 1. unpack the tuple returned from Python to extract new values for byref parameters and modify args array correspondingly 2. marshal those new values from the args array back into arguments in IL fixes pythonnet#1481
…Python new code is emitted to 1. unpack the tuple returned from Python to extract new values for byref parameters and modify args array correspondingly 2. marshal those new values from the args array back into arguments in IL fixes pythonnet#1481
…Python new code is emitted to 1. unpack the tuple returned from Python to extract new values for byref parameters and modify args array correspondingly 2. marshal those new values from the args array back into arguments in IL fixes pythonnet#1481
😁 I got bored and made #1663 |
…Python new code is emitted to 1. unpack the tuple returned from Python to extract new values for byref parameters and modify args array correspondingly 2. marshal those new values from the args array back into arguments in IL fixes pythonnet#1481
…Python new code is emitted to 1. unpack the tuple returned from Python to extract new values for byref parameters and modify args array correspondingly 2. marshal those new values from the args array back into arguments in IL fixes #1481
Environment
Details
In C# I have defined an interface with a method with an out parameter. I implemented this interface in python, an now I want to call this method from C#. (using pythonnet)
What I see is that a method without out parameter works fine, but a method with an out parameter throws an access violation.
I know that out parameters are handled differently in pythonnet: you return a tuple with first the return value and the second tuple item is the out parameter.
Minimal, Complete, and Verifiable example
this will help us understand the issue.
My C# code
My Python code:
Output:
Expected output
The text was updated successfully, but these errors were encountered: