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:
System.Reflection.BindingFlags.InvokeMethod,
null,
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
Baffled.
Any ideas?

Sam HobbsRank #108 · 20.5K reputationPosted Feb 2, 2011, 10:41 AM EST
Andy Webster115 reputationPosted Feb 2, 2011, 10:52 PM EST
Suthish NairRank #92 · 22.8K reputationPosted Feb 3, 2011, 12:14 AM EST
Am not sure, refer forum. Saying by the bit configuration of project might helps.
Or setting a null value to the object.
Sam HobbsRank #108 · 20.5K reputationPosted Feb 3, 2011, 7:42 AM EST
You say that it worked when you were using VS 2008 but not VS 2010 and you assume there is a difference in VS that causes the problem. That is possible but unlikely. My guess is that there is something else that is different and you are assuming there is not. Suthish suggested the possibility that the bit configuration might be different. If there is anything else that is different, then we don't have the information needed to help you.
When I said that you "need to use VS to write an application" I was just responding to the question as it was written. You said it works in VS and I said you need to execute it in an application.
Andy Webster115 reputationPosted Feb 4, 2011, 6:23 AM EST
Regards
Andy
Sam HobbsRank #108 · 20.5K reputationPosted Feb 4, 2011, 8:06 AM EST
Look in the project properties to find the bit configuarion setting; I forget what it is called. What is it? If it is not 32-bit then you probably just need to change it to 32-bit (I think it is called x86).
Andy Webster115 reputationPosted Feb 4, 2011, 9:39 AM EST
Sam HobbsRank #108 · 20.5K reputationPosted Feb 4, 2011, 3:05 PM EST
The thing you need to do is to determine what value it is that it is complaining about, but I have no idea how to do that. You still have not made clear what the difference is between the two projects; I assume you have two separate projects for each of VS 2008 and VS 2010. There are other details that would also help that are not provided here.
Andy Webster115 reputationPosted Feb 8, 2011, 1:56 AM EST
Sam HobbsRank #108 · 20.5K reputationPosted Feb 8, 2011, 6:29 AM EST