I have pushed a package variable of type "ComponentPresentationList" with name "MainSectionComponents". I have written razor template code to render the componentpresentation list.
@foreach (var cp in Package.MainSectionComponents) {
@cp.RenderComponentPresentation()
}
When I try to run it in template builder I get following exception.
DynamicItemFields: Key 'rendercomponentpresentation' Not Found In ItemFields Cannot perform runtime binding on a null reference at CallSite.Target(Closure , CallSite , Object ) at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0) at CallSite.Target(Closure , CallSite , Object ) at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0) at Tridion.Extensions.Mediators.Razor.Templating.Rzr881cef20770a4632b97928a77eaf9c6dTemplate.Execute() at Tridion.Extensions.Mediators.Razor.RazorHandler.CompileAndExecute(DateTime revisionDate, Engine engine, Package package) at Tridion.Extensions.Mediators.Razor.RazorMediator.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.Debugging.DebuggingEngine.Run() at Tridion.ContentManager.Templating.Debugging.DebugSession.Run()
Can somebody please guide me in the right direction ?