I can't get a dynamic method on an ExpandoObject to be directly callable in VB.NET. In C# the following works:
dynamic obj = new System.Dynamic.ExpandoObject();
var called = false;
obj.ForceRefresh = new Action(() => called = true);
obj.ForceRefresh();
I'd have thought the same thing in vb.net would be:
Dim called = False
Dim obj As Object = New Dynamic.ExpandoObject
obj.ForceRefresh = New Action(Sub() called = True)
obj.ForceRefresh() 'No default member found for type 'Action'.
obj.ForceRefresh.Invoke() 'this works
the obj.ForceRefresh
throws 'No default member found for type 'Action'
It works if I put an Invoke, but that's not an option (this is a very simplified example of a moq unit test, the objects being tested will call the functions so I can't change them)
Is there a way of setting up the dynamic method in vb.net so I can call it without the invoke?