Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Closed Issue: Breaking razor change reports incorrect error, "} expected" [390]

$
0
0
in v1, the following was legal (in that: it worked) in razor, in a code region:

string foo = @Some.Complex.Expression;

obviously the @ is redundant, but: it worked. When upgrading to v2, it errors (which I could respect), but **in the wrong way**. It *should* say something about the @ being illegal in that syntax; instead, this can manifest in "} expected", especially if this is inside an if-block etc. The correct code is of course:

string foo = Some.Complex.Expression;

but the error message "} expected" makes the developer look for the wrong thing.
Comments: Hey Marc, This is a really great comment. We discovered this a while ago as well, and it's unfortunate that this doesn't work, as the @ is a valid C#, but it collides with the Razor @. Your suggestion is correct, and the code should be written without the @. However fixing the parser is rather complex, and we are concerned with introducing regressions for this case. So we decided not to fix. If you feel strongly that this is critical please let us know. Thanks The MVC team.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>