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?