Escaped quotes in symbol parameter values lost or cause errors
See original GitHub issueWhen I try to pass quotation marks to a parameter from the command line, I either get an error or the produced content will not contain quotation marks.
Full details can be found in my sample repo notes, but here are some examples.
dotnet new repro-quotes-spaces --someparameter="something needing `"escaped quotes`" in it."
Results in this error:
Invalid input switch:
quotes in it.
If I remove the space within the quoted sub-string, there is no error, but the content it produces doesn’t have any quotation marks either.
dotnet new repro-quotes-spaces --someparameter="something needing `"escapedquotes`" (without spaces) in it."
Results in this text missing the expected quotes:
something needing escapedquotes (without spaces) in it.
Environment
- Windows 10 Pro 1803 and macOS v10.13.6 (High Sierra)
- .NET Core SDK: v2.1.500 (also tested on v2.1.302)
- PowerShell Core: v6.1.0
Sample repro
Here is a repo containing a sample and my notes so far (Notes direct link):
https://github.com/patridge/repro-DotnetNewTemplateParameterQuotes
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
How to escape double quotes in JSON
Try this: "maingame": { "day1": { "text1": "Tag 1", "text2": "Heute startet unsere Rundreise \" Example text\".
Read more >Struggling to deserialize JSON with escaped double quotes
I'll try to illustrate this. This is valid JSON. { "errors": [ { "params": { "password": "size must be between 4 and 30",...
Read more >How to Handle the Unclosed String Literal Error in Java
Python unclosed string literal error refers to the Java compiler failing to interpret a string literal due to the missing of a double...
Read more >apex - JSON and escaped double quote
As you can see here, the portion at the end of the Description value is ended with backslash double quote. If I attempt...
Read more >Introduction to SQL Escape
This article will provide an introduction to SQL escape characters for using special characters and their characteristics.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @patridge, This issue will be resolved once we switch to the new command line parser which is planned for .NET 6. You can track the work here #2191.
Closing, this has been fixed in .NET 7. Correct syntax follows:
Command prompt
--someparameter="something needing \"escaped quotes\" in it."
--someparameter="something needing ""escaped quotes"" in it."
PowerShell 7
--someparameter="something needing \`"escaped quotes\`" in it."
--someparameter="something needing `"`"escaped quotes`"`" in it."