Skip to content
This repository was archived by the owner on Dec 19, 2018. It is now read-only.
This repository was archived by the owner on Dec 19, 2018. It is now read-only.

Sections within partial views shouldn't fail silently #79

@javiercn

Description

@javiercn

If you define a section in your layout page, that section can only be "filled" from within the main view (Index.cshtml for example). If you try to do

@section mySection{
}

from a partial view, razor will just ignore the section which leads to a lot of confusion as it fails silently (ignores the section). This is specially troubling when you are rendering a non visible element (like a script) in the section.

We could improve the behavior by:

  1. Allowing the section to be rendered anywhere, but enforcing just one render per section name. (If two components try to render the same section we'll fail).
  2. Do not allow to render section within partial views but throw an exception.
  3. Provide a clear warning by using tooling.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions