diff --git a/src/Microsoft.AspNet.Razor/Parser/ParserHelpers.cs b/src/Microsoft.AspNet.Razor/Parser/ParserHelpers.cs index 2c92e91a92..5128052382 100644 --- a/src/Microsoft.AspNet.Razor/Parser/ParserHelpers.cs +++ b/src/Microsoft.AspNet.Razor/Parser/ParserHelpers.cs @@ -23,7 +23,7 @@ namespace Microsoft.AspNet.Razor.Parser public static bool IsNewLine(string value) { return (value.Length == 1 && (IsNewLine(value[0]))) || - (string.Equals(value, "\r\n", StringComparison.Ordinal)); + (string.Equals(value, Environment.NewLine, StringComparison.Ordinal)); } // Returns true if the character is Whitespace and NOT a newline diff --git a/src/Microsoft.AspNet.Razor/Text/SourceLocationTracker.cs b/src/Microsoft.AspNet.Razor/Text/SourceLocationTracker.cs index 0b5b98ccda..280917eae0 100644 --- a/src/Microsoft.AspNet.Razor/Text/SourceLocationTracker.cs +++ b/src/Microsoft.AspNet.Razor/Text/SourceLocationTracker.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using Microsoft.AspNet.Razor.Parser; namespace Microsoft.AspNet.Razor.Text @@ -65,7 +66,8 @@ namespace Microsoft.AspNet.Razor.Text { _absoluteIndex++; - if (ParserHelpers.IsNewLine(characterRead) && (characterRead != '\r' || nextCharacter != '\n')) + if (Environment.NewLine.Length == 1 && characterRead == Environment.NewLine[0] || + ParserHelpers.IsNewLine(characterRead) && (characterRead != '\r' || nextCharacter != '\n')) { _lineIndex++; _characterIndex = 0;