I have a custom Resolver configured for SDL Tridion 2011, which is designed to prevent the publication of pages and components that use the multimedia component when the user publishes the associated multimedia component. This custom resolver replaces the old event handler, which looks like this:
private void MMCmpPublishHandler(Component source, PublishEventArgs args, EventPhases phase) { if (source.ComponentType == ComponentType.Multimedia) { args.PublishInstruction.ResolveInstruction.IncludeComponentLinks = false; } }
An old event handler was called, which was called before resolvers was called. I configured my new resolver to start it after default by setting the Tridion.ContentManager.config file with the following extraction:
<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 intuitive (in terms of performance) to place a new resolver after the default recognizer, since by default the recognizer takes time to find all the allowed elements only so that they are all deleted again.
I tried to reorder the resolvers so that a 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 a custom resolver can be called up to the default resolution, and if not, can you suggest an effective way to achieve the same behavior as the old event handler?