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

Error message uses a non-Windows \n instead of e.g. Environment.NewLine #213

Closed
maettu-this opened this issue Nov 3, 2020 · 1 comment
Closed

Comments

@maettu-this
Copy link
Collaborator

The error message shown in #25 (comment) erroneously states "Cannot parse \"//css_reference\nEnsure your directive escapes all delimiters (';(){},') by doubling the delimiter character." even though I am running on Windows. Thus splitting the string for Environment.NewLine will not work. I propose to always use Environment.NewLine when composing multi-line strings.

(Moved from #25 to new issue here.)

@oleg-shilo
Copy link
Owner

Well it's a tricky one.
The good practice dictates that you should not expect exact line ending type even if you know the OS you are running on. Thus your splitting routine should handle both \r\n and \n.

This is what I usually use:

    public static string[] GetLines(this string str) =>// too simplistic though adequate
        str.Replace("\r\n", "\n").Split('\n');

And of course the production strength algorithm should be based on more comprehensive RegEx.

Thus I have the tendency to deal with the string Linux way. Particularly because majority of all Windows utils handle \r\n and \n transparently (cmd, powershell, notepad++).

Nevertheless, I do not close this issue and will normalize output strings in the next release.

oleg-shilo pushed a commit that referenced this issue Nov 7, 2020
oleg-shilo pushed a commit that referenced this issue Nov 8, 2020
- Issue #213: Error message uses a non-Windows \n instead of e.g. Environment.NewLine
- Issue #211: Implementing a partial class with a circular css_import results in a recursion in CS-Script and results in a PathTooLongException
- Issue #214: The exception that is thrown when a the script compiler error occurs.
- Issue #202: Better versioning of referenced NuGet packages
- Issue #203: precompiler/context["CompilerOptions"] doesn't appear to work
- Issue #198: Changes from version 3.29 to 3.30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants