-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Razer escape @@ results in build error since SDK 8.0.400 #42730
Comments
This is an intentional breaking change in dotnet/razor#10232. We should certainly document it better, but when you're inside a C# context already, |
Also, for the error that you get when you change that to |
No, the error with @Class doesn't happen in the IDE, it only happens in runtime. Stack trace: Exception details: |
It looks like you are using runtime compilation (e.g., via |
Yes, we are using runtime compilation. The reason is that we have the design of our Razor pages defined in data. This allows us to modify pages (e.g. add new controls, change position, ...) and deploy them in the running app. Deploying in this case is just writing the new cshtml file out. This makes the design process super fast and easy without having to make a full release. |
Hot reloading should provide similar functionality (i.e., changing a cshtml file should result in the code changes being reflected in the running app without full rebuild). |
I can confirm that when I remove Looking at hot reloading, this seems to only work in the IDE, correct? We have the app currently deployed to a "development" environment with |
In IDE but also if you are running
cc @danroth27 for razor runtime compilation use case |
We deploy to an Azure WebApp, so that is not possible. So for the moment it looks like we have to disable razor runtime compilation so that we can work with the latest SDK. |
… the new lexer, these will once again be disallowed; attempting to use runtime compilation will necessitate using the native lexer.
In order to lessen the severity of this breaking change, we've decided to allow |
… the new lexer, these will once again be disallowed; attempting to use runtime compilation will necessitate using the native lexer.
I was looking into how to handle this for the moment so that we can use 8.0.400 SDK for our normal builds and the builds where we use runtime compilation use 8.0.304. It turned out that preprocessor directives didn't work as expected in .cshtml. |
Describe the bug
Since preview of 8.0.400 and now also in final version of 8.0.400 compilation of razor pages containing @@ fail with:
FileName.cshtml: error CS9008: Sequence of '@' characters is not allowed. A verbatim string or identifier can only have one '@' character and a raw string cannot have any.
To Reproduce
Any Razor page with code like this fails:
@{ var validationMessage = @Html.ValidationMessage(Model.Binding, "", new { @@class = "invalid-feedback" }, "div"); }
Changing from @@Class to @Class makes the dotNet compilation work, but then the Razor compilation fails with:
Error RZ1007: "class" is a reserved word and cannot be used in implicit expressions. An explicit expression ("@()") must be used.
The text was updated successfully, but these errors were encountered: