Andy Webster

Andy Webster

  • NA
  • 117
  • 0

VC# 2008 interop code not working on VC# 2010

Feb 2 2011 12:58 PM
Hi

I am using VS 2010 Express and have ported some code proven in VS 2008 but it fails in VS 2010 and I cannot understand why.

The code uses InvokeMember:

<object>.Interface.GetType().InvokeMember("<Method Name>",
                                System.Reflection.BindingFlags.InvokeMethod,
                                null, <Object>.Interface, new object[] { <params> });

It works fine in VS 2008 but not in VS 2010, exception thrown is "Value does not fall within the expected range." The code and references are identical, the <object> is not null.

Baffled.

Any ideas?

Answers (10)