Service Stack 4.0.15: Razor Partial not outputted

2019-08-12 16:46发布

问题:

Summary: Razor Partials don't get rendered inside a @section in ServiceStack 4. This seems to be a bug in ServiceStack.Razor.

Version: ServiceStack 4.0.15

Affected Package: ServiceStack.Razor

Razor partials inside a section does not get rendered.

Example

Inside _Layout.cshtml

@RenderSection("JavascriptConfig", required: false)

Inside home.cshtml

@section JavascriptConfig {
    @Html.Partial("_routes", Model.Lang)
}

Inside _routes.cshtml

@model string
test

If I look at the source code of the rendered View, there is no HTML outputted.

回答1:

I reported the issue on Github and a fix was posted in less than 19 hours! So, this issue is no longer an issue as of ServiceStack 4.0.16 (pre-release)

https://github.com/ServiceStack/Issues/issues/60