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

Razor Pages Error with Section and TagHelpers #6964

Closed
RandyBuchholz opened this issue Oct 17, 2017 · 1 comment
Closed

Razor Pages Error with Section and TagHelpers #6964

RandyBuchholz opened this issue Oct 17, 2017 · 1 comment

Comments

@RandyBuchholz
Copy link

RandyBuchholz commented Oct 17, 2017

Razor pages throws an error when working with sections.
PostData is class declared inside the backing cs file.

This works

<label asp-for="PostData.PostId"></label>
@section detailsSection {
}

Moving the TagHelp into a section produces and error.
A local or parameter named '__model' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter

@section detailsSection {
    <label asp-for="PostData.PostId"></label>
}

Moving it to a partial works

@section detailsSection {
    @Html.Partial("PostData", @Model.PostData)
}
@NTaylorMullen
Copy link

Hi @RandyBuchholz this is a known issue. Stay tuned for a patch release that fixes this 😄

Duplicate: aspnet/Razor#1614

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants