Ambiguous match found - thrown from ContentData Metadata Provider

April 27, 2015

I’m in the middle of a big upgrade from CMS6R2 to 7.19.2 and I faced an interesting problem.

ambiguous_match.png

It seemed that EPiServer was not able to match interface literal to a valid type. I decided to dig in to EPiServer core to find out what the problem is:

code.png

propertyWithAttributes is then passed to a special method that tries to extract the typename and propertyname.

private static PropertyInfo GetPropertyInfoFromInterface(Type modelType, string propertyWithAttributesName)
{
 string[] strArray = propertyWithAttributesName.Split(new char[] { '_' });
 if ((strArray.Length == 2) && (modelType.GetInterface(strArray[0], true) != null))
 ...

As you can see the interface is not fully qualified (it should be episerver.core.icontent_name) and unfortunately we had an interface IContent in our codebase (used for different purposes) which effectively prevented it from working... After we changed our internal IContent to a different name, everything started to work.