Skip to content
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

Generic method call fails #31

Open
jjxtra opened this issue Dec 17, 2020 · 1 comment
Open

Generic method call fails #31

jjxtra opened this issue Dec 17, 2020 · 1 comment

Comments

@jjxtra
Copy link

jjxtra commented Dec 17, 2020

I tried running the invocation of a generic typed method of a class and got an exception. Switching to use raw .NET reflection with MakeGenericMethod I was able to make the call.

I didn't see a test for this, so I may make a fork and submit a pr with a failing test.

@jbtule
Copy link
Member

jbtule commented Dec 17, 2020

Here is one

dynamitey/Tests/Invoke.cs

Lines 300 to 305 in 4297520

var @static = InvokeContext.CreateStatic;
var generic = InvokeMemberName.Create;
var tOut = Dynamic.InvokeMember(@static(typeof(StaticType)),
generic("Create",new[]{typeof(bool)}), 1);
Assert.AreEqual(false, tOut);

As I recall it will work without describing the generic arg, if it can can determine based on argument type, just like in C#.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants