2

I am trying to update some custom DD4T templates to v2.2.1

When I run my template I get the following error in the Template Builder

Engine: Error in Engine.Transform
Engine: Error in Engine.Transform
Value cannot be null.
Parameter name: type
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at DD4T.Templates.Base.BaseTemplate.get_SerializerService()
   at DD4T.Templates.Base.BaseComponentTemplate.Transform(Engine engine, Package package)
   at Tridion.ContentManager.Templating.Assembly.AssemblyMediator.Transform(Engine engine, Template template, Package package)
   at Tridion.ContentManager.Templating.Assembly.CSharpSourceCodeMediator.RunTemplate(Engine engine, Package package, String templateUri, String className)
   at Tridion.Templating.CSharpTemplate.CSharpSourceTemplate.Transform(Engine __engine, Package __package)
   at Tridion.ContentManager.Templating.Assembly.CSharpSourceCodeMediator.Transform(Engine engine, Template template, Package package)
   at Tridion.ContentManager.Templating.Engine.ExecuteTemplate(Template template, Package package)
   at Tridion.ContentManager.Templating.Engine.InvokeTemplate(Package package, TemplateInvocation templateInvocation, Template template)
   at Tridion.ContentManager.Templating.Compound.CompoundTemplateMediator.Transform(Engine engine, Template templateToTransform, Package package)
   at Tridion.ContentManager.Templating.Engine.ExecuteTemplate(Template template, Package package)
   at Tridion.ContentManager.Templating.Engine.InvokeTemplate(Package package, TemplateInvocation templateInvocation, Template template)
   at Tridion.ContentManager.Templating.Engine.TransformPackage(Template template, Package package)
   at Tridion.ContentManager.Templating.Engine.TransformItem(Template template, IdentifiableObject itemToRender)
   at Tridion.ContentManager.Templating.Debugging.DebuggingEngine.Run()
   at Tridion.ContentManager.Templating.Debugging.DebugSession.Run()

This error occurs before my TransformPage() method is called, so it is really hard to debug. Does anyone have suggestions on what might cause this. I am using the DD4T.Templates.Base.dll from NuGet

UPDATE: So still no luck, but I downloaded the DD4T.Templates.Base, and tried debugging that, and it seems like in line# 39 of https://github.com/dd4t/DD4T.TridionTemplates/blob/develop/source/DD4T.Templates.Base/BaseTemplate.cs#L39 that Type t ends up being NULL, even though there is a value being returned from the package. Deeper inspection shows that the Binding of JSONSerializerService has an error because DD4T.Serialization is in both the GAC (my DLL does not use ILMerge) and in the default DD4T templates, so it doesn't know which to use.

Has anyone had any luck using two Template DLLs which both make use of TemplateBase?

1

Looking at the stack trace, I would say it fails somewhere in the following code https://github.com/dd4t/DD4T.TridionTemplates/blob/develop/source/DD4T.Templates.Base/BaseTemplate.cs#L36

So I would check:

  • Is there a serializer-type type specified in one of the TBB Parameters Schemas
  • Are you using the correct Parameters Schema on the TBB

If that doesn't help, then I guess you need to add the source code of the BaseTemplate and debug that part.

  • 1
    Hi Bart, I am pretty sure the parameters etc are correct. When my TBB is the first item in the Compound CT it works fine. However when I place it after "Generate dynamic component" which inserts an item in the package called 'serializer-type' with value 'DD4T.Serialization.JSONSerializerService' then the error is thrown. It almost seems like 'DD4T.Serialization.JSONSerializerService' is not a valid value – Chris Summers Aug 9 '17 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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