The Problem
You start your Optimizely CMS 12 application and get this error:
System.Reflection.AmbiguousMatchException:
Ambiguous match found for property 'Category'
Your application won't start. The CMS can't load content types.
Why It Happens
You have two properties with the same name in your content type.
This usually happens when:
- You have a property in your base class
- You add the same property name in your derived class
- Or you shadowed a property using the
newkeyword
Example of the problem:
// Base class (in Optimizely)
public class ContentData
{
public virtual ContentReference Category { get; set; }
}
// Your class
public class ArticlePage : PageData
{
// ❌ ERROR: This creates a duplicate!
public virtual ContentReference Category { get; set; }
}
The Solution
Simply rename your property to something unique.
That's it. No SQL. No database cleanup. Just rename the property.
Before (Broken):
public class ArticlePage : PageData
{
[Display(Name = "Category")]
public virtual ContentReference Category { get; set; } // ❌ Duplicate!
}
After (Fixed):
public class ArticlePage : PageData
{
[Display(Name = "Category")]
public virtual ContentReference ArticleCategory { get; set; } // ✅ Unique name
}
That's all you need to do.
Step-by-Step Fix
- Find the error in your logs to see which property is duplicated
- Locate the content type causing the issue
- Rename the property to something unique
- Restart your application
Done.
Common Mistakes
Mistake 1: Using new Keyword
// ❌ DON'T DO THIS
public class ArticlePage : PageData
{
public new ContentReference Category { get; set; }
}
The compiler allows it, but Optimizely's reflection engine doesn't.
Mistake 2: Shadowing Base Properties
// If base class has "Category"
public class MyPage : BasePage
{
// ❌ DON'T duplicate the name
public virtual ContentReference Category { get; set; }
}
Solution: Always check your base class for existing property names.
How to Prevent This
- Use unique property names in your content types
- Check base classes before adding new properties
- Never use the
newkeyword on CMS properties - Use prefixes if needed (e.g.,
ArticleCategoryinstead ofCategory)
Common Questions
Q: Will I lose my content data?
A: No. When you rename a property, Optimizely creates a new property definition. Old data stays in the database but won't be displayed until you migrate it.
Q: Do I need to run SQL scripts?
A: No. Just rename the property in your code. Optimizely handles the rest.
Q: What about existing content?
A: Existing content will show empty values for the renamed property. You may need to re-enter data or create a migration script if you have a lot of content.
Real Example
I had an ArticlePage with a Category property. Turns out PageData or one of my base classes already had a Category property.
My fix:
// Changed from:
public virtual ContentReference Category { get; set; }
// To:
public virtual ContentReference ArticleCategory { get; set; }
Application started immediately after rebuild.
Summary
Problem: AmbiguousMatchException error
Cause: Duplicate property name
Solution: Rename the property to something unique
Time to fix: 2 minutes
That's it. No complicated database work needed.