• Publisert
  • 1 min

AmbiguousMatchException when updating from PTB 1.3.0.0 to PTB 2.0

<p>When updating from PTB 1.3.0.0 to PTB 2.0.0.0 I got this error: "System.Reflection.AmbiguousMatchException: Ambiguous match found."</p>

Stack trace showed that PageTypeBuilder (PTB) was involved. I checked every reference to both PTB and EPiServer, since the error originated from the  DataFactory.Instance.GetChildren call. The problem however was that it was an error with the pagetypedefinition of one of the child pages. One specific pagetype had a page property named 'TargetFrame', witch unfortunately was hidding PageTypeBuilders own property.

I got a warning about this when building the application, but I didn't think it would result in an runtime error..:
ArticlePage.TargetFrame' hides inherited member 'PageTypeBuilder.TypedPageData.TargetFrame'. Use the new keyword if hiding was intended.

Ambiguous match found

So why an ambiguous match error..? I suppose that the TargetFrame property was both found in my custom pagetype library and in PageTypeBuilder.dll. The solution was to rename my page property to something else.

Lesson: Always remove warnings!!