diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlMarkupParser.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlMarkupParser.cs index 0a7d84efd3..c1f21905f3 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlMarkupParser.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlMarkupParser.cs @@ -310,9 +310,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy else { Context.ErrorSink.OnError( - CurrentStart, - LegacyResources.ParseError_MarkupBlock_Must_Start_With_Tag, - CurrentSymbol.Content.Length); + RazorDiagnosticFactory.CreateParsing_MarkupBlockMustStartWithTag( + new SourceSpan(CurrentStart, CurrentSymbol.Content.Length))); } Output(SpanKindInternal.Markup); } @@ -472,9 +471,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy if (tags.Count == 0) { Context.ErrorSink.OnError( - CurrentStart, - LegacyResources.ParseError_OuterTagMissingName, - length: 1 /* end of file */); + RazorDiagnosticFactory.CreateParsing_OuterTagMissingName( + new SourceSpan(CurrentStart, contentLength: 1 /* end of file */))); } return false; } @@ -634,9 +632,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy if (!seenCloseAngle) { Context.ErrorSink.OnError( - textLocation, - LegacyResources.ParseError_TextTagCannotContainAttributes, - length: 4 /* text */); + RazorDiagnosticFactory.CreateParsing_TextTagCannotContainAttributes( + new SourceSpan(textLocation, contentLength: 4 /* text */))); Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.Any; RecoverTextTag(); @@ -1089,9 +1086,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Context.Source.Position = bookmark; NextToken(); Context.ErrorSink.OnError( - textLocation, - LegacyResources.ParseError_TextTagCannotContainAttributes, - length: 4 /* text */); + RazorDiagnosticFactory.CreateParsing_TextTagCannotContainAttributes( + new SourceSpan(textLocation, contentLength: 4 /* text */))); RecoverTextTag(); } @@ -1142,9 +1138,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy if (!seenClose) { Context.ErrorSink.OnError( - SourceLocationTracker.Advance(tag.Item2, "<"), - LegacyResources.FormatParseError_UnfinishedTag(tag.Item1.Content), - Math.Max(tag.Item1.Content.Length, 1)); + RazorDiagnosticFactory.CreateParsing_UnfinishedTag( + new SourceSpan( + SourceLocationTracker.Advance(tag.Item2, "<"), + Math.Max(tag.Item1.Content.Length, 1)), + tag.Item1.Content)); } else { @@ -1277,9 +1275,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy if (!Optional(HtmlSymbolType.CloseAngle)) { Context.ErrorSink.OnError( - SourceLocationTracker.Advance(tagStart, " LegacyResources.ParseError_MarkupBlock_Must_Start_With_Tag, + RazorDiagnosticSeverity.Error); + public static RazorDiagnostic CreateParsing_MarkupBlockMustStartWithTag(SourceSpan location) + { + return RazorDiagnostic.Create(Parsing_MarkupBlockMustStartWithTag, location); + } + + internal static readonly RazorDiagnosticDescriptor Parsing_OuterTagMissingName = + new RazorDiagnosticDescriptor( + $"{DiagnosticPrefix}1022", + () => LegacyResources.ParseError_OuterTagMissingName, + RazorDiagnosticSeverity.Error); + public static RazorDiagnostic CreateParsing_OuterTagMissingName(SourceSpan location) + { + return RazorDiagnostic.Create(Parsing_OuterTagMissingName, location); + } + + internal static readonly RazorDiagnosticDescriptor Parsing_TextTagCannotContainAttributes = + new RazorDiagnosticDescriptor( + $"{DiagnosticPrefix}1023", + () => LegacyResources.ParseError_TextTagCannotContainAttributes, + RazorDiagnosticSeverity.Error); + public static RazorDiagnostic CreateParsing_TextTagCannotContainAttributes(SourceSpan location) + { + return RazorDiagnostic.Create(Parsing_TextTagCannotContainAttributes, location); + } + + internal static readonly RazorDiagnosticDescriptor Parsing_UnfinishedTag = + new RazorDiagnosticDescriptor( + $"{DiagnosticPrefix}1024", + () => LegacyResources.ParseError_UnfinishedTag, + RazorDiagnosticSeverity.Error); + public static RazorDiagnostic CreateParsing_UnfinishedTag(SourceSpan location, string tagName) + { + return RazorDiagnostic.Create(Parsing_UnfinishedTag, location, tagName); + } + + internal static readonly RazorDiagnosticDescriptor Parsing_MissingEndTag = + new RazorDiagnosticDescriptor( + $"{DiagnosticPrefix}1025", + () => LegacyResources.ParseError_MissingEndTag, + RazorDiagnosticSeverity.Error); + public static RazorDiagnostic CreateParsing_MissingEndTag(SourceSpan location, string tagName) + { + return RazorDiagnostic.Create(Parsing_MissingEndTag, location, tagName); + } + + internal static readonly RazorDiagnosticDescriptor Parsing_UnexpectedEndTag = + new RazorDiagnosticDescriptor( + $"{DiagnosticPrefix}1026", + () => LegacyResources.ParseError_UnexpectedEndTag, + RazorDiagnosticSeverity.Error); + public static RazorDiagnostic CreateParsing_UnexpectedEndTag(SourceSpan location, string tagName) + { + return RazorDiagnostic.Create(Parsing_UnexpectedEndTag, location, tagName); + } + #endregion #region Semantic Errors diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpBlockTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpBlockTest.cs index 97ceb54221..4ffce5e293 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpBlockTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpBlockTest.cs @@ -1145,10 +1145,8 @@ catch(bar) { baz(); }", BlockKindInternal.Statement, SpanKindInternal.Code); Factory.EmptyHtml())); var expectedErrors = new RazorDiagnostic[] { - RazorDiagnostic.Create(new RazorError( - @"End of file or an unexpected character was reached before the ""span"" tag could be parsed. Elements inside markup blocks must be complete. They must either be self-closing (""
"") or have matching end tags (""

Hello

""). If you intended to display a ""<"" character, use the ""<"" HTML entity.", - new SourceLocation(2, 0, 2), - length: 4)), + RazorDiagnosticFactory.CreateParsing_UnfinishedTag( + new SourceSpan(new SourceLocation(2, 0, 2), contentLength: 4), "span"), RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( new SourceSpan(SourceLocation.Zero, contentLength: 1), LegacyResources.BlockName_Code, "}", "{"), }; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpRazorCommentsTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpRazorCommentsTest.cs index 9bbb28d55d..6afe3662e4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpRazorCommentsTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpRazorCommentsTest.cs @@ -149,14 +149,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy .Accepts(AcceptedCharactersInternal.None)), Factory.Markup(Environment.NewLine).With(SpanChunkGenerator.Null), Factory.Markup("}")))), - RazorDiagnostic.Create(new RazorError( - LegacyResources.ParseError_TextTagCannotContainAttributes, - new SourceLocation(7 + Environment.NewLine.Length, 1, 5), - length: 4)), - RazorDiagnostic.Create(new RazorError( - LegacyResources.FormatParseError_MissingEndTag("text"), - new SourceLocation(7 + Environment.NewLine.Length, 1, 5), - length: 4)), + RazorDiagnosticFactory.CreateParsing_TextTagCannotContainAttributes( + new SourceSpan(new SourceLocation(7 + Environment.NewLine.Length, 1, 5), contentLength: 4)), + RazorDiagnosticFactory.CreateParsing_MissingEndTag( + new SourceSpan(new SourceLocation(7 + Environment.NewLine.Length, 1, 5), contentLength: 4), "text"), RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 1), LegacyResources.BlockName_Code, "}", "{")); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlBlockTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlBlockTest.cs index 275364706a..c886e21a7b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlBlockTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlBlockTest.cs @@ -79,10 +79,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy designTime: true, expectedErrors: new[] { - RazorDiagnostic.Create(new RazorError( - LegacyResources.FormatParseError_UnexpectedEndTag("html"), - new SourceLocation(5 + Environment.NewLine.Length * 2, 2, 2), - length: 4)), + RazorDiagnosticFactory.CreateParsing_UnexpectedEndTag( + new SourceSpan(new SourceLocation(5 + Environment.NewLine.Length * 2, 2, 2), contentLength: 4), "html"), RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 1), LegacyResources.BlockName_Code, "}", "{"), }); @@ -97,10 +95,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy new MarkupTagBlock( Factory.Markup($"< {Environment.NewLine} "))), designTime: true, - expectedErrors: RazorDiagnostic.Create(new RazorError( - LegacyResources.FormatParseError_UnfinishedTag(string.Empty), - new SourceLocation(1, 0, 1), - length: 1))); + expectedErrors: RazorDiagnosticFactory.CreateParsing_UnfinishedTag( + new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 1), string.Empty)); } [Fact] @@ -330,10 +326,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy new MarkupBlock( new MarkupTagBlock( Factory.Markup("").Accepts(AcceptedCharactersInternal.None))), - RazorDiagnostic.Create(new RazorError( - LegacyResources.FormatParseError_MissingEndTag("foo"), - new SourceLocation(1, 0, 1), - length: 3))); + RazorDiagnosticFactory.CreateParsing_MissingEndTag( + new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 3), "foo")); } [Fact] @@ -453,10 +447,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Factory.Markup("").Accepts(AcceptedCharactersInternal.None)), new MarkupTagBlock( Factory.Markup("").Accepts(AcceptedCharactersInternal.None))), - RazorDiagnostic.Create(new RazorError( - LegacyResources.FormatParseError_MissingEndTag("foo"), - new SourceLocation(1, 0, 1), - length: 3))); + RazorDiagnosticFactory.CreateParsing_MissingEndTag( + new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 3), "foo")); } @@ -615,10 +607,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy new MarkupBlock( new MarkupTagBlock( Factory.Markup("
").Accepts(AcceptedCharactersInternal.Any)), new MarkupTagBlock( Factory.MarkupTransition(""))), - RazorDiagnostic.Create(new RazorError( - LegacyResources.ParseError_TextTagCannotContainAttributes, - new SourceLocation(1, 0, 1), - length: 4))); + RazorDiagnosticFactory.CreateParsing_TextTagCannotContainAttributes( + new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 4))); } [Fact] @@ -43,10 +41,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Factory.MarkupTransition("")), new MarkupTagBlock( Factory.MarkupTransition("").Accepts(AcceptedCharactersInternal.Any))), - RazorDiagnostic.Create(new RazorError( - LegacyResources.ParseError_TextTagCannotContainAttributes, - new SourceLocation(8, 0, 8), - length: 4))); + RazorDiagnosticFactory.CreateParsing_TextTagCannotContainAttributes( + new SourceSpan(new SourceLocation(8, 0, 8), contentLength: 4))); } [Fact] @@ -54,10 +50,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { ParseBlockTest("foo bar ", new MarkupBlock(), - RazorDiagnostic.Create(new RazorError( - LegacyResources.ParseError_MarkupBlock_Must_Start_With_Tag, - SourceLocation.Zero, - length: 3))); + RazorDiagnosticFactory.CreateParsing_MarkupBlockMustStartWithTag( + new SourceSpan(SourceLocation.Zero, contentLength: 3))); } [Fact] @@ -68,10 +62,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy new MarkupTagBlock( Factory.Markup("
").Accepts(AcceptedCharactersInternal.None)), Factory.Markup(" ").Accepts(AcceptedCharactersInternal.None)), - RazorDiagnostic.Create(new RazorError( - LegacyResources.FormatParseError_UnexpectedEndTag("foo"), - new SourceLocation(2, 0, 2), - length: 3))); + RazorDiagnosticFactory.CreateParsing_UnexpectedEndTag( + new SourceSpan(new SourceLocation(2, 0, 2), contentLength: 3), "foo")); } [Fact] @@ -85,10 +77,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Factory.Markup("").Accepts(AcceptedCharactersInternal.None)), new MarkupTagBlock( Factory.Markup("").Accepts(AcceptedCharactersInternal.None))), - RazorDiagnostic.Create(new RazorError( - LegacyResources.FormatParseError_MissingEndTag("p"), - new SourceLocation(1, 0, 1), - length: 1))); + RazorDiagnosticFactory.CreateParsing_MissingEndTag( + new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 1), "p")); } [Fact] @@ -99,10 +89,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy new MarkupTagBlock( Factory.Markup("").Accepts(AcceptedCharactersInternal.None)), Factory.Markup("blah blah blah blah blah")), - RazorDiagnostic.Create(new RazorError( - LegacyResources.FormatParseError_MissingEndTag("foo"), - new SourceLocation(1, 0, 1), - length: 3))); + RazorDiagnosticFactory.CreateParsing_MissingEndTag( + new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 3), "foo")); } [Fact] @@ -115,10 +103,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy new MarkupBlock(new AttributeBlockChunkGenerator("bar", new LocationTagged(" bar=", 4, 0, 4), new LocationTagged(string.Empty, 12, 0, 12)), Factory.Markup(" bar=").With(SpanChunkGenerator.Null), Factory.Markup("baz").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 9, 0, 9), new LocationTagged("baz", 9, 0, 9)))))), - RazorDiagnostic.Create(new RazorError( - LegacyResources.FormatParseError_UnfinishedTag("foo"), - new SourceLocation(1, 0, 1), - length: 3))); + RazorDiagnosticFactory.CreateParsing_UnfinishedTag( + new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 3), "foo")); } } } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlTagsTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlTagsTest.cs index 4f8e565035..0a86c7a06b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlTagsTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlTagsTest.cs @@ -39,10 +39,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy BlockFactory.MarkupTagBlock("

", AcceptedCharactersInternal.None), BlockFactory.MarkupTagBlock("", AcceptedCharactersInternal.None), Factory.Markup(" ").Accepts(AcceptedCharactersInternal.None)), - RazorDiagnostic.Create(new RazorError( - LegacyResources.FormatParseError_MissingEndTag("p"), - new SourceLocation(1, 0, 1), - length: 1))); + RazorDiagnosticFactory.CreateParsing_MissingEndTag( + new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 1), "p")); } [Fact] diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TagHelperBlockRewriterTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TagHelperBlockRewriterTest.cs index 1996c68455..63c6ac1677 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TagHelperBlockRewriterTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TagHelperBlockRewriterTest.cs @@ -742,9 +742,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy absoluteIndex: 3, lineIndex: 0 , columnIndex: 3, length: 30)), RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( new SourceSpan(new SourceLocation(4, 0, 4), contentLength: 1), "do", "}", "{"), - RazorDiagnostic.Create(new RazorError( - LegacyResources.FormatParseError_UnexpectedEndTag("p"), - absoluteIndex: 31, lineIndex: 0, columnIndex: 31, length: 1)) + RazorDiagnosticFactory.CreateParsing_UnexpectedEndTag( + new SourceSpan(filePath: null, absoluteIndex: 31, lineIndex: 0, characterIndex: 31, length: 1), "p") } }, { diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TagHelperParseTreeRewriterTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TagHelperParseTreeRewriterTest.cs index 2a77d0c83e..80379a8aba 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TagHelperParseTreeRewriterTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TagHelperParseTreeRewriterTest.cs @@ -2343,9 +2343,6 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { var factory = new SpanFactory(); var blockFactory = new BlockFactory(factory); - var errorFormatNormalUnclosed = - "The \"{0}\" element was not closed. All elements must be either self-closing or have a " + - "matching end tag."; Func, MarkupBlock> buildStatementBlock = (insideBuilder) => { @@ -2392,9 +2389,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 1), LegacyResources.BlockName_Code, "}", "{"), - RazorDiagnostic.Create(new RazorError( - string.Format(errorFormatNormalUnclosed, "!text"), - absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 5)) + RazorDiagnosticFactory.CreateParsing_MissingEndTag( + new SourceSpan(filePath: null, absoluteIndex: 3, lineIndex: 0, characterIndex: 3, length: 5), "!text"), } }, { @@ -2530,12 +2526,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy var errorFormatMalformed = "Found a malformed '{0}' tag helper. Tag helpers must have a start and end tag or be self " + "closing."; - var errorFormatNormalUnclosed = - "The \"{0}\" element was not closed. All elements must be either self-closing or have a " + - "matching end tag."; - var errorFormatNormalNotStarted = - "Encountered end tag \"{0}\" with no matching start tag. Are your start/end tags properly " + - "balanced?"; + + RazorDiagnostic MissingEndTagError(string tagName) + { + return RazorDiagnosticFactory.CreateParsing_MissingEndTag( + new SourceSpan(filePath: null, absoluteIndex: 3, lineIndex: 0, characterIndex: 3, length: tagName.Length), tagName); + } Func, MarkupBlock> buildStatementBlock = (insideBuilder) => { @@ -2567,9 +2563,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 1), LegacyResources.BlockName_Code, "}", "{"), - RazorDiagnostic.Create(new RazorError( - string.Format(errorFormatNormalUnclosed, "!text", CultureInfo.InvariantCulture), - absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 5)), + MissingEndTagError("!text"), } }, { @@ -2579,9 +2573,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy blockFactory.EscapedMarkupTagBlock("", AcceptedCharactersInternal.None))), new [] { - RazorDiagnostic.Create(new RazorError( - string.Format(errorFormatNormalNotStarted, "!text", CultureInfo.InvariantCulture), - absoluteIndex: 4, lineIndex: 0, columnIndex: 4, length: 5)), + RazorDiagnosticFactory.CreateParsing_UnexpectedEndTag( + new SourceSpan(filePath: null, absoluteIndex: 4, lineIndex: 0, characterIndex: 4, length: 5), "!text"), } }, { @@ -2609,9 +2602,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy blockFactory.MarkupTagBlock("", AcceptedCharactersInternal.None))), new [] { - RazorDiagnostic.Create(new RazorError( - string.Format(errorFormatNormalUnclosed, "!text", CultureInfo.InvariantCulture), - absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 5)), + MissingEndTagError("!text"), RazorDiagnostic.Create(new RazorError( string.Format(errorFormatMalformed, "text", CultureInfo.InvariantCulture), absoluteIndex: 11, lineIndex: 0, columnIndex: 11, length: 4)) @@ -2628,9 +2619,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy factory.Markup("text>").Accepts(AcceptedCharactersInternal.None)))), new [] { - RazorDiagnostic.Create(new RazorError( - string.Format(errorFormatNormalUnclosed, "text", CultureInfo.InvariantCulture), - absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 4)) + MissingEndTagError("text"), } }, { @@ -2661,9 +2650,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 1), LegacyResources.BlockName_Code, "}", "{"), - RazorDiagnostic.Create(new RazorError( - string.Format(errorFormatNormalUnclosed, "text", CultureInfo.InvariantCulture), - absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 4)) + MissingEndTagError("text"), } }, { @@ -2683,9 +2670,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy factory.EmptyHtml()), new [] { - RazorDiagnostic.Create(new RazorError( - string.Format(errorFormatNormalNotStarted, "text", CultureInfo.InvariantCulture), - absoluteIndex: 19, lineIndex: 0, columnIndex: 19, length: 4)), + RazorDiagnosticFactory.CreateParsing_UnexpectedEndTag( + new SourceSpan(filePath: null, absoluteIndex: 19, lineIndex: 0, characterIndex: 19, length: 4), "text"), RazorDiagnostic.Create(new RazorError( string.Format(errorFormatMalformed, "text", CultureInfo.InvariantCulture), absoluteIndex: 19, lineIndex: 0, columnIndex: 19, length: 4)) @@ -2712,11 +2698,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { var factory = new SpanFactory(); var blockFactory = new BlockFactory(factory); - var errorEOFMatchingBrace = - "End of file or an unexpected character was reached before the \"{0}\" tag could be parsed. " + - "Elements inside markup blocks must be complete. They must either be self-closing " + - "(\"
\") or have matching end tags (\"

Hello

\"). If you intended " + - "to display a \"<\" character, use the \"<\" HTML entity."; + + RazorDiagnostic UnfinishedTagError(string tagName, int length) + { + return RazorDiagnosticFactory.CreateParsing_UnfinishedTag( + new SourceSpan(filePath: null, absoluteIndex: 3, lineIndex: 0, characterIndex: 3, length: length), + tagName); + } Func, MarkupBlock> buildPartialStatementBlock = (insideBuilder) => { @@ -2739,9 +2727,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 1), LegacyResources.BlockName_Code, "}", "{"), - RazorDiagnostic.Create(new RazorError( - string.Format(errorEOFMatchingBrace, "!text}"), - absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 6)) + UnfinishedTagError("!text}", 6), } }, { @@ -2756,9 +2742,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 1), LegacyResources.BlockName_Code, "}", "{"), - RazorDiagnostic.Create(new RazorError( - string.Format(errorEOFMatchingBrace, "!text"), - absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 5)) + UnfinishedTagError("!text", 5), } }, { @@ -2783,9 +2767,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 1), LegacyResources.BlockName_Code, "}", "{"), - RazorDiagnostic.Create(new RazorError( - string.Format(errorEOFMatchingBrace, "!text"), - absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 5)) + UnfinishedTagError("!text", 5), } }, { @@ -2810,9 +2792,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 1), LegacyResources.BlockName_Code, "}", "{"), - RazorDiagnostic.Create(new RazorError( - string.Format(errorEOFMatchingBrace, "!text"), - absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 5)) + UnfinishedTagError("!text", 5), } }, { @@ -2840,9 +2820,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 1), LegacyResources.BlockName_Code, "}", "{"), - RazorDiagnostic.Create(new RazorError( - string.Format(errorEOFMatchingBrace, "!text"), - absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 5)) + UnfinishedTagError("!text", 5), } }, { @@ -2871,9 +2849,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 1), LegacyResources.BlockName_Code, "}", "{"), - RazorDiagnostic.Create(new RazorError( - string.Format(errorEOFMatchingBrace, "!text"), - absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 5)) + UnfinishedTagError("!text", 5), } } }; @@ -2896,11 +2872,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { var factory = new SpanFactory(); var blockFactory = new BlockFactory(factory); - var errorEOFMatchingBrace = - "End of file or an unexpected character was reached before the \"{0}\" tag could be parsed. " + - "Elements inside markup blocks must be complete. They must either be self-closing " + - "(\"
\") or have matching end tags (\"

Hello

\"). If you intended " + - "to display a \"<\" character, use the \"<\" HTML entity."; + + RazorDiagnostic UnfinishedTagError(string tagName) + { + return RazorDiagnosticFactory.CreateParsing_UnfinishedTag( + new SourceSpan(filePath: null, absoluteIndex: 3, lineIndex: 0, characterIndex: 3, length: tagName.Length), + tagName); + } Func, MarkupBlock> buildPartialStatementBlock = (insideBuilder) => { @@ -2923,9 +2901,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 1), LegacyResources.BlockName_Code, "}", "{"), - RazorDiagnostic.Create(new RazorError( - string.Format(errorEOFMatchingBrace, "!}"), - absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 2)) + UnfinishedTagError("!}"), } }, { @@ -2936,9 +2912,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 1), LegacyResources.BlockName_Code, "}", "{"), - RazorDiagnostic.Create(new RazorError( - string.Format(errorEOFMatchingBrace, "!p}"), - absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 3)) + UnfinishedTagError("!p}"), } }, { @@ -2950,9 +2924,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 1), LegacyResources.BlockName_Code, "}", "{"), - RazorDiagnostic.Create(new RazorError( - string.Format(errorEOFMatchingBrace, "!p"), - absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 2)) + UnfinishedTagError("!p"), } }, { @@ -2977,9 +2949,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 1), LegacyResources.BlockName_Code, "}", "{"), - RazorDiagnostic.Create(new RazorError( - string.Format(errorEOFMatchingBrace, "!p"), - absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 2)) + UnfinishedTagError("!p"), } }, { @@ -3004,9 +2974,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 1), LegacyResources.BlockName_Code, "}", "{"), - RazorDiagnostic.Create(new RazorError( - string.Format(errorEOFMatchingBrace, "!p"), - absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 2)) + UnfinishedTagError("!p"), } }, { @@ -3038,9 +3006,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 1), LegacyResources.BlockName_Code, "}", "{"), - RazorDiagnostic.Create(new RazorError( - string.Format(errorEOFMatchingBrace, "!p"), - absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 2)) + UnfinishedTagError("!p"), } }, { @@ -3068,9 +3034,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 1), LegacyResources.BlockName_Code, "}", "{"), - RazorDiagnostic.Create(new RazorError( - string.Format(errorEOFMatchingBrace, "!p"), - absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 2)) + UnfinishedTagError("!p"), } }, { @@ -3100,9 +3064,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 1), LegacyResources.BlockName_Code, "}", "{"), - RazorDiagnostic.Create(new RazorError( - string.Format(errorEOFMatchingBrace, "!p"), - absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 2)) + UnfinishedTagError("!p"), } } }; @@ -3235,12 +3197,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy var errorFormatMalformed = "Found a malformed '{0}' tag helper. Tag helpers must have a start and end tag or be self " + "closing."; - var errorFormatNormalUnclosed = - "The \"{0}\" element was not closed. All elements must be either self-closing or have a " + - "matching end tag."; - var errorFormatNormalNotStarted = - "Encountered end tag \"{0}\" with no matching start tag. Are your start/end tags properly " + - "balanced?"; + + RazorDiagnostic MissingEndTagError(string tagName, int index = 3) + { + return RazorDiagnosticFactory.CreateParsing_MissingEndTag( + new SourceSpan(filePath: null, absoluteIndex: index, lineIndex: 0, characterIndex: index, length: tagName.Length), tagName); + } Func, MarkupBlock> buildStatementBlock = (insideBuilder) => { @@ -3272,9 +3234,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 1), LegacyResources.BlockName_Code, "}", "{"), - RazorDiagnostic.Create(new RazorError( - string.Format(errorFormatNormalUnclosed, "!p", CultureInfo.InvariantCulture), - absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 2)), + MissingEndTagError("!p"), } }, { @@ -3284,9 +3244,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy blockFactory.EscapedMarkupTagBlock("", AcceptedCharactersInternal.None))), new [] { - RazorDiagnostic.Create(new RazorError( - string.Format(errorFormatNormalNotStarted, "!p", CultureInfo.InvariantCulture), - absoluteIndex: 4, lineIndex: 0, columnIndex: 4, length: 2)), + RazorDiagnosticFactory.CreateParsing_UnexpectedEndTag( + new SourceSpan(filePath: null, absoluteIndex: 4, lineIndex: 0, characterIndex: 4, length: 2), "!p"), } }, { @@ -3314,9 +3273,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy blockFactory.MarkupTagBlock("

", AcceptedCharactersInternal.None))), new [] { - RazorDiagnostic.Create(new RazorError( - string.Format(errorFormatNormalUnclosed, "!p", CultureInfo.InvariantCulture), - absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 2)), + MissingEndTagError("!p"), RazorDiagnostic.Create(new RazorError( string.Format(errorFormatMalformed, "p", CultureInfo.InvariantCulture), absoluteIndex: 8, lineIndex: 0, columnIndex: 8, length: 1)) @@ -3330,9 +3287,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy blockFactory.EscapedMarkupTagBlock("", AcceptedCharactersInternal.None)))), new [] { - RazorDiagnostic.Create(new RazorError( - string.Format(errorFormatNormalUnclosed, "p", CultureInfo.InvariantCulture), - absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 1)), + MissingEndTagError("p"), RazorDiagnostic.Create(new RazorError( string.Format(errorFormatMalformed, "p", CultureInfo.InvariantCulture), absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 1)) @@ -3363,9 +3318,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 1), LegacyResources.BlockName_Code, "}", "{"), - RazorDiagnostic.Create(new RazorError( - string.Format(errorFormatNormalUnclosed, "p", CultureInfo.InvariantCulture), - absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 1)), + MissingEndTagError("p"), RazorDiagnostic.Create(new RazorError( string.Format(errorFormatMalformed, "p", CultureInfo.InvariantCulture), absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 1)) @@ -3388,9 +3341,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy factory.EmptyHtml()), new [] { - RazorDiagnostic.Create(new RazorError( - string.Format(errorFormatNormalNotStarted, "p", CultureInfo.InvariantCulture), - absoluteIndex: 13, lineIndex: 0, columnIndex: 13, length: 1)), + RazorDiagnosticFactory.CreateParsing_UnexpectedEndTag( + new SourceSpan(filePath: null, absoluteIndex: 13, lineIndex: 0, characterIndex: 13, length: 1), "p"), RazorDiagnostic.Create(new RazorError( string.Format(errorFormatMalformed, "p", CultureInfo.InvariantCulture), absoluteIndex: 13, lineIndex: 0, columnIndex: 13, length: 1)) @@ -3413,15 +3365,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy factory.EmptyHtml()), new [] { - RazorDiagnostic.Create(new RazorError( - string.Format(errorFormatNormalUnclosed, "strong", CultureInfo.InvariantCulture), - absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 6)), + MissingEndTagError("strong"), RazorDiagnostic.Create(new RazorError( string.Format(errorFormatMalformed, "strong", CultureInfo.InvariantCulture), absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 6)), - RazorDiagnostic.Create(new RazorError( - string.Format(errorFormatNormalNotStarted, "strong", CultureInfo.InvariantCulture), - absoluteIndex: 17, lineIndex: 0, columnIndex: 17, length: 6)), + RazorDiagnosticFactory.CreateParsing_UnexpectedEndTag( + new SourceSpan(filePath: null, absoluteIndex: 17, lineIndex: 0, characterIndex: 17, length: 6), "strong"), RazorDiagnostic.Create(new RazorError( string.Format(errorFormatMalformed, "strong", CultureInfo.InvariantCulture), absoluteIndex: 17, lineIndex: 0, columnIndex: 17, length: 6)) @@ -3465,24 +3414,19 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy factory.EmptyHtml()), new [] { - RazorDiagnostic.Create(new RazorError( - string.Format(errorFormatNormalUnclosed, "p", CultureInfo.InvariantCulture), - absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 1)), + MissingEndTagError("p"), RazorDiagnostic.Create(new RazorError( string.Format(errorFormatMalformed, "p", CultureInfo.InvariantCulture), absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 1)), RazorDiagnostic.Create(new RazorError( string.Format(errorFormatMalformed, "strong", CultureInfo.InvariantCulture), absoluteIndex: 6, lineIndex: 0, columnIndex: 6, length: 6)), - RazorDiagnostic.Create(new RazorError( - string.Format(errorFormatNormalUnclosed, "!p", CultureInfo.InvariantCulture), - absoluteIndex: 24, lineIndex: 0, columnIndex: 24, length: 2)), + MissingEndTagError("!p", index: 24), RazorDiagnostic.Create(new RazorError( string.Format(errorFormatMalformed, "strong", CultureInfo.InvariantCulture), absoluteIndex: 29, lineIndex: 0, columnIndex: 29, length: 6)), - RazorDiagnostic.Create(new RazorError( - string.Format(errorFormatNormalNotStarted, "!p", CultureInfo.InvariantCulture), - absoluteIndex: 38, lineIndex: 0, columnIndex: 38, length: 2)), + RazorDiagnosticFactory.CreateParsing_UnexpectedEndTag( + new SourceSpan(filePath: null, absoluteIndex: 38, lineIndex: 0, characterIndex: 38, length: 2), "!p"), } }, }; @@ -3495,9 +3439,6 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { var factory = new SpanFactory(); var blockFactory = new BlockFactory(factory); - var errorFormatNormalUnclosed = - "The \"{0}\" element was not closed. All elements must be either self-closing or have a " + - "matching end tag."; Func, MarkupBlock> buildStatementBlock = (insideBuilder) => { @@ -3544,9 +3485,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 1), LegacyResources.BlockName_Code, "}", "{"), - RazorDiagnostic.Create(new RazorError( - string.Format(errorFormatNormalUnclosed, "!p"), - absoluteIndex: 3, lineIndex: 0, columnIndex: 3, length: 2)) + RazorDiagnosticFactory.CreateParsing_MissingEndTag( + new SourceSpan(filePath: null, absoluteIndex: 3, lineIndex: 0, characterIndex: 3, length: 2), "!p"), } }, { @@ -4261,10 +4201,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Factory.EmptyHtml()); var expectedErrors = new[] { - RazorDiagnostic.Create(new RazorError( - "Encountered end tag \"div\" with no matching start tag. Are your start/end tags properly balanced?", - new SourceLocation(9, 0, 9), - 3)), + RazorDiagnosticFactory.CreateParsing_UnexpectedEndTag( + new SourceSpan(new SourceLocation(9, 0, 9), contentLength: 3), "div"), }; RunParseTreeRewriterTest(documentContent, expectedOutput, expectedErrors); diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.diagnostics.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.diagnostics.txt index b0a8bd2630..16ad2a09d5 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.diagnostics.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.diagnostics.txt @@ -1,2 +1,2 @@ -TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.cshtml(1,11): Error RZ9999: Encountered end tag "div" with no matching start tag. Are your start/end tags properly balanced? +TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.cshtml(1,11): Error RZ1026: Encountered end tag "div" with no matching start tag. Are your start/end tags properly balanced? TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.cshtml(1,7): Error RZ1006: The explicit expression block is missing a closing ")" character. Make sure you have a matching ")" character for all the "(" characters within this block, and that none of the ")" characters are being interpreted as markup. diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_Runtime.diagnostics.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_Runtime.diagnostics.txt index b0a8bd2630..16ad2a09d5 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_Runtime.diagnostics.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_Runtime.diagnostics.txt @@ -1,2 +1,2 @@ -TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.cshtml(1,11): Error RZ9999: Encountered end tag "div" with no matching start tag. Are your start/end tags properly balanced? +TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.cshtml(1,11): Error RZ1026: Encountered end tag "div" with no matching start tag. Are your start/end tags properly balanced? TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.cshtml(1,7): Error RZ1006: The explicit expression block is missing a closing ")" character. Make sure you have a matching ")" character for all the "(" characters within this block, and that none of the ")" characters are being interpreted as markup. diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_DesignTime.diagnostics.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_DesignTime.diagnostics.txt index 6f37373476..49f293ec33 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_DesignTime.diagnostics.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_DesignTime.diagnostics.txt @@ -1,3 +1,3 @@ -TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf.cshtml(4,3): Error RZ9999: Encountered end tag "body" with no matching start tag. Are your start/end tags properly balanced? -TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf.cshtml(5,3): Error RZ9999: Encountered end tag "html" with no matching start tag. Are your start/end tags properly balanced? +TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf.cshtml(4,3): Error RZ1026: Encountered end tag "body" with no matching start tag. Are your start/end tags properly balanced? +TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf.cshtml(5,3): Error RZ1026: Encountered end tag "html" with no matching start tag. Are your start/end tags properly balanced? TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf.cshtml(3,2): Error RZ1006: The if block is missing a closing "}" character. Make sure you have a matching "}" character for all the "{" characters within this block, and that none of the "}" characters are being interpreted as markup. diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_Runtime.diagnostics.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_Runtime.diagnostics.txt index 6f37373476..49f293ec33 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_Runtime.diagnostics.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_Runtime.diagnostics.txt @@ -1,3 +1,3 @@ -TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf.cshtml(4,3): Error RZ9999: Encountered end tag "body" with no matching start tag. Are your start/end tags properly balanced? -TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf.cshtml(5,3): Error RZ9999: Encountered end tag "html" with no matching start tag. Are your start/end tags properly balanced? +TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf.cshtml(4,3): Error RZ1026: Encountered end tag "body" with no matching start tag. Are your start/end tags properly balanced? +TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf.cshtml(5,3): Error RZ1026: Encountered end tag "html" with no matching start tag. Are your start/end tags properly balanced? TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf.cshtml(3,2): Error RZ1006: The if block is missing a closing "}" character. Make sure you have a matching "}" character for all the "{" characters within this block, and that none of the "}" characters are being interpreted as markup.