diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/ParserHelpers.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/ParserHelpers.cs index 71835178b2..8c8ffc8b10 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/ParserHelpers.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/ParserHelpers.cs @@ -26,8 +26,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public static bool IsNewLine(string value) { + // We want to handle both LF and CRLF regardless of the platform. + // We explicitly check for CRLF and IsNewLine() should return true for LF. return (value.Length == 1 && (IsNewLine(value[0]))) || - (string.Equals(value, Environment.NewLine, StringComparison.Ordinal)); + (string.Equals(value, "\r\n", StringComparison.Ordinal)); } public static bool IsIdentifier(string value)