- Notifications
You must be signed in to change notification settings - Fork749
Closed
Description
Environment
- Pythonnet version: master
- Python version: 3.7
- Operating System: Windows 10
- .NET Runtime: .NET 4.8
Details
- Describe what you were trying to get done.
Calling .NET methods from Python
- What commands did you run to trigger this issue?
Given a class like the following, any value you pass for address to the first MethodA will cause the exception underneath, it looks like because when needsResolution is true, the Converter will see the the value as an Int32 in GetTypeByAlias since in 3.7 there is no distinction between int and long anymore.
publicclassMethodResolutionInt{publicIEnumerable<byte>MethodA(ulongaddress,intsize){returnnewbyte[10];}publicintMethodA(stringdummy,ulongaddress,intsize){return0;}}
mri=MethodResolutionInt()data=list(mri.MethodA(0x1000,10))assertlen(data)==10assertdata[0]==0data=list(mri.MethodA(0x100000000,10))assertlen(data)==10assertdata[0]==0
- If there was a crash, please include the traceback here.
Python.Runtime.PythonException: Expected UInt64, got Int32The above exception was the direct cause of the following exception:Python.Runtime.PythonException: Expected UInt64, got Int32The above exception was the direct cause of the following exception:System.ArgumentException: Expected UInt64, got Int32 in method System.Collections.Generic.IEnumerable`1[System.Byte] MethodA(UInt64, Int32) ---> Python.Runtime.PythonException: Expected UInt64, got Int32 --- End of inner exception stack trace ---The above exception was the direct cause of the following exception:Python.Runtime.PythonException: Expected UInt64, got Int32The above exception was the direct cause of the following exception:System.ArgumentException: Expected UInt64, got Int32 in method System.Collections.Generic.IEnumerable`1[System.Byte] MethodA(UInt64, Int32) ---> Python.Runtime.PythonException: Expected UInt64, got Int32 --- End of inner exception stack trace ---The above exception was the direct cause of the following exception:System.AggregateException: One or more errors occurred. ---> System.ArgumentException: Expected UInt64, got Int32 in method System.Collections.Generic.IEnumerable`1[System.Byte] MethodA(UInt64, Int32) ---> Python.Runtime.PythonException: Expected UInt64, got Int32 --- End of inner exception stack trace --- --- End of inner exception stack trace ------> (Inner Exception #0) System.ArgumentException: Expected UInt64, got Int32 in method System.Collections.Generic.IEnumerable`1[System.Byte] MethodA(UInt64, Int32) ---> Python.Runtime.PythonException: Expected UInt64, got Int32 --- End of inner exception stack trace ---<---
I have a PR almost ready with A solution to the issue, but it may not be the correct solution.
Metadata
Metadata
Assignees
Labels
No labels