I have a Custom Resolver configured for SDL Tridion 2011 which is designed to prevent Pages and Components which use a Multimedia Component from being published when a user publishes the linked Multimedia Component. This Custom Resolver is replacing an old event handler which looked like this:
private void MMCmpPublishHandler(Component source, PublishEventArgs args,
EventPhases phase)
{
if (source.ComponentType == ComponentType.Multimedia)
{
args.PublishInstruction.ResolveInstruction.IncludeComponentLinks = false;
}
}
The old event handler used to be called before the resolvers were invoked. I have configured my new resolver to fire after the default the resolver by configuring my Tridion.ContentManager.config file with the following extract:
<add itemType="Tridion.ContentManager.ContentManagement.Component">
<resolvers>
<add type="Tridion.ContentManager.Publishing.Resolving.ComponentResolver" assembly="Tridion.ContentManager.Publishing, Version=6.1.0.996, Culture=neutral, PublicKeyToken=360aac4d3354074b"/>
<add type="UrbanCherry.Net.SDLTridion.CustomResolvers.DynamicBinaryLinkResolver" assembly="UrbanCherry.Net.SDLTridion.CustomResolvers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e7729a00ff9574fb"/>
</resolvers>
</add>
The code works fine, although it seems counter intuitive (from a performance perspective) to place the new resolver after the default resolver as the default resolver takes time to find all the resolved items only to have them all removed again.
I tried changing the order of the resolvers so that the new resolver is called first, but the new resolver is never called, and the following error appears in the event log:
Object reference not set to an instance of an object.
Component: Tridion.ContentManager.Publishing
Errorcode: 0
User: NT AUTHORITY\SYSTEM
StackTrace Information Details:
at Tridion.ContentManager.Publishing.Resolving.ResolveEngine.ResolveItems(IEnumerable`1 items, ResolveInstruction instruction, IEnumerable`1 contexts)
at Tridion.ContentManager.Publishing.Resolving.ResolveEngine.ResolveItem(IdentifiableObject item, ResolveInstruction instruction, PublishContext context)
at Tridion.ContentManager.Publishing.Handling.DefaultPublishTransactionHandler.HandlePublishRequest(PublishTransaction publishTransaction)
at Tridion.ContentManager.Publishing.Handling.DefaultPublishTransactionHandler.ProcessPublishTransaction(PublishTransaction publishTransaction)
at Tridion.ContentManager.Publishing.Publisher.QueueMessageHandler.HandleMessage()
Does anyone know if it is possible to call a Custom Resolver before a Default Resolver, and if not can you suggest an efficient way to achieve the same behavior as the old event handler?
We have opened an incident request to Tridion SDL support. Please find below their answer: