-
-
Notifications
You must be signed in to change notification settings - Fork 727
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
"Unterminated string literal" when building using mono. #1167
Comments
Not investigated the specific issue yet, so just FYI |
I can confirm I get the same error, not gone to depth to see if in Mono Scripting engine or Cake yet, meanwhile this workaround should work for you string CombinePath(params string[] args)
{
var result = args.Aggregate((r, c) => System.IO.Path.Combine(r, c));
if(IsRunningOnWindows()) return result;
else return result.Replace("\x005C", "/"); // using unicode escape sequence does not trigger this issue
} Running Information("{0}", CombinePath("src", "Cake", "Diagnostics", "Formatting")); Will on Windows output
and on posix
|
Awesome! New to cake didn't notice those methods. Are they in the DSL reference somewhere? The links point to the methods on DirectoryPath. Do all methods get projected into typeless function-like calls? Anyways, good to know the hacky implementation is un-needed. A cursory investigation into the exception points to a bug in the ScriptTokenizer. I think that it is mis-reading "\" for escaping the trailing quotes causing the unterminated exception. I think the ScriptTokenizer.ParseString() is causing the issue here. But, I haven't pinpointed it yet. |
@rbutcher yeah think your on the right track there, confirmed mono scripting doesn't have the issue so definitely something in Cake causing it. |
100% sure that ScriptTokenizer.ParseString() is causing this. C# Interactive > var reader = new StringReader("\"\\\""); ;
> Console.WriteLine((char)reader.Read()); ;
"
> Console.WriteLine((char)reader.Read()); ;
\
> Console.WriteLine((char)reader.Read()); ;
"
> The " " surround was to mimic reading the script in for tokenization.
Tough fix though. Still need to support the actual escaping of " if it appears in the middle of the string. |
Closed since #1645 been merged to develop. Feel free to reopen this if it's still a problem after 0.22.0 have been released. |
What You Are Seeing?
When building with mono, a string like "" or @"" causes the tokenizer to throw "Unterminated string literal"
This does not happen when building using the .net runtime.
What is Expected?
The tokenizer should not throw up on escaping the literal ""
What version of Cake are you using?
0.15.2+Branch.main.Sha.c2ca4f7ca51c59dc9c47c9830125b4e66cf14e7a
Are you running on a 32 or 64 bit system?
x64
What environment are you running on? Windows? Linux? Mac?
Windows 10 and Ubuntu 16.04
Mono 4.4.2
Are you running on a CI Server? If so, which one?
Yes and no.
Yes for Ubuntu 16.04 using Bamboo.
No for Windows 10.
How Did You Get This To Happen? (Steps to Reproduce)
run "build.ps1 -mono" on a script that includes this function
Output Log
The text was updated successfully, but these errors were encountered: