❔ TargetParameterCountException when trying to create a delegate from a method
I am trying to call the following private extern method via reflection:
The out parameters make this slightly more difficult, and the last BlittableArrayWrapper is also a ref struct.
So here i go, i find the method and try to create the delegate and call it:
However upon creating the delegate i get a TargetParameterCountException, though i'm very confident i have the same parameter counts.
3 Replies
Here with the debugger attached, In the bottom right you see the list of parameters.
Should i be making a delegate with an address-of the bounds and wrapper instead? Thats what
method.GetParameters()
returns. Im confused because it doesnt appear to be complaining about that, rather just the count of parameters...waitwaitwait
Oh no i think im calling an static method with an object target. Duhh
And the first arg would become the object reference, hence the exception
That was it!
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.