-
-
Notifications
You must be signed in to change notification settings - Fork 39
Description
Hello Rick,
Thank you very much for this great project. We made use of the 'old' DotnetExtender but we have now rewriten the code to use your wwDotnetBridge.
I ran into a issue with the InvokeStaticMethod (aka InvokeStaticMethod_Internal) method. I have a Generic class definition like the sample code below:
(I use the () instead of the gt and lt characters else it is not shown in this post)
public class MyList(T) : List(T) {
public static string StaticMethod() {
return "this is a test";
}
}
And a class based on this generic definition like:
public class MyDerivedList : MyList(MyListElement) {
(no code for brevity)
}
In C# the class MyDerivedList now has the static method StaticMethod inherited from the base class MyList.
When I try to call the static method StaticMethod on the MyDerivedList class using the InvokeStaticMethod method of the wwDotnetBridge in VFP I get an error saying the method could not be found.
When I define the StaticMethod directly on the MyDerivedList class overriding the base class the InvokeStaticMethod works.
I traced the problem to the InvokeStaticMethod_Internal type.InvokeMember call. When I add the binding flag BindingFlags.FlattenHierarchy, the static method StaticMethod of the base class is found and invoked. Without the flag I get the 'not found' error again.
The normal, not static, methods inherited from the base class are invoked just fine without this binding flag in the CallMethodCom InvokeMember call.
I don't know the underlying reason of this issue and why the difference between the static and not static methods. But the binding flag just solved my problem.
Maybe you can incorporate the solution into the project.
Best Regards,
Wijnand