Skip to content
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

String interpolation with nested quotes breaks Razor blocks. #4976

Closed
NTaylorMullen opened this issue May 19, 2015 · 5 comments
Closed

String interpolation with nested quotes breaks Razor blocks. #4976

NTaylorMullen opened this issue May 19, 2015 · 5 comments
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates bug This issue describes a behavior which is not expected - a bug. feature-razor-pages
Milestone

Comments

@NTaylorMullen
Copy link
Contributor

Today if you are to write the following:

@{
    $"abc{"123\""}.def";
}

You end up having a mismatch in curly braces. This is due to Razor not understanding the { syntax in string interpolation and therefore parsing the strings incorrectly.

@dougbu
Copy link
Member

dougbu commented May 19, 2015

@NTaylorMullen is this bug a bit larger? In particular does Razor understand \" in a quoted string and does the following get parsed correctly?

@{
  var variable = "abc\"}.def";
}

@NTaylorMullen
Copy link
Contributor Author

@dougbu Yup, Razor understands that. \" is understood when it thinks it's inside of a string 😄, that's why string interpolation sends it for a loop.

@NTaylorMullen NTaylorMullen self-assigned this Jun 1, 2015
@NTaylorMullen
Copy link
Contributor Author

Starting work on this to enable full support for: aspnet/Razor#338

@NTaylorMullen
Copy link
Contributor Author

After investigating this issue further turns out the requirements to complete this are pretty high (need to understand C# close to entirety at the Tokenizer level). Will revisit this later.

@Eilon
Copy link
Member

Eilon commented Aug 14, 2015

Moving to backlog because we feel these cases are not common in MVC views, and have trivial workarounds (e.g. use string.Format() instead of string interpolation).

@aspnet-hello aspnet-hello transferred this issue from aspnet/Razor Dec 14, 2018
@aspnet-hello aspnet-hello added this to the Backlog milestone Dec 14, 2018
@aspnet-hello aspnet-hello added 1 - Ready area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates bug This issue describes a behavior which is not expected - a bug. feature-razor-pages labels Dec 14, 2018
@pranavkm pranavkm added the c label Aug 20, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Dec 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates bug This issue describes a behavior which is not expected - a bug. feature-razor-pages
Projects
None yet
Development

No branches or pull requests

6 participants