-
Notifications
You must be signed in to change notification settings - Fork 2.1k
"page" variable in Razor breaks in 2.0? #6931
Comments
Yup this is indeed a bug in 2.0.0, see #6706 We will have this fixed in the upcoming 2.0 patch. Sorry you ran into this! |
#6706 tracks the use of 'page' as a route parameter when not using razor pages. This is about the usage in Razor code. Unfortunately any new directive we add becomes a reserved word in Razor. |
Which is fine, but please include it in the upgrade documentation. Right now, it's an undocumented breaking change. |
@Daniel15 I posted aspnet/Announcements#272 in our list of breaking changes. Sorry for missing this! (These announcement issues are linked to from the migration doc at https://docs.microsoft.com/en-us/aspnet/core/migration/1x-to-2x/) |
@John0King well, for now it's too late to change it because it already shipped. But that's something good for us to keep in mind when adding other new directives or reserved words. |
@Eilon My concern is that and other side, change current razor pages to use new directive is easy, search every .cshtml file and replace |
I have a
_Pagination.cshtml
view that uses apage
variable, like this:After upgrading from 1.1 to 2.0, I'm hitting this error:
I guess this is due to Razor pages (https://docs.microsoft.com/en-us/aspnet/core/mvc/razor-pages/) using the
@page
directive (and thus disallowing usage of variables calledpage
within Razor), however, shouldn't this be mentioned in the upgrade notes? It's not in the migration docs: https://docs.microsoft.com/en-us/aspnet/core/migration/1x-to-2x/The text was updated successfully, but these errors were encountered: