Skip to main content
1 of 2
Pete Navarra
  • 14.7k
  • 3
  • 45
  • 89

How to solve ambiguous constructors when trying to start Sitecore

We have a local Sitecore 9.0.2 installation that is relatively vanilla. It is currently failing to load the Configuration Manager because of the following error message.

Server Error in '/' Application. Unable to activate type 'Sitecore.Marketing.xMgmt.Observers.Activation.PublishItemObserver`1[Sitecore.Marketing.Definitions.Campaigns.ICampaignActivityDefinition]'. The following constructors are ambigious: Void .ctor(Sitecore.Marketing.xMgmt.Observers.IPublishTargetResolver, Sitecore.Marketing.IItemRepositoriesSettings) Void .ctor(Sitecore.Marketing.xMgmt.Observers.IPublishTargetResolver, Sitecore.Data.Database) Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Unable to activate type 'Sitecore.Marketing.xMgmt.Observers.Activation.PublishItemObserver`1[Sitecore.Marketing.Definitions.Campaigns.ICampaignActivityDefinition]'. The following constructors are ambigious: Void .ctor(Sitecore.Marketing.xMgmt.Observers.IPublishTargetResolver, Sitecore.Marketing.IItemRepositoriesSettings) Void .ctor(Sitecore.Marketing.xMgmt.Observers.IPublishTargetResolver, Sitecore.Data.Database)

This error goes away when we disable EXM in the Web.config.

More specifically, this error goes away if we comment out the Event Handlers loaded in the Sitecore.EmailExperience.ContentManagement.config listed here.

<events>
  <event name="item:added">
    <handler type="Sitecore.Modules.EmailCampaign.Core.ItemEventHandler, Sitecore.EmailCampaign" method="OnItemAdded" resolve="true" />
  </event>

  <event name="item:copied">
    <handler type="Sitecore.Modules.EmailCampaign.Core.ItemEventHandler, Sitecore.EmailCampaign" method="OnMessageCopied" resolve="true" />
  </event>

  <event name="item:created">
    <handler type="Sitecore.Modules.EmailCampaign.Core.RootItemEventHandler, Sitecore.EmailCampaign" method="OnRootCreated" resolve="true" />
  </event>

  <event name="item:deleted">
    <handler type="Sitecore.Modules.EmailCampaign.Core.RootItemEventHandler, Sitecore.EmailCampaign" method="OnRootDeleted" resolve="true" />
    <handler type="Sitecore.Modules.EmailCampaign.Core.ItemEventHandler, Sitecore.EmailCampaign" method="OnItemDeleted" resolve="true" />
  </event>

  <event name="subscriber:assigned" />
</events>

This has to be environmental, as it seems to only be an issue on one laptop. However, I cannot figure out what part of the environment is causing this issue.

Obviously, the fix isn't to keep EXM disabled or to comment out these event handlers.

Does anyone have an answer as to how to solve ambiguous constructor issues, like this one above?

Pete Navarra
  • 14.7k
  • 3
  • 45
  • 89