You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Array.CreateInstance(<type>, System.Int32[]) results in 'TypeError: No method matches given arguments' in v2.5.0 #1187
changed the title [-]Array.CreateInstance(<type>, System.Int32[]) results in 'TypeError: No method matches given arguments[/-][+]Array.CreateInstance(<type>, System.Int32[]) results in 'TypeError: No method matches given arguments' in v2.5.0[/+]on Jul 18, 2020
Python 3.8.0 (default, Nov 6 2019, 16:00:02) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
Hmm, I'll give that a try locally. The "type" it lists there is correct for Python, CLR.CLR Metatype (awful name...) is the Python type for System.Type objects, but it seems like the method binding doesn't make that link anymore.
Okay, then it's indeed #1106. That change actually improved things, in that it allows "proper" use of params arrays (like CreateInstance uses). You can fix your code by changing
I'm not yet completely sure whether we want to fix it (we definitely want to keep the feature, maybe we can still allow the direct passing of the array as a fallback), but I acknowledge breakage :)
/edit: Actually you can even drop the whole copy-to-.net part and replace it by
I've gone over my code snippet from before and made fixes similar to what @filmor suggested, although it needed an additional change to support complex data types. I put together a gist this time:
Activity
[-]Array.CreateInstance(<type>, System.Int32[]) results in 'TypeError: No method matches given arguments[/-][+]Array.CreateInstance(<type>, System.Int32[]) results in 'TypeError: No method matches given arguments' in v2.5.0[/+]lostmsu commentedon Jul 18, 2020
Hm, @pkthong can you double check your code? When I do
str(Int32)in the latest build, I get<class 'System.Int32'>, not<class 'CLR.CLR Metatype'>.pkthong commentedon Jul 21, 2020
Python 3.8.0 (default, Nov 6 2019, 16:00:02) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
This at commit-ish (7a9dcfa )
filmor commentedon Jul 21, 2020
Hmm, I'll give that a try locally. The "type" it lists there is correct for Python,
CLR.CLR Metatype(awful name...) is the PythontypeforSystem.Typeobjects, but it seems like the method binding doesn't make that link anymore.pkthong commentedon Jul 21, 2020
Running through the changes between v2.4.0 and v2.5.0, the last commit that works for the above test is (4a92d80)
filmor commentedon Jul 21, 2020
Okay, then it's indeed #1106. That change actually improved things, in that it allows "proper" use of
paramsarrays (likeCreateInstanceuses). You can fix your code by changingto
I'm not yet completely sure whether we want to fix it (we definitely want to keep the feature, maybe we can still allow the direct passing of the array as a fallback), but I acknowledge breakage :)
/edit: Actually you can even drop the whole copy-to-.net part and replace it by
pkthong commentedon Jul 21, 2020
The above suggestion seems to execute, yet accessing the array results in a System.AccessViolationException.
To reproduce this, add the following to the test code.
robbmcleod commentedon May 6, 2021
I've gone over my code snippet from before and made fixes similar to what @filmor suggested, although it needed an additional change to support complex data types. I put together a gist this time:
https://gist.github.com/robbmcleod/73ca42da5984e6d0e5b6ad28bc4a504e
lostmsu commentedon Sep 16, 2022
I believe this should be fixed in 3.0. Please reopen if not.