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:
R&D department have confirmed that the issue you have found is a defect staring with the migration to SP1. It is now no longer possible to place a custom resolver before the default resolver.The issue is expected to be handled in a future release.
It is certainly possible to call your resolver first, however you will need it to create the initial list of resolved items. Since that is basically what the default resolver already does, it doesn't make much sense trying to add yours in front of it in my mind.
So yes performance wise it would make more sense to only have your resolver and have it replace the default one. But then you should really decompile the default one and rewrite it with your logic in there. Which is counter productive certainly considering hotfixes and upgrades would mean your resolver code might need to change in the future.
I found that the resolvers actually are so fast that I ignored the performance impact of removing the few items I needed removed in mine. It realistically is only adding items to a list and then you are removing a few of those items from the list again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With