-
Notifications
You must be signed in to change notification settings - Fork 224
2.0 TagHelper 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 #1614
Comments
From @GarageWeb on August 14, 2017 0:39 Also, adding RenderBody() in addition to the section does not change the outcome. |
From @pranavkm on August 14, 2017 16:16 |
Investigating. |
@GarageWeb thank you for the report. This is definitely a bug on our end! |
After investigating; the reason why this occurs is due to when our |
@danroth27 could you include this in known 2.0.0 issues: "Using |
@Eilon - patch candiate?
|
- The `DirectiveRemovalPass` runs at `DefaultFeatureOrder + 50` in order to allow the design time directive tokens pass to consume directive intermediate nodes; however, this has a side effect of leaving around the original `@section` nodes a bit too long. The `ModelExpressionPass` would see two references to the sections body (`SectionIntermediateNode` and `DirectiveIntermediateNode`) and then do its work twice. To combat this behavior I bumped the ModelExpressionPass order to be 50 points higher than the directive removal pass. - Added MVC tests for current and 1_X extensions. #1614
@rynowak definitely. |
Logged #1618 to track porting to a 2.0.1 patch. |
- Changed `SectionDirectivePass` to move non-token body nodes from the original `DirectiveIntermediateNode` to the `SectionIntermediateNode`. By doing this there's no longer dual references of `SectionIntermediateNode` bodies. - Added MVC tests for current and 1_X extensions. #1614
- Changed `SectionDirectivePass` to move non-token body nodes from the original `DirectiveIntermediateNode` to the `SectionIntermediateNode`. By doing this there's no longer dual references of `SectionIntermediateNode` bodies. - Added MVC tests for current and 1_X extensions. #1614
- Changed `SectionDirectivePass` to move non-token body nodes from the original `DirectiveIntermediateNode` to the `SectionIntermediateNode`. By doing this there's no longer dual references of `SectionIntermediateNode` bodies. - Added MVC tests for current and 1_X extensions. #1614
Is there a solution for this or do I abandon all work for 6 months and go on welfare.? |
@Gaelmart we have it fixed in the 2.1.0 pre-release branch, and we're also working on fixing this in the 2.0.1 patch. |
How do I get the 2.1.0 pre-release branch? |
@Gaelmart the |
Is there any ETA on 2.0.1? I cannot switch to the MyGet feeds for this, and this issue is breaking the 2.0 upgrade for me right now. |
From @GarageWeb on August 13, 2017 18:57
Starting with a default core 2.0 project, you get an error if you render a section from a layout in a view with an InputTagHelper. If you RenderBody in the layout instead, no issue.
Here is a super bare bones project illustrating the issue: https://github.com/GarageWeb/ModelErrorExample
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
Copied from original issue: aspnet/Mvc#6652
The text was updated successfully, but these errors were encountered: