c# - Nancy Razor partial views do not render in release mode -
partial views render in debug mode not release mode.
stack trace
[argumentnullexception: value cannot null. parameter name: key] system.collections.concurrent.concurrentdictionary`2.getoradd(tkey key, func`2 valuefactory) +5895838 nancy.viewengines.defaultviewcache.getoradd(viewlocationresult viewlocationresult, func`2 valuefactory) +329 nancy.viewengines.razor.razorviewengine.getorcompileview(viewlocationresult viewlocationresult, irendercontext rendercontext, assembly referencingassembly, type passedmodeltype) +186 system.dynamic.updatedelegates.updateandexecute5(callsite site, t0 arg0, t1 arg1, t2 arg2, t3 arg3, t4 arg4) +401 callsite.target(closure , callsite , razorviewengine , viewlocationresult , irendercontext , assembly , object ) +575 nancy.viewengines.razor.razorviewengine.getviewinstance(viewlocationresult viewlocationresult, irendercontext rendercontext, assembly referencingassembly, object model) +1128 system.dynamic.updatedelegates.updateandexecute5(callsite site, t0 arg0, t1 arg1, t2 arg2, t3 arg3, t4 arg4) +401 callsite.target(closure , callsite , razorviewengine , viewlocationresult , irendercontext , assembly , object ) +495 nancy.viewengines.razor.<>c__displayclass1f.<renderview>b__1e(stream stream) +470 nancy.viewengines.razor.htmlhelpers`1.partial(string viewname, object modelforpartial) +1872 razoroutput.razorview.<execute>b__3() +632 nancy.viewengines.razor.nancyrazorviewbase`1.executeview(string body, idictionary`2 sectioncontents) +374 nancy.viewengines.razor.<>c__displayclass1f.<renderview>b__1e(stream stream) +775 nancy.hosting.aspnet.nancyhandler.processrequest(httpcontextbase context) +81 system.web.callhandlerexecutionstep.system.web.httpapplication.iexecutionstep.execute() +913 system.web.httpapplication.executestep(iexecutionstep step, boolean& completedsynchronously) +165
master.cshtml (relevant section only)
@if (issectiondefined("sidebar")) { <div id="two-col"> @renderbody() </div> <div id="sidebar"> @rendersection("sidebar") </div> } else { <div id="one-col"> @renderbody() </div> }
index.cshtml
@inherits nancy.viewengines.razor.nancyrazorviewbase<dynamic> @{ layout = "master.cshtml"; } // html body, doesn't use model @section sidebar { @html.partial("/sidebars/sidebar.cshtml", model) }
sidebar.cshtml (sample section)
<ul> @foreach (var item in model.items) { <li>@html.raw(@item.displaytext)</li> } </ul>
i had problem recently, linked master layout pages. looking @ index page 1 of 2 things, me, path master page or path partial. if remove leading slash on partial url or if master page in shared folder, add full path url (without leading slashes or ~/).
this found solution. https://groups.google.com/forum/#!topic/nancy-web-framework/zrlth_hl2r8
hth
Comments
Post a Comment