Ganesan
Ganesan

Reputation: 109

System.Reflection.AmbiguousMatchException

I added Designer support for my control.

I got the following exception when setting the property value like below.

var colStyle = visibleColumn.Properties["PropertyName"].SetValue(Value);

The same above code works fine for VS 2010 project

but it shows the following exception for VS 2008 project

InnerException: System.Reflection.AmbiguousMatchException Message="Ambiguous match found." Source="mscorlib"

Upvotes: 1

Views: 1662

Answers (1)

Dan
Dan

Reputation: 921

Just a wild guess, but this may be due to a derived class having a property that is hiding the base class implementation, confusing the reflection mechanism.

If you use GetType().GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly).SetValue(target, value, null) it may fix the problem.

Upvotes: 4

Related Questions