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
I have a class that I'm creating dynamically via Dynamic.InvokeConstructor that has params arguments. If I pass in 14 arguments it works, but 15 causes an InvalidCastException:
System.InvalidCastException: The result type 'MyClass' of the dynamic binding produced by binder 'Microsoft.CSharp.RuntimeBinder.CSharpInvokeConstructorBinder' is not compatible with the result type 'System.Type' expected by the call site.
The workaround doesn't seem to work for me; I'd have to cast my parameters to 'string' rather than 'object'. I also need to be able to construct types with signatures like:
public MyClass(string firstArg, params string[] otherArgs)
and I was relying on the library to sort that out for me.
from ekonbenefits/impromptu-interface#9: by @jdh28
I have a class that I'm creating dynamically via
Dynamic.InvokeConstructor
that has params arguments. If I pass in 14 arguments it works, but 15 causes an InvalidCastException:System.InvalidCastException: The result type 'MyClass' of the dynamic binding produced by binder 'Microsoft.CSharp.RuntimeBinder.CSharpInvokeConstructorBinder' is not compatible with the result type 'System.Type' expected by the call site.
Here is some example code:
The text was updated successfully, but these errors were encountered: