It looks like I come across a bug on Tridion API's, while working on DotNet Templating using Tridion 2011 SP1.

ICollection<PublishInfo> publishInfos = PublishEngine.GetPublishInfo(mIdentifiableObject);

While executing GetPublishInfo for Component Template, method returns ICollection of PublishInfo Objects.

Here PublishInfo has properties like

  • Publicaton
  • PublicationTarget
  • PublishedAt
  • PublishedBy
  • RenderedWith

Here, RenderedWith returns of type Template.

When we execute GetPublishInfo for Component Template, RenderedWith property will have Component as value (which is correct).

But unfortunately, RenderedWith supports only of type Template.

Due to this, we get error as

Unable to cast object of type 'Tridion.ContentManager.ContentManagement.Component' to type 'Tridion.ContentManager.CommunicationManagement.Template'

Now my question is,

Is anyone come across with this problem. If so, how you fixed?

1 Answer 1


Two ways to fix the problem,

  1. Raise a support ticket, which might take some turnaround time for getting the solution
    • However, RenderedWith should return of type VersionedItem rather than Template
  2. Have a workaround fix on the template for time-being

Workaround fix:

private static readonly PropertyInfo mCurrentStateProperty = typeof(PublishInfo).GetProperty("CurrentState", BindingFlags.Instance | BindingFlags.NonPublic);

ICollection<PublishInfo> publishInfos = PublishEngine.GetPublishInfo(mIdentifiableObject);

IEnumerable<IdentifiableObject> identifiableObjectList = publishInfos.Select((i) =>
        PublishInfoData publishInfoData = mCurrentStateProperty.GetValue(i, BindingFlags.Instance | BindingFlags.NonPublic, null, null, null) as PublishInfoData;

        if (publishInfoData != null)
            return GetObject(publishInfoData.RenderedWith.IdRef);

        return null;

Finally, Customer Support has provided a hotfix (CM_2011.1.2.87741) on top of Tridion 2011 SP1-HR2

Hotfix 'CM_2011.1.2.87741'

With the hotfix, a new property ("RenderedItem") has been introduced. RenderedItem is of type IdentifiableObject

  • Even if you implement the work around, I'd appreciate if you report it via customer support so that we can fix it - maybe it has already been fixed in newer versions, can't check it now.
    – Nuno Linhares
    Feb 23, 2014 at 14:27
  • @NunoLinhares: Yeah, I already informed my support team to raise the support ticket. Feb 23, 2014 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.