champ
champ copied to clipboard
Bootstrap _layout.cshtml causes Razor error
When building the bootstrap project with Champ I get the following error:
Unhandled Exception: Xipton.Razor.Core.TemplateBindingException: Runtime binding error: Model type 'champ.PageModel' does not contain a definition
for 'page' ---> Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'champ.PageModel' does not contain a definition for 'page'
at CallSite.Target(Closure , CallSite , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
at Xipton.Razor.Generated._layout.Execute()
at Xipton.Razor.TemplateBase.Xipton.Razor.Core.ITemplateController.Execute()
--- End of inner exception stack trace ---
at Xipton.Razor.TemplateBase.Xipton.Razor.Core.ITemplateController.Execute()
at Xipton.Razor.TemplateBase.Xipton.Razor.Core.ITemplateController.ApplyLayout(ITemplateController layoutTemplate)
at Xipton.Razor.TemplateBase.Xipton.Razor.Core.ITemplateController.TryApplyLayout()
at Xipton.Razor.RazorMachine.ExecuteUrl(String templateVirtualPath, Object model, Object viewbag, Boolean skipLayout, Boolean throwExceptionOnVirtualPathNotFound)
at Xipton.Razor.RazorMachine.ExecuteContent(String templateContent, Object model, Object viewbag, Boolean skipLayout)
at System.Dynamic.UpdateDelegates.UpdateAndExecute4[T0,T1,T2,T3,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3)
at champ.SiteBuilder.ProcessPageNode(PageNode page)
at champ.SiteBuilder.TryProcessPageNode(PageNode page, String& renderedContent)
at champ.SiteBuilder.ProcessPages(Node node)
at champ.SiteBuilder.ProcessPages(Node node)
at CallSite.Target(Closure , CallSite , SiteBuilder , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2[T0,T1](CallSite site, T0 arg0, T1 arg1)
at champ.SiteBuilder.Run()
at champ.Program.Main(String[] args)
This is caused by the use of the @Model.page.Title property call (note the small-cap in page). The error can be resolved by changing page to Page (again note the capital) on lines 12 and 29.
Thanks! I'll fix this and update.
I'm getting the same error. Would really like to try out champ, but can't because of this.