4

After calling IContentLibraryContext.GetItem() and IContentLibraryListItem.Id for a Multimedia item (EclItemTypes.File) the Tridion CME throws the following error. The exception does not show up in Visual Studio while attaced to the TcmServiceHost process so I think something in the Tridion ECL ran into something unexpected.

I have compared the code against the Flickr example implementation but cannot find what I would do wrong. Any ideas why this error would pop up?

Unable to cast object of type Tridion.ExternalContentLibrary.AddInPipeline.V2.HostSideAdapters.ContentLibraryItemContractToViewHostAdapter' to type 'Tridion.ExternalContentLibrary.AddInPipeline.V2.HostViews.IContentLibraryMultimediaItem'.

Error detail:

StackTrace Information Details: at Tridion.ExternalContentLibrary.DomainModel.ItemDataBuilder.ToFullItemData(IContentLibraryItem item, String stubSchemaId, StubItemListData stubItemListData, IDictionary2 displayTypes) at Tridion.ExternalContentLibrary.DomainModel.FileItemDataBuilder.BuildResultListItemData() at Tridion.ExternalContentLibrary.Service.EclService2012.GetFile(EclUri eclUri, Func3 getStubId, Action1 stubItemManipulations, Nullable1 openMode) at Tridion.ExternalContentLibrary.Service.EclService2012.GetItem(String itemUri, Int32 openMode) at SyncInvokeGetItem(Object , Object[] , Object[] ) at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at Tridion.ExternalContentLibrary.Service.TransactionSupportInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

1 Answer 1

5

For an item of the File type, make sure you return an instance of IContentLibraryMultimediaItem from GetItem and GetItems.

The exceptions can be a bit hard to read, as they originate from the code connecting the different versions of the contracts.

3
  • That's it! I implemented IContentLibraryItem instead of IContentLibraryMultimediaItem. The IContentLibraryMultimediaItem implements IContentLibraryItem which implements IContentLibraryListItem, that helps creating a clean implementation of all those items without having to duplicate a lot of code for getting parent ids and so on.
    – Jan H
    Oct 16, 2013 at 11:52
  • 1
    Yes, but then I'll have higher ranking than he does :) Oct 16, 2013 at 13:56
  • Lars, you already have a higher reputation.
    – Jan H
    Oct 16, 2013 at 16:27

Your Answer

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

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