diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/ViewComponentTagHelperDescriptorFactory.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/ViewComponentTagHelperDescriptorFactory.cs index 06b5bed18f..795786f5b8 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/ViewComponentTagHelperDescriptorFactory.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/ViewComponentTagHelperDescriptorFactory.cs @@ -110,11 +110,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X if (string.Equals(selectedMethod.Name, ViewComponentTypes.AsyncMethodName, StringComparison.Ordinal)) { // Will invoke asynchronously. Method must not return Task or Task. - if (Equals(returnType, _taskSymbol)) + if (SymbolEqualityComparer.Default.Equals(returnType, _taskSymbol)) { // This is ok. } - else if (returnType.IsGenericType && Equals(returnType.ConstructedFrom, _genericTaskSymbol)) + else if (returnType.IsGenericType && SymbolEqualityComparer.Default.Equals(returnType.ConstructedFrom, _genericTaskSymbol)) { // This is ok. } @@ -134,13 +134,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X method = null; return false; } - else if (Equals(returnType, _taskSymbol)) + else if (SymbolEqualityComparer.Default.Equals(returnType, _taskSymbol)) { diagnostic = RazorExtensionsDiagnosticFactory.CreateViewComponent_SyncMethod_CannotReturnTask(type.ToDisplayString(FullNameTypeDisplayFormat)); method = null; return false; } - else if (returnType.IsGenericType && Equals(returnType.ConstructedFrom, _genericTaskSymbol)) + else if (returnType.IsGenericType && SymbolEqualityComparer.Default.Equals(returnType.ConstructedFrom, _genericTaskSymbol)) { diagnostic = RazorExtensionsDiagnosticFactory.CreateViewComponent_SyncMethod_CannotReturnTask(type.ToDisplayString(FullNameTypeDisplayFormat)); method = null; @@ -208,13 +208,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X private string GetIndexerValueTypeName(IParameterSymbol parameter) { INamedTypeSymbol dictionaryType; - if (Equals((parameter.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol)) + if (SymbolEqualityComparer.Default.Equals((parameter.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol)) { dictionaryType = (INamedTypeSymbol)parameter.Type; } - else if (parameter.Type.AllInterfaces.Any(s => Equals(s.ConstructedFrom, _iDictionarySymbol))) + else if (parameter.Type.AllInterfaces.Any(s => SymbolEqualityComparer.Default.Equals(s.ConstructedFrom, _iDictionarySymbol))) { - dictionaryType = parameter.Type.AllInterfaces.First(s => Equals(s.ConstructedFrom, _iDictionarySymbol)); + dictionaryType = parameter.Type.AllInterfaces.First(s => SymbolEqualityComparer.Default.Equals(s.ConstructedFrom, _iDictionarySymbol)); } else { @@ -234,7 +234,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X private string GetShortName(INamedTypeSymbol componentType) { - var viewComponentAttribute = componentType.GetAttributes().Where(a => Equals(a.AttributeClass, _viewComponentAttributeSymbol)).FirstOrDefault(); + var viewComponentAttribute = componentType.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _viewComponentAttributeSymbol)).FirstOrDefault(); var name = viewComponentAttribute ?.NamedArguments .Where(namedArgument => string.Equals(namedArgument.Key, ViewComponentTypes.ViewComponent.Name, StringComparison.Ordinal)) diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/ViewComponentTypeVisitor.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/ViewComponentTypeVisitor.cs index 916bc60653..450e4e1557 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/ViewComponentTypeVisitor.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/ViewComponentTypeVisitor.cs @@ -73,7 +73,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X return false; } - var attribute = type.GetAttributes().Where(a => Equals(a.AttributeClass, queryAttribute)).FirstOrDefault(); + var attribute = type.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, queryAttribute)).FirstOrDefault(); if (attribute != null) { diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/LegacySectionTargetExtensionTest.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/LegacySectionTargetExtensionTest.cs index bef1d0718f..edf09ff60a 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/LegacySectionTargetExtensionTest.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/LegacySectionTargetExtensionTest.cs @@ -40,7 +40,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions "; var output = context.CodeWriter.GenerateCode(); - Assert.Equal(expected, output); + Assert.Equal(expected, output, ignoreLineEndingDifferences: true); } } } diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/ViewComponentTagHelperDescriptorFactory.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/ViewComponentTagHelperDescriptorFactory.cs index 75b4cd62be..ef989c3f7f 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/ViewComponentTagHelperDescriptorFactory.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/ViewComponentTagHelperDescriptorFactory.cs @@ -104,11 +104,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X if (string.Equals(selectedMethod.Name, ViewComponentTypes.AsyncMethodName, StringComparison.Ordinal)) { // Will invoke asynchronously. Method must not return Task or Task. - if (Equals(returnType, _taskSymbol)) + if (SymbolEqualityComparer.Default.Equals(returnType, _taskSymbol)) { // This is ok. } - else if (returnType.IsGenericType && Equals(returnType.ConstructedFrom, _genericTaskSymbol)) + else if (returnType.IsGenericType && SymbolEqualityComparer.Default.Equals(returnType.ConstructedFrom, _genericTaskSymbol)) { // This is ok. } @@ -128,13 +128,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X method = null; return false; } - else if (Equals(returnType, _taskSymbol)) + else if (SymbolEqualityComparer.Default.Equals(returnType, _taskSymbol)) { diagnostic = RazorExtensionsDiagnosticFactory.CreateViewComponent_SyncMethod_CannotReturnTask(type.ToDisplayString(FullNameTypeDisplayFormat)); method = null; return false; } - else if (returnType.IsGenericType && Equals(returnType.ConstructedFrom, _genericTaskSymbol)) + else if (returnType.IsGenericType && SymbolEqualityComparer.Default.Equals(returnType.ConstructedFrom, _genericTaskSymbol)) { diagnostic = RazorExtensionsDiagnosticFactory.CreateViewComponent_SyncMethod_CannotReturnTask(type.ToDisplayString(FullNameTypeDisplayFormat)); method = null; @@ -223,13 +223,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X private string GetIndexerValueTypeName(IParameterSymbol parameter) { INamedTypeSymbol dictionaryType; - if (Equals((parameter.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol)) + if (SymbolEqualityComparer.Default.Equals((parameter.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol)) { dictionaryType = (INamedTypeSymbol)parameter.Type; } - else if (parameter.Type.AllInterfaces.Any(s => Equals(s.ConstructedFrom, _iDictionarySymbol))) + else if (parameter.Type.AllInterfaces.Any(s => SymbolEqualityComparer.Default.Equals(s.ConstructedFrom, _iDictionarySymbol))) { - dictionaryType = parameter.Type.AllInterfaces.First(s => Equals(s.ConstructedFrom, _iDictionarySymbol)); + dictionaryType = parameter.Type.AllInterfaces.First(s => SymbolEqualityComparer.Default.Equals(s.ConstructedFrom, _iDictionarySymbol)); } else { @@ -249,7 +249,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X private string GetShortName(INamedTypeSymbol componentType) { - var viewComponentAttribute = componentType.GetAttributes().Where(a => Equals(a.AttributeClass, _viewComponentAttributeSymbol)).FirstOrDefault(); + var viewComponentAttribute = componentType.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _viewComponentAttributeSymbol)).FirstOrDefault(); var name = viewComponentAttribute ?.NamedArguments .Where(namedArgument => string.Equals(namedArgument.Key, ViewComponentTypes.ViewComponent.Name, StringComparison.Ordinal)) diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/ViewComponentTypeVisitor.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/ViewComponentTypeVisitor.cs index 0281880866..1d7463884c 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/ViewComponentTypeVisitor.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/ViewComponentTypeVisitor.cs @@ -75,7 +75,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X return false; } - var attribute = type.GetAttributes().Where(a => Equals(a.AttributeClass, queryAttribute)).FirstOrDefault(); + var attribute = type.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, queryAttribute)).FirstOrDefault(); if (attribute != null) { diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/RazorPageDocumentClassifierPassTest.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/RazorPageDocumentClassifierPassTest.cs index 8e9f111579..d86e144c78 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/RazorPageDocumentClassifierPassTest.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/RazorPageDocumentClassifierPassTest.cs @@ -82,7 +82,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X // Arrange var content = @" @* some comment *@ - + @page "; var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create(content, "Test.cshtml")); @@ -363,7 +363,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X { PageDirective.Register(builder); } - + private static DocumentIntermediateNode CreateIRDocument(RazorEngine engine, RazorCodeDocument codeDocument) { for (var i = 0; i < engine.Phases.Count; i++) diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/ViewComponentTagHelperDescriptorFactory.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/ViewComponentTagHelperDescriptorFactory.cs index aaa765fb63..c266d7541d 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/ViewComponentTagHelperDescriptorFactory.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/ViewComponentTagHelperDescriptorFactory.cs @@ -104,11 +104,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions if (string.Equals(selectedMethod.Name, ViewComponentTypes.AsyncMethodName, StringComparison.Ordinal)) { // Will invoke asynchronously. Method must not return Task or Task. - if (Equals(returnType, _taskSymbol)) + if (SymbolEqualityComparer.Default.Equals(returnType, _taskSymbol)) { // This is ok. } - else if (returnType.IsGenericType && Equals(returnType.ConstructedFrom, _genericTaskSymbol)) + else if (returnType.IsGenericType && SymbolEqualityComparer.Default.Equals(returnType.ConstructedFrom, _genericTaskSymbol)) { // This is ok. } @@ -128,13 +128,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions method = null; return false; } - else if (Equals(returnType, _taskSymbol)) + else if (SymbolEqualityComparer.Default.Equals(returnType, _taskSymbol)) { diagnostic = RazorExtensionsDiagnosticFactory.CreateViewComponent_SyncMethod_CannotReturnTask(type.ToDisplayString(FullNameTypeDisplayFormat)); method = null; return false; } - else if (returnType.IsGenericType && Equals(returnType.ConstructedFrom, _genericTaskSymbol)) + else if (returnType.IsGenericType && SymbolEqualityComparer.Default.Equals(returnType.ConstructedFrom, _genericTaskSymbol)) { diagnostic = RazorExtensionsDiagnosticFactory.CreateViewComponent_SyncMethod_CannotReturnTask(type.ToDisplayString(FullNameTypeDisplayFormat)); method = null; @@ -223,13 +223,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions private string GetIndexerValueTypeName(IParameterSymbol parameter) { INamedTypeSymbol dictionaryType; - if (Equals((parameter.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol)) + if (SymbolEqualityComparer.Default.Equals((parameter.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol)) { dictionaryType = (INamedTypeSymbol)parameter.Type; } - else if (parameter.Type.AllInterfaces.Any(s => Equals(s.ConstructedFrom, _iDictionarySymbol))) + else if (parameter.Type.AllInterfaces.Any(s => SymbolEqualityComparer.Default.Equals(s.ConstructedFrom, _iDictionarySymbol))) { - dictionaryType = parameter.Type.AllInterfaces.First(s => Equals(s.ConstructedFrom, _iDictionarySymbol)); + dictionaryType = parameter.Type.AllInterfaces.First(s => SymbolEqualityComparer.Default.Equals(s.ConstructedFrom, _iDictionarySymbol)); } else { @@ -249,7 +249,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions private string GetShortName(INamedTypeSymbol componentType) { - var viewComponentAttribute = componentType.GetAttributes().Where(a => Equals(a.AttributeClass, _viewComponentAttributeSymbol)).FirstOrDefault(); + var viewComponentAttribute = componentType.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _viewComponentAttributeSymbol)).FirstOrDefault(); var name = viewComponentAttribute ?.NamedArguments .Where(namedArgument => string.Equals(namedArgument.Key, ViewComponentTypes.ViewComponent.Name, StringComparison.Ordinal)) diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/ViewComponentTypeVisitor.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/ViewComponentTypeVisitor.cs index 498b28fdc2..8c7a3b4065 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/ViewComponentTypeVisitor.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/ViewComponentTypeVisitor.cs @@ -75,7 +75,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions return false; } - var attribute = type.GetAttributes().Where(a => Equals(a.AttributeClass, queryAttribute)).FirstOrDefault(); + var attribute = type.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, queryAttribute)).FirstOrDefault(); if (attribute != null) { diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/IntegrationTests/CodeGenerationIntegrationTest.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/IntegrationTests/CodeGenerationIntegrationTest.cs index 7b1ff9a8bf..b93507ffb3 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/IntegrationTests/CodeGenerationIntegrationTest.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/IntegrationTests/CodeGenerationIntegrationTest.cs @@ -540,6 +540,7 @@ public class AllTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); + AssertHtmlDocumentMatchesBaseline(compiled.CodeDocument.GetHtmlDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); @@ -559,6 +560,7 @@ public class AllTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); + AssertHtmlDocumentMatchesBaseline(compiled.CodeDocument.GetHtmlDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); @@ -584,6 +586,7 @@ public class MyService // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); + AssertHtmlDocumentMatchesBaseline(compiled.CodeDocument.GetHtmlDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); @@ -620,6 +623,7 @@ public class MyModel // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); + AssertHtmlDocumentMatchesBaseline(compiled.CodeDocument.GetHtmlDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); @@ -655,6 +659,7 @@ public class MyModel // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); + AssertHtmlDocumentMatchesBaseline(compiled.CodeDocument.GetHtmlDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); @@ -674,6 +679,7 @@ public class MyModel // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); + AssertHtmlDocumentMatchesBaseline(compiled.CodeDocument.GetHtmlDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); @@ -693,6 +699,7 @@ public class MyModel // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); + AssertHtmlDocumentMatchesBaseline(compiled.CodeDocument.GetHtmlDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); @@ -712,6 +719,7 @@ public class MyModel // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); + AssertHtmlDocumentMatchesBaseline(compiled.CodeDocument.GetHtmlDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); @@ -728,6 +736,7 @@ public class MyModel // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); + AssertHtmlDocumentMatchesBaseline(compiled.CodeDocument.GetHtmlDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); @@ -753,6 +762,7 @@ public class InputTestTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); + AssertHtmlDocumentMatchesBaseline(compiled.CodeDocument.GetHtmlDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); @@ -769,6 +779,7 @@ public class InputTestTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); + AssertHtmlDocumentMatchesBaseline(compiled.CodeDocument.GetHtmlDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); @@ -792,6 +803,7 @@ public class MyApp // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); + AssertHtmlDocumentMatchesBaseline(compiled.CodeDocument.GetHtmlDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); @@ -824,6 +836,7 @@ public class MyApp // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); + AssertHtmlDocumentMatchesBaseline(compiled.CodeDocument.GetHtmlDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); @@ -857,6 +870,7 @@ public class MyService // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); + AssertHtmlDocumentMatchesBaseline(compiled.CodeDocument.GetHtmlDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); @@ -873,6 +887,7 @@ public class MyService // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); + AssertHtmlDocumentMatchesBaseline(compiled.CodeDocument.GetHtmlDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); @@ -895,6 +910,7 @@ public class ThisShouldBeGenerated // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); + AssertHtmlDocumentMatchesBaseline(compiled.CodeDocument.GetHtmlDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); @@ -923,6 +939,7 @@ public class InputTestTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); + AssertHtmlDocumentMatchesBaseline(compiled.CodeDocument.GetHtmlDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); @@ -946,6 +963,7 @@ public class DivTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); + AssertHtmlDocumentMatchesBaseline(compiled.CodeDocument.GetHtmlDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); @@ -962,6 +980,7 @@ public class DivTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); + AssertHtmlDocumentMatchesBaseline(compiled.CodeDocument.GetHtmlDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); @@ -985,6 +1004,7 @@ public class DivTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); + AssertHtmlDocumentMatchesBaseline(compiled.CodeDocument.GetHtmlDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); @@ -1001,6 +1021,7 @@ public class DivTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); + AssertHtmlDocumentMatchesBaseline(compiled.CodeDocument.GetHtmlDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); @@ -1017,6 +1038,7 @@ public class DivTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); + AssertHtmlDocumentMatchesBaseline(compiled.CodeDocument.GetHtmlDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); @@ -1049,6 +1071,7 @@ public class AllTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); + AssertHtmlDocumentMatchesBaseline(compiled.CodeDocument.GetHtmlDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); @@ -1065,6 +1088,7 @@ public class AllTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); + AssertHtmlDocumentMatchesBaseline(compiled.CodeDocument.GetHtmlDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/RazorPageDocumentClassifierPassTest.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/RazorPageDocumentClassifierPassTest.cs index 286edb49bf..c66ac3d4e0 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/RazorPageDocumentClassifierPassTest.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/RazorPageDocumentClassifierPassTest.cs @@ -82,7 +82,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions // Arrange var content = @" @* some comment *@ - + @page "; var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create(content, "Test.cshtml")); diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.codegen.html new file mode 100644 index 0000000000..e2017f6ce6 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.codegen.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_DesignTime.codegen.html new file mode 100644 index 0000000000..e7b0219a38 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_DesignTime.codegen.html @@ -0,0 +1,9 @@ + +
+ Hello world + +
+ + + + diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.html new file mode 100644 index 0000000000..08d042e897 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.html @@ -0,0 +1,8 @@ +
+ Hello world + +
+ + + +

diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.html new file mode 100644 index 0000000000..85fabc0abd --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.html @@ -0,0 +1,15 @@ + + + + + " + + + + + + + + + + diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.html new file mode 100644 index 0000000000..6adf1586e1 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.html @@ -0,0 +1,2 @@ + + diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.html new file mode 100644 index 0000000000..b1214751a9 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.html @@ -0,0 +1,2 @@ + + diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.html new file mode 100644 index 0000000000..b05e435fda --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.html @@ -0,0 +1,3 @@ + + + diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.html new file mode 100644 index 0000000000..0c20f0ce0c --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.html @@ -0,0 +1,5 @@ + + + + + diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.html new file mode 100644 index 0000000000..8a218bdd8d --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.html @@ -0,0 +1 @@ + diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.codegen.html new file mode 100644 index 0000000000..c72931e132 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.codegen.html @@ -0,0 +1 @@ + Test. \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.codegen.html new file mode 100644 index 0000000000..9645bac584 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.codegen.html @@ -0,0 +1,4 @@ + "foo + +

About Us

+

We are awesome.

\ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.html new file mode 100644 index 0000000000..4649d9d2d6 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.html @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.html new file mode 100644 index 0000000000..1638a82fb4 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.html @@ -0,0 +1 @@ + diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.html new file mode 100644 index 0000000000..4a2f4743cf --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.html @@ -0,0 +1,2 @@ + + diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.codegen.html new file mode 100644 index 0000000000..6742b0a9e3 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.codegen.html @@ -0,0 +1,3 @@ + + +

Hi There!

diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.codegen.html new file mode 100644 index 0000000000..8f9ba3e623 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.codegen.html @@ -0,0 +1,2 @@ +
Some text here.
+ diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.codegen.html new file mode 100644 index 0000000000..dbfd76ba01 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.codegen.html @@ -0,0 +1,13 @@ + + + + + + + + + + + + +

New Customer

diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.html new file mode 100644 index 0000000000..ae827b1270 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.html @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + +

New Customer

+
+
+
+ +
+ + +
+
+
+
+ +
+
+
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.codegen.html new file mode 100644 index 0000000000..dc0c2ec4e1 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.codegen.html @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + +

New Customer

+
+
+
+ +
+ + +
+
+
+
+ +
+
+
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.html new file mode 100644 index 0000000000..849f18b015 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.html @@ -0,0 +1,14 @@ + + + + + + + + +
Some body
+ + +
This is in Section 1
+ + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.codegen.html new file mode 100644 index 0000000000..52fe51a130 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.codegen.html @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.html new file mode 100644 index 0000000000..5b456be824 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.html @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.codegen.html new file mode 100644 index 0000000000..835b3a68ca --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.codegen.html @@ -0,0 +1,2 @@ + +

Hi There!

diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.html new file mode 100644 index 0000000000..262e601e9c --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/ClassifiedSpanVisitor.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/ClassifiedSpanVisitor.cs index 81edb96152..f162744130 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/ClassifiedSpanVisitor.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/ClassifiedSpanVisitor.cs @@ -18,6 +18,11 @@ namespace Microsoft.AspNetCore.Razor.Language public ClassifiedSpanVisitor(RazorSourceDocument source) { + if (source is null) + { + throw new ArgumentNullException(nameof(source)); + } + _source = source; _spans = new List(); _currentBlockKind = BlockKindInternal.Markup; diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorCSharpLoweringPhase.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorCSharpLoweringPhase.cs index f09c68069a..5206b7b45c 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorCSharpLoweringPhase.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorCSharpLoweringPhase.cs @@ -2,7 +2,6 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.Collections.Generic; using Microsoft.AspNetCore.Razor.Language.CodeGeneration; using Microsoft.AspNetCore.Razor.Language.Intermediate; diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorHtmlDocument.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorHtmlDocument.cs new file mode 100644 index 0000000000..82de883267 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorHtmlDocument.cs @@ -0,0 +1,35 @@ +// 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; + +namespace Microsoft.AspNetCore.Razor.Language +{ + internal class DefaultRazorHtmlDocument : RazorHtmlDocument + { + private readonly string _generatedHtml; + private readonly RazorCodeGenerationOptions _options; + + public DefaultRazorHtmlDocument( + string generatedHtml, + RazorCodeGenerationOptions options) + { + if (generatedHtml == null) + { + throw new ArgumentNullException(nameof(generatedHtml)); + } + + if (options == null) + { + throw new ArgumentNullException(nameof(options)); + } + + _generatedHtml = generatedHtml; + _options = options; + } + + public override string GeneratedHtml => _generatedHtml; + + public override RazorCodeGenerationOptions Options => _options; + } +} diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorTagHelperBinderPhase.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorTagHelperBinderPhase.cs index e9982aa2c5..9a0f8c1bc3 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorTagHelperBinderPhase.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorTagHelperBinderPhase.cs @@ -102,8 +102,6 @@ namespace Microsoft.AspNetCore.Razor.Language return string.Equals(descriptor.Name, typePattern, StringComparison.Ordinal); } - - internal abstract class DirectiveVisitor : SyntaxWalker { public abstract HashSet Matches { get; } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorCodeDocumentExtensions.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorCodeDocumentExtensions.cs index 704a9da482..6d22aa5f27 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorCodeDocumentExtensions.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorCodeDocumentExtensions.cs @@ -3,9 +3,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; using System.Text; using Microsoft.AspNetCore.Razor.Language.Extensions; using Microsoft.AspNetCore.Razor.Language.Intermediate; @@ -118,6 +115,27 @@ namespace Microsoft.AspNetCore.Razor.Language document.Items[typeof(DocumentIntermediateNode)] = documentNode; } + internal static RazorHtmlDocument GetHtmlDocument(this RazorCodeDocument document) + { + if (document == null) + { + throw new ArgumentNullException(nameof(document)); + } + + var razorHtmlObj = document.Items[typeof(RazorHtmlDocument)]; + if (razorHtmlObj == null) + { + var razorHtmlDocument = RazorHtmlWriter.GetHtmlDocument(document); + if (razorHtmlDocument != null) + { + document.Items[typeof(RazorHtmlDocument)] = razorHtmlDocument; + return razorHtmlDocument; + } + } + + return (RazorHtmlDocument)razorHtmlObj; + } + public static RazorCSharpDocument GetCSharpDocument(this RazorCodeDocument document) { if (document == null) diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorEngine.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorEngine.cs index cb8a10389a..864c5c2da5 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorEngine.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorEngine.cs @@ -14,7 +14,7 @@ namespace Microsoft.AspNetCore.Razor.Language { #pragma warning disable CS0618 // Type or member is obsolete private static RazorEngine CreateCore(RazorConfiguration configuration, bool designTime, Action configure) -#pragma warning disable CS0618 // Type or member is obsolete +#pragma warning restore CS0618 // Type or member is obsolete { if (configuration == null) { diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorHtmlDocument.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorHtmlDocument.cs new file mode 100644 index 0000000000..2f14695577 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorHtmlDocument.cs @@ -0,0 +1,29 @@ +// 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; + +namespace Microsoft.AspNetCore.Razor.Language +{ + internal abstract class RazorHtmlDocument + { + public abstract string GeneratedHtml { get; } + + public abstract RazorCodeGenerationOptions Options { get; } + + public static RazorHtmlDocument Create(string generatedHtml, RazorCodeGenerationOptions options) + { + if (generatedHtml == null) + { + throw new ArgumentNullException(nameof(generatedHtml)); + } + + if (options == null) + { + throw new ArgumentNullException(nameof(options)); + } + + return new DefaultRazorHtmlDocument(generatedHtml, options); + } + } +} diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorHtmlWriter.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorHtmlWriter.cs new file mode 100644 index 0000000000..6d29531efb --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorHtmlWriter.cs @@ -0,0 +1,166 @@ +// 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 System.Diagnostics; +using System.Text; +using Microsoft.AspNetCore.Razor.Language.Syntax; + +namespace Microsoft.AspNetCore.Razor.Language +{ + // We want to generate a HTML document that contains only pure HTML. + // So we want replace all non-HTML content with whitespace. + // Ideally we should just use ClassifiedSpans to generate this document but + // not all characters in the document are included in the ClassifiedSpans. + internal class RazorHtmlWriter : SyntaxWalker + { + private bool _isHtml; + + private RazorHtmlWriter(RazorSourceDocument source) + { + if (source is null) + { + throw new ArgumentNullException(nameof(source)); + } + + Source = source; + Builder = new StringBuilder(Source.Length); + _isHtml = true; + } + + public RazorSourceDocument Source { get; } + + public StringBuilder Builder { get; } + + public static RazorHtmlDocument GetHtmlDocument(RazorCodeDocument codeDocument) + { + var options = codeDocument.GetCodeGenerationOptions(); + if (options == null || !options.DesignTime) + { + // Not needed in run time. This pass generates the backing HTML document that is used to provide HTML intellisense. + return null; + } + + var writer = new RazorHtmlWriter(codeDocument.Source); + var syntaxTree = codeDocument.GetSyntaxTree(); + + writer.Visit(syntaxTree.Root); + + var generatedHtml = writer.Builder.ToString(); + Debug.Assert( + writer.Source.Length == writer.Builder.Length, + $"The backing HTML document should be the same length as the original document. Expected: {writer.Source.Length} Actual: {writer.Builder.Length}"); + + var razorHtmlDocument = new DefaultRazorHtmlDocument(generatedHtml, options); + return razorHtmlDocument; + } + + public override void VisitRazorCommentBlock(RazorCommentBlockSyntax node) + { + WriteNode(node, isHtml: false, base.VisitRazorCommentBlock); + } + + public override void VisitRazorMetaCode(RazorMetaCodeSyntax node) + { + WriteNode(node, isHtml: false, base.VisitRazorMetaCode); + } + + public override void VisitMarkupTransition(MarkupTransitionSyntax node) + { + WriteNode(node, isHtml: false, base.VisitMarkupTransition); + } + + public override void VisitCSharpTransition(CSharpTransitionSyntax node) + { + WriteNode(node, isHtml: false, base.VisitCSharpTransition); + } + + public override void VisitCSharpEphemeralTextLiteral(CSharpEphemeralTextLiteralSyntax node) + { + WriteNode(node, isHtml: false, base.VisitCSharpEphemeralTextLiteral); + } + + public override void VisitCSharpExpressionLiteral(CSharpExpressionLiteralSyntax node) + { + WriteNode(node, isHtml: false, base.VisitCSharpExpressionLiteral); + } + + public override void VisitCSharpStatementLiteral(CSharpStatementLiteralSyntax node) + { + WriteNode(node, isHtml: false, base.VisitCSharpStatementLiteral); + } + + public override void VisitMarkupStartTag(MarkupStartTagSyntax node) + { + WriteNode(node, isHtml: true, base.VisitMarkupStartTag); + } + + public override void VisitMarkupEndTag(MarkupEndTagSyntax node) + { + WriteNode(node, isHtml: true, base.VisitMarkupEndTag); + } + + public override void VisitMarkupTagHelperStartTag(MarkupTagHelperStartTagSyntax node) + { + WriteNode(node, isHtml: true, base.VisitMarkupTagHelperStartTag); + } + + public override void VisitMarkupTagHelperEndTag(MarkupTagHelperEndTagSyntax node) + { + WriteNode(node, isHtml: true, base.VisitMarkupTagHelperEndTag); + } + + public override void VisitMarkupEphemeralTextLiteral(MarkupEphemeralTextLiteralSyntax node) + { + WriteNode(node, isHtml: true, base.VisitMarkupEphemeralTextLiteral); + } + + public override void VisitMarkupTextLiteral(MarkupTextLiteralSyntax node) + { + WriteNode(node, isHtml: true, base.VisitMarkupTextLiteral); + } + + public override void VisitUnclassifiedTextLiteral(UnclassifiedTextLiteralSyntax node) + { + WriteNode(node, isHtml: true, base.VisitUnclassifiedTextLiteral); + } + + public override void VisitToken(SyntaxToken token) + { + base.VisitToken(token); + WriteToken(token); + } + + private void WriteToken(SyntaxToken token) + { + var content = token.Content; + if (_isHtml) + { + // If we're in HTML context, append the content directly. + Builder.Append(content); + return; + } + + // We're in non-HTML context. Let's replace all non-whitespace chars with a space. + foreach (var c in content) + { + if (char.IsWhiteSpace(c)) + { + Builder.Append(c); + } + else + { + Builder.Append(' '); + } + } + } + + private void WriteNode(TNode node, bool isHtml, Action handler) where TNode : SyntaxNode + { + var old = _isHtml; + _isHtml = isHtml; + handler(node); + _isHtml = old; + } + } +} diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/Components/ComponentMarkupBlockPassTest.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/Components/ComponentMarkupBlockPassTest.cs index ca9885009a..365b7909f9 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/Components/ComponentMarkupBlockPassTest.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/Components/ComponentMarkupBlockPassTest.cs @@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components Pass.Engine = Engine; } - + private DefaultRazorProjectEngine ProjectEngine { get; } private RazorEngine Engine { get; } @@ -81,7 +81,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components Assert.Equal(expected, block.Content, ignoreLineEndingDifferences: true); } - // See: https://github.com/aspnet/AspNetCore/issues/6480 + // See: https://github.com/dotnet/aspnetcore/issues/6480 [Fact] public void Execute_RewritesHtml_HtmlAttributePrefix() { diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/CodeGenerationIntegrationTest.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/CodeGenerationIntegrationTest.cs index 22133be03f..175c69abf6 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/CodeGenerationIntegrationTest.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/CodeGenerationIntegrationTest.cs @@ -1001,6 +1001,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests // Assert AssertDocumentNodeMatchesBaseline(codeDocument.GetDocumentIntermediateNode()); + AssertHtmlDocumentMatchesBaseline(codeDocument.GetHtmlDocument()); AssertCSharpDocumentMatchesBaseline(codeDocument.GetCSharpDocument()); AssertSourceMappingsMatchBaseline(codeDocument); AssertLinePragmas(codeDocument, designTime: true); diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs index 1fde6741b2..b9fb0e4020 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs @@ -5120,7 +5120,7 @@ namespace Test CompileToAssembly(generated); } - [Fact] // https://github.com/aspnet/Blazor/issues/597 + [Fact] // https://github.com/dotnet/blazor/issues/597 public void Regression_597() { // Arrange @@ -5186,7 +5186,7 @@ namespace Test CompileToAssembly(generated); } - [Fact] // https://github.com/aspnet/Blazor/issues/772 + [Fact] // https://github.com/dotnet/blazor/issues/772 public void Regression_772() { // Arrange @@ -5224,7 +5224,7 @@ Welcome to your new app. d => Assert.Equal("RZ1035", d.Id)); } - [Fact] // https://github.com/aspnet/Blazor/issues/773 + [Fact] // https://github.com/dotnet/blazor/issues/773 public void Regression_773() { // Arrange diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentDeclarationIntegrationTest.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentDeclarationIntegrationTest.cs index 94425c895b..8e9215906e 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentDeclarationIntegrationTest.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentDeclarationIntegrationTest.cs @@ -95,7 +95,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests Assert.Contains(typeof(IDoCoolThings), component.GetType().GetInterfaces()); } - [Fact] // Regression test for https://github.com/aspnet/Blazor/issues/453 + [Fact] // Regression test for https://github.com/dotnet/blazor/issues/453 public void DeclarationConfiguration_FunctionsBlockHasLineMappings_MappingsApplyToError() { // Arrange & Act 1 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/Microsoft.AspNetCore.Razor.Language.Test.csproj b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/Microsoft.AspNetCore.Razor.Language.Test.csproj index abdd61a8fd..120eee7bb4 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/Microsoft.AspNetCore.Razor.Language.Test.csproj +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/Microsoft.AspNetCore.Razor.Language.Test.csproj @@ -23,7 +23,6 @@ - diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/RazorProjectEngineTest.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/RazorProjectEngineTest.cs index 576c3cc448..c9fa4504cd 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/RazorProjectEngineTest.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/RazorProjectEngineTest.cs @@ -81,7 +81,7 @@ namespace Microsoft.AspNetCore.Razor.Language feature => Assert.IsType(feature), feature => Assert.IsType(feature), feature => Assert.IsType(feature), - feature => Assert.IsType(feature), + feature => Assert.IsType(feature), feature => Assert.IsType(feature)); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.codegen.html new file mode 100644 index 0000000000..0da46f2152 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.codegen.html @@ -0,0 +1 @@ + diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.codegen.html new file mode 100644 index 0000000000..fd82d19806 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.codegen.html @@ -0,0 +1,6 @@ + + + + + +Hello World \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.codegen.html new file mode 100644 index 0000000000..22593ca1ef --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.codegen.html @@ -0,0 +1,26 @@ + + + + + + + +
+

Basic Asynchronous Expression Test

+

Basic Asynchronous Expression:

+

Basic Asynchronous Template:

+

Basic Asynchronous Statement:

+

Basic Asynchronous Statement Nested:

+

Basic Incomplete Asynchronous Statement:

+
+ +
+

Advanced Asynchronous Expression Test

+

Advanced Asynchronous Expression:

+

Advanced Asynchronous Expression Extended:

+

Advanced Asynchronous Template:

+

Advanced Asynchronous Statement:

+

Advanced Asynchronous Statement Extended:

+

Advanced Asynchronous Statement Nested:

+

Advanced Incomplete Asynchronous Statement:

+
\ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.codegen.html new file mode 100644 index 0000000000..dc08c79219 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.codegen.html @@ -0,0 +1,37 @@ + + + + + +

Hello from C#, #

+ + + + +

We wrote 10 lines!

+ + + + +

No really, we wrote 10 lines!

+ + +

Actually, we didn't...

+ + + + +

Hello again from C#, #

+ + + +

That time, we wrote 5 lines!

+ +

Oh no! An error occurred:

+ + +

i is now

+ + +

This block is locked, for your security!

+ \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.codegen.html new file mode 100644 index 0000000000..a2aad32abe --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.codegen.html @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + +

+ Here's a very unique number: +

+ +
+ +
+ + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.codegen.html new file mode 100644 index 0000000000..2e0ee4dc6e --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.codegen.html @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.codegen.html new file mode 100644 index 0000000000..136d06384a --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.codegen.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.codegen.html new file mode 100644 index 0000000000..a6e01f1a0e --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.codegen.html @@ -0,0 +1,4 @@ + + foo + bar + diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.codegen.html new file mode 100644 index 0000000000..f857199dcf --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.codegen.html @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.html new file mode 100644 index 0000000000..46a4402680 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.html @@ -0,0 +1,15 @@ + + + + +

+

+

+ + +

+ + + + + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.html new file mode 100644 index 0000000000..be5ba4979a --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.html @@ -0,0 +1,15 @@ +

+ +

+ +

Bar Biz

+

+ + +

Foo

+ + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.codegen.html new file mode 100644 index 0000000000..9ebe0e3a78 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.codegen.html @@ -0,0 +1,3 @@ +This is markup + + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.codegen.html new file mode 100644 index 0000000000..9ebe0e3a78 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.codegen.html @@ -0,0 +1,3 @@ +This is markup + + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.codegen.html new file mode 100644 index 0000000000..1568f6aa34 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.codegen.html @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.codegen.html new file mode 100644 index 0000000000..76ee36910b --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.codegen.html @@ -0,0 +1,3 @@ +This is markup + + ! \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.codegen.html new file mode 100644 index 0000000000..6eaf3f7aa0 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.codegen.html @@ -0,0 +1,3 @@ +This is markup + + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.codegen.html new file mode 100644 index 0000000000..fc59317849 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.codegen.html @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.codegen.html new file mode 100644 index 0000000000..33b749a2f9 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.codegen.html @@ -0,0 +1 @@ +1 + 1 = \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.codegen.html new file mode 100644 index 0000000000..de86958add --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.codegen.html @@ -0,0 +1,16 @@ + + + + + + + + +

Foo is Null!

+ + +

+ + + +

\ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.codegen.html new file mode 100644 index 0000000000..6393f9703b --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.codegen.html @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.codegen.html new file mode 100644 index 0000000000..46d84b460b --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.codegen.html @@ -0,0 +1,12 @@ + + + + + + + + + + + +Here's a random number: \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.codegen.html new file mode 100644 index 0000000000..13484a1b45 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.codegen.html @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_DesignTime.codegen.html new file mode 100644 index 0000000000..21fdc4d316 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_DesignTime.codegen.html @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_DesignTime.codegen.html new file mode 100644 index 0000000000..1c32421c7e --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_DesignTime.codegen.html @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.codegen.html new file mode 100644 index 0000000000..d0776340e1 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.codegen.html @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.codegen.html new file mode 100644 index 0000000000..f1c2edafa2 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.codegen.html @@ -0,0 +1,3 @@ +This is markup + + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.codegen.html new file mode 100644 index 0000000000..c3ca733a2b --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.codegen.html @@ -0,0 +1,3 @@ + +

This is item #

+ \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.html new file mode 100644 index 0000000000..b7d08f3856 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.html @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + { + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.codegen.html new file mode 100644 index 0000000000..b60ac0100e --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.codegen.html @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.codegen.html new file mode 100644 index 0000000000..3b6fa1cd06 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.codegen.html @@ -0,0 +1,3 @@ + (string link) { +
+} \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.codegen.html new file mode 100644 index 0000000000..111d1f7474 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.codegen.html @@ -0,0 +1,38 @@ + + +

Bar

+ Hello, World +

Hello, World

+ + + +

Hello from C#, #

+ + + + +

We wrote 10 lines!

+ + + + +

No really, we wrote 10 lines!

+ + +

Actually, we didn't...

+ + + + +

Hello again from C#, #

+ + + +

That time, we wrote 5 lines!

+ +

Oh no! An error occurred:

+ + + +

This block is locked, for your security!

+ \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.codegen.html new file mode 100644 index 0000000000..9148ce7323 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.codegen.html @@ -0,0 +1,5 @@ + + +

Hello from C#, #

+ + diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.codegen.html new file mode 100644 index 0000000000..4b346c914a --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.codegen.html @@ -0,0 +1,45 @@ + + + + + + + + + +
+ + + + + + + + + + +
+

Happy birthday !

+
+ +
    + + +
  • Happy birthday!
  • + +
+ + + + + + +

Secret message

+ + + + + + + + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.codegen.html new file mode 100644 index 0000000000..c1b9240ee0 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.codegen.html @@ -0,0 +1,8 @@ + + + +
+ . +
+ + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.codegen.html new file mode 100644 index 0000000000..c56380dfcb --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.codegen.html @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas_DesignTime.codegen.html new file mode 100644 index 0000000000..b7c02278c1 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas_DesignTime.codegen.html @@ -0,0 +1,38 @@ + + + + + +

Hello from C#, #

+ + + + +

We wrote 10 lines!

+ + + + +

No really, we wrote 10 lines!

+ + +

Actually, we didn't...

+ + + + +

Hello again from C#, #

+ + + +

That time, we wrote 5 lines!

+ +

Oh no! An error occurred:

+ + + +

i is now

+ + +

This block is locked, for your security!

+ \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions_DesignTime.codegen.html new file mode 100644 index 0000000000..7ad423b1f2 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions_DesignTime.codegen.html @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_DesignTime.codegen.html new file mode 100644 index 0000000000..1675f64383 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_DesignTime.codegen.html @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError_DesignTime.codegen.html new file mode 100644 index 0000000000..d007646328 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError_DesignTime.codegen.html @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_DesignTime.codegen.html new file mode 100644 index 0000000000..f851e2e597 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_DesignTime.codegen.html @@ -0,0 +1,18 @@ + +

This should be shown

+ + + + + + + + + + +

But this should show the comment syntax:

+ + + + + diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective_DesignTime.codegen.html new file mode 100644 index 0000000000..77def406f5 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective_DesignTime.codegen.html @@ -0,0 +1 @@ + diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.html new file mode 100644 index 0000000000..72ff37f26c --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.html @@ -0,0 +1,17 @@ + + + + +
This is in the Body> + + +
This is in Section 2
+ + + +
This is in Section 1
+ + + + + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_DesignTime.codegen.html new file mode 100644 index 0000000000..11a63ced54 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_DesignTime.codegen.html @@ -0,0 +1,4 @@ + + +
+ \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements_DesignTime.codegen.html new file mode 100644 index 0000000000..3d06dc8b90 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements_DesignTime.codegen.html @@ -0,0 +1,102 @@ +

Before Text

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Hello!

+ + +

The time is

+ +

After Text

\ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.codegen.html new file mode 100644 index 0000000000..b47c6a931c --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.codegen.html @@ -0,0 +1,237 @@ +

This is line 1

+

This is line 2

+

This is line 3

+

This is line 4

+

This is line 5

+

This is line 6

+

This is line 7

+

This is line 8

+

This is line 9

+

This is line 10

+

This is line 11

+

This is line 12

+

This is line 13

+

This is line 14

+

This is line 15

+

This is line 16

+

This is line 17

+

This is line 18

+

This is line 19

+

This is line 20

+

This is line 21

+

This is line 22

+

This is line 23

+

This is line 24

+

This is line 25

+

This is line 26

+

This is line 27

+

This is line 28

+

This is line 29

+

This is line 30

+

This is line 31

+

This is line 32

+

This is line 33

+

This is line 34

+

This is line 35

+

This is line 36

+

This is line 37

+

This is line 38

+

This is line 39

+

This is line 40

+

This is line 41

+

This is line 42

+

This is line 43

+

This is line 44

+

This is line 45

+

This is line 46

+

This is line 47

+

This is line 48

+

This is line 49

+

This is line 50

+

This is line 51

+

This is line 52

+

This is line 53

+

This is line 54

+

This is line 55

+

This is line 56

+

This is line 57

+

This is line 58

+

This is line 59

+

This is line 60

+

This is line 61

+

This is line 62

+

This is line 63

+

This is line 64

+

This is line 65

+

This is line 66

+

This is line 67

+

This is line 68

+

This is line 69

+

This is line 70

+

This is line 71

+

This is line 72

+

This is line 73

+

This is line 74

+

This is line 75

+

This is line 76

+

This is line 77

+

This is line 78

+

This is line 79

+

This is line 80

+

This is line 81

+

This is line 82

+

This is line 83

+

This is line 84


+ + +

This is line 1 nested

+

This is line 2 nested

+

This is line 3 nested

+

This is line 4 nested

+

This is line 5 nested

+

This is line 6 nested

+

This is line 7 nested

+

This is line 8 nested

+

This is line 9 nested

+

This is line 10 nested

+

This is line 11 nested

+

This is line 12 nested

+

This is line 13 nested

+

This is line 14 nested

+

This is line 15 nested

+

This is line 16 nested

+

This is line 17 nested

+

This is line 18 nested

+

This is line 19 nested

+

This is line 20 nested

+

This is line 21 nested

+

This is line 22 nested

+

This is line 23 nested

+

This is line 24 nested

+

This is line 25 nested

+

This is line 26 nested

+

This is line 27 nested

+

This is line 28 nested

+

This is line 29 nested

+

This is line 30 nested

+

This is line 31 nested

+

This is line 32 nested

+

This is line 33 nested

+

This is line 34 nested

+

This is line 35 nested

+

This is line 36 nested

+

This is line 37 nested

+

This is line 38 nested

+

This is line 39 nested

+

This is line 40 nested

+

This is line 41 nested

+

This is line 42 nested

+

This is line 43 nested

+

This is line 44 nested

+

This is line 45 nested

+

This is line 46 nested

+

This is line 47 nested

+

This is line 48 nested

+

This is line 49 nested

+

This is line 50 nested

+

This is line 51 nested

+

This is line 52 nested

+

This is line 53 nested

+

This is line 54 nested

+

This is line 55 nested

+

This is line 56 nested

+

This is line 57 nested

+

This is line 58 nested

+

This is line 59 nested

+

This is line 60 nested

+

This is line 61 nested

+

This is line 62 nested

+

This is line 63 nested

+

This is line 64 nested

+

This is line 65 nested

+

This is line 66 nested

+

This is line 67 nested

+

This is line 68 nested

+

This is line 69 nested

+

This is line 70 nested

+

This is line 71 nested

+

This is line 72 nested

+

This is line 73 nested

+

This is line 74 nested

+

This is line 75 nested

+ +

This is line 1

+

This is line 2

+

This is line 3

+

This is line 4

+

This is line 5

+

This is line 6

+

This is line 7

+

This is line 8

+

This is line 9

+

This is line 10

+

This is line 11

+

This is line 12

+

This is line 13

+

This is line 14

+

This is line 15

+

This is line 16

+

This is line 17

+

This is line 18

+

This is line 19

+

This is line 20

+

This is line 21

+

This is line 22

+

This is line 23

+

This is line 24

+

This is line 25

+

This is line 26

+

This is line 27

+

This is line 28

+

This is line 29

+

This is line 30

+

This is line 31

+

This is line 32

+

This is line 33

+

This is line 34

+

This is line 35

+

This is line 36

+

This is line 37

+

This is line 38

+

This is line 39

+

This is line 40

+

This is line 41

+

This is line 42

+

This is line 43

hi! + +

This is line 1 nested

+

This is line 2 nested

+

This is line 3 nested

+

This is line 4 nested

+

This is line 5 nested

+

This is line 6 nested

+

This is line 7 nested

+

This is line 8 nested

+

This is line 9 nested

+

This is line 10 nested

+

This is line 11 nested

+

This is line 12 nested

+

This is line 13 nested

+

This is line 14 nested

+

This is line 15 nested

+

This is line 16 nested

+

This is line 17 nested

+

This is line 18 nested

+

This is line 19 nested

+

This is line 20 nested

+

This is line 21 nested

+

This is line 22 nested

+

This is line 23 nested

+

This is line 24 nested

+

This is line 25 nested

+

This is line 26 nested

+

This is line 27 nested

+

This is line 28 nested

+

This is line 29 nested

+

30

+ ! \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_DesignTime.codegen.html new file mode 100644 index 0000000000..419c13c11c --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_DesignTime.codegen.html @@ -0,0 +1,9 @@ + + + + + + +This works ! + + + + +

Hello

+ + + +
    +
  • Item #
  • +
+ +

+ + This is line# of markup
+ +

+ +

+ + : This is line# of markup
+ +

+ +

+ + :: This is line# of markup
+ +

+ + +
    +
  • + Item # + +
      +
    • Child Items... ?
    • + +
    +
  • +
\ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_DesignTime.codegen.html new file mode 100644 index 0000000000..ae3e23d828 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_DesignTime.codegen.html @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_DesignTime.codegen.html new file mode 100644 index 0000000000..d16439d975 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_DesignTime.codegen.html @@ -0,0 +1,15 @@ + + + + + + + + + + + + + +

Path's full type name is

+

Foo's actual full type name is

\ No newline at end of file diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Tools/src/Microsoft.AspNetCore.Razor.Tools.csproj b/src/Razor/Microsoft.AspNetCore.Razor.Tools/src/Microsoft.AspNetCore.Razor.Tools.csproj index 5a08e5c723..a7a3a4d347 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Tools/src/Microsoft.AspNetCore.Razor.Tools.csproj +++ b/src/Razor/Microsoft.AspNetCore.Razor.Tools/src/Microsoft.AspNetCore.Razor.Tools.csproj @@ -7,7 +7,7 @@ This is intentionally targeting netcoreapp3.0. This allows using the Microsoft.NET.Sdk.Razor package without having to solve diamond dependency problems in AspNetCore. We use a runtimeconfig.json.template to allow roll forwards. In addition, the SDK stamps an exact version of the shared fx to use in all runtimeconfig.json that are contained in the SDK. - See the discussion here: https://github.com/aspnet/AspNetCore-Internal/issues/3201#issuecomment-539631557 + See the discussion here: https://github.com/dotnet/aspnetcore-internal/issues/3201#issuecomment-539631557 --> netcoreapp3.0 Exe diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Tools/test/DefaultExtensionAssemblyLoaderTest.cs b/src/Razor/Microsoft.AspNetCore.Razor.Tools/test/DefaultExtensionAssemblyLoaderTest.cs index ad619e5570..2997bd08b3 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Tools/test/DefaultExtensionAssemblyLoaderTest.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Tools/test/DefaultExtensionAssemblyLoaderTest.cs @@ -121,7 +121,7 @@ Delta: Gamma: Beta: Test B var actual = builder.ToString(); - Assert.Equal(expected, actual); + Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); } } } diff --git a/src/Razor/Microsoft.CodeAnalysis.Razor/src/BindTagHelperDescriptorProvider.cs b/src/Razor/Microsoft.CodeAnalysis.Razor/src/BindTagHelperDescriptorProvider.cs index e21332c150..05dea796a6 100644 --- a/src/Razor/Microsoft.CodeAnalysis.Razor/src/BindTagHelperDescriptorProvider.cs +++ b/src/Razor/Microsoft.CodeAnalysis.Razor/src/BindTagHelperDescriptorProvider.cs @@ -235,7 +235,7 @@ namespace Microsoft.CodeAnalysis.Razor // We need to check the constructor argument length here, because this can show up as 0 // if the language service fails to initialize. This is an invalid case, so skip it. - if (Equals(attribute.AttributeClass, bindElement) && attribute.ConstructorArguments.Length == 4) + if (SymbolEqualityComparer.Default.Equals(attribute.AttributeClass, bindElement) && attribute.ConstructorArguments.Length == 4) { results.Add(new ElementBindData( type.ContainingAssembly.Name, @@ -246,7 +246,7 @@ namespace Microsoft.CodeAnalysis.Razor (string)attribute.ConstructorArguments[2].Value, (string)attribute.ConstructorArguments[3].Value)); } - else if (Equals(attribute.AttributeClass, bindInputElement) && attribute.ConstructorArguments.Length == 4) + else if (SymbolEqualityComparer.Default.Equals(attribute.AttributeClass, bindInputElement) && attribute.ConstructorArguments.Length == 4) { results.Add(new ElementBindData( type.ContainingAssembly.Name, @@ -257,7 +257,7 @@ namespace Microsoft.CodeAnalysis.Razor (string)attribute.ConstructorArguments[2].Value, (string)attribute.ConstructorArguments[3].Value)); } - else if (Equals(attribute.AttributeClass, bindInputElement) && attribute.ConstructorArguments.Length == 6) + else if (SymbolEqualityComparer.Default.Equals(attribute.AttributeClass, bindInputElement) && attribute.ConstructorArguments.Length == 6) { results.Add(new ElementBindData( type.ContainingAssembly.Name, diff --git a/src/Razor/Microsoft.CodeAnalysis.Razor/src/ComponentTagHelperDescriptorProvider.cs b/src/Razor/Microsoft.CodeAnalysis.Razor/src/ComponentTagHelperDescriptorProvider.cs index ebc1947ca7..38fbfb6ba8 100644 --- a/src/Razor/Microsoft.CodeAnalysis.Razor/src/ComponentTagHelperDescriptorProvider.cs +++ b/src/Razor/Microsoft.CodeAnalysis.Razor/src/ComponentTagHelperDescriptorProvider.cs @@ -301,6 +301,7 @@ namespace Microsoft.CodeAnalysis.Razor b.Name = ComponentMetadata.ChildContent.ParameterAttributeName; b.TypeName = typeof(string).FullName; b.Metadata.Add(ComponentMetadata.Component.ChildContentParameterNameKey, bool.TrueString); + b.Metadata.Add(TagHelperMetadata.Common.PropertyName, b.Name); if (childContentName == null) { @@ -327,7 +328,7 @@ namespace Microsoft.CodeAnalysis.Razor var properties = new Dictionary(StringComparer.Ordinal); do { - if (Equals(type, symbols.ComponentBase)) + if (SymbolEqualityComparer.Default.Equals(type, symbols.ComponentBase)) { // The ComponentBase base class doesn't have any [Parameter]. // Bail out now to avoid walking through its many members, plus the members @@ -380,7 +381,7 @@ namespace Microsoft.CodeAnalysis.Razor kind = PropertyKind.Ignored; } - if (!property.GetAttributes().Any(a => Equals(a.AttributeClass, symbols.ParameterAttribute))) + if (!property.GetAttributes().Any(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, symbols.ParameterAttribute))) { if (property.IsOverride) { @@ -398,7 +399,7 @@ namespace Microsoft.CodeAnalysis.Razor kind = PropertyKind.Enum; } - if (kind == PropertyKind.Default && Equals(property.Type, symbols.RenderFragment)) + if (kind == PropertyKind.Default && SymbolEqualityComparer.Default.Equals(property.Type, symbols.RenderFragment)) { kind = PropertyKind.ChildContent; } @@ -406,12 +407,12 @@ namespace Microsoft.CodeAnalysis.Razor if (kind == PropertyKind.Default && property.Type is INamedTypeSymbol namedType && namedType.IsGenericType && - Equals(namedType.ConstructedFrom, symbols.RenderFragmentOfT)) + SymbolEqualityComparer.Default.Equals(namedType.ConstructedFrom, symbols.RenderFragmentOfT)) { kind = PropertyKind.ChildContent; } - if (kind == PropertyKind.Default && Equals(property.Type, symbols.EventCallback)) + if (kind == PropertyKind.Default && SymbolEqualityComparer.Default.Equals(property.Type, symbols.EventCallback)) { kind = PropertyKind.EventCallback; } @@ -419,7 +420,7 @@ namespace Microsoft.CodeAnalysis.Razor if (kind == PropertyKind.Default && property.Type is INamedTypeSymbol namedType2 && namedType2.IsGenericType && - Equals(namedType2.ConstructedFrom, symbols.EventCallbackOfT)) + SymbolEqualityComparer.Default.Equals(namedType2.ConstructedFrom, symbols.EventCallbackOfT)) { kind = PropertyKind.EventCallback; } diff --git a/src/Razor/Microsoft.CodeAnalysis.Razor/src/DefaultTagHelperDescriptorFactory.cs b/src/Razor/Microsoft.CodeAnalysis.Razor/src/DefaultTagHelperDescriptorFactory.cs index 17924a0018..4eb83b36b7 100644 --- a/src/Razor/Microsoft.CodeAnalysis.Razor/src/DefaultTagHelperDescriptorFactory.cs +++ b/src/Razor/Microsoft.CodeAnalysis.Razor/src/DefaultTagHelperDescriptorFactory.cs @@ -80,7 +80,7 @@ namespace Microsoft.CodeAnalysis.Razor { var targetElementAttributes = type .GetAttributes() - .Where(attribute => Equals(attribute.AttributeClass, _htmlTargetElementAttributeSymbol)); + .Where(attribute => SymbolEqualityComparer.Default.Equals(attribute.AttributeClass, _htmlTargetElementAttributeSymbol)); // If there isn't an attribute specifying the tag name derive it from the name if (!targetElementAttributes.Any()) @@ -139,7 +139,7 @@ namespace Microsoft.CodeAnalysis.Razor private void AddAllowedChildren(INamedTypeSymbol type, TagHelperDescriptorBuilder builder) { - var restrictChildrenAttribute = type.GetAttributes().Where(a => Equals(a.AttributeClass, _restrictChildrenAttributeSymbol)).FirstOrDefault(); + var restrictChildrenAttribute = type.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _restrictChildrenAttributeSymbol)).FirstOrDefault(); if (restrictChildrenAttribute == null) { return; @@ -174,7 +174,7 @@ namespace Microsoft.CodeAnalysis.Razor private void AddTagOutputHint(INamedTypeSymbol type, TagHelperDescriptorBuilder builder) { string outputElementHint = null; - var outputElementHintAttribute = type.GetAttributes().Where(a => Equals(a.AttributeClass, _outputElementHintAttributeSymbol)).FirstOrDefault(); + var outputElementHintAttribute = type.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _outputElementHintAttributeSymbol)).FirstOrDefault(); if (outputElementHintAttribute != null) { outputElementHint = (string)(outputElementHintAttribute.ConstructorArguments[0]).Value; @@ -189,7 +189,7 @@ namespace Microsoft.CodeAnalysis.Razor { var attributeNameAttribute = property .GetAttributes() - .Where(a => Equals(a.AttributeClass, _htmlAttributeNameAttributeSymbol)) + .Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _htmlAttributeNameAttributeSymbol)) .FirstOrDefault(); bool hasExplicitName; @@ -310,13 +310,13 @@ namespace Microsoft.CodeAnalysis.Razor private IReadOnlyList GetDictionaryArgumentTypes(IPropertySymbol property) { INamedTypeSymbol dictionaryType; - if (Equals((property.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol)) + if (SymbolEqualityComparer.Default.Equals((property.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol)) { dictionaryType = (INamedTypeSymbol)property.Type; } - else if (property.Type.AllInterfaces.Any(s => Equals(s.ConstructedFrom, _iDictionarySymbol))) + else if (property.Type.AllInterfaces.Any(s => SymbolEqualityComparer.Default.Equals(s.ConstructedFrom, _iDictionarySymbol))) { - dictionaryType = property.Type.AllInterfaces.First(s => Equals(s.ConstructedFrom, _iDictionarySymbol)); + dictionaryType = property.Type.AllInterfaces.First(s => SymbolEqualityComparer.Default.Equals(s.ConstructedFrom, _iDictionarySymbol)); } else { @@ -380,7 +380,7 @@ namespace Microsoft.CodeAnalysis.Razor private bool IsPotentialDictionaryProperty(IPropertySymbol property) { return - (Equals((property.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol) || property.Type.AllInterfaces.Any(s => Equals(s.ConstructedFrom, _iDictionarySymbol))) && + (SymbolEqualityComparer.Default.Equals((property.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol) || property.Type.AllInterfaces.Any(s => SymbolEqualityComparer.Default.Equals(s.ConstructedFrom, _iDictionarySymbol))) && GetDictionaryArgumentTypes(property)?[0].SpecialType == SpecialType.System_String; } @@ -397,8 +397,8 @@ namespace Microsoft.CodeAnalysis.Razor property.Parameters.Length == 0 && property.GetMethod != null && property.GetMethod.DeclaredAccessibility == Accessibility.Public && - property.GetAttributes().Where(a => Equals(a.AttributeClass, _htmlAttributeNotBoundAttributeSymbol)).FirstOrDefault() == null && - (property.GetAttributes().Any(a => Equals(a.AttributeClass, _htmlAttributeNameAttributeSymbol)) || + property.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _htmlAttributeNotBoundAttributeSymbol)).FirstOrDefault() == null && + (property.GetAttributes().Any(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _htmlAttributeNameAttributeSymbol)) || property.SetMethod != null && property.SetMethod.DeclaredAccessibility == Accessibility.Public || IsPotentialDictionaryProperty(property)) && !accessibleProperties.ContainsKey(property.Name)) @@ -418,7 +418,7 @@ namespace Microsoft.CodeAnalysis.Razor { if (ExcludeHidden) { - var editorBrowsableAttribute = symbol.GetAttributes().Where(a => Equals(a.AttributeClass, _editorBrowsableAttributeSymbol)).FirstOrDefault(); + var editorBrowsableAttribute = symbol.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _editorBrowsableAttributeSymbol)).FirstOrDefault(); if (editorBrowsableAttribute == null) { diff --git a/src/Razor/Microsoft.CodeAnalysis.Razor/src/EventHandlerTagHelperDescriptorProvider.cs b/src/Razor/Microsoft.CodeAnalysis.Razor/src/EventHandlerTagHelperDescriptorProvider.cs index 5522b50163..9f5cf0d20a 100644 --- a/src/Razor/Microsoft.CodeAnalysis.Razor/src/EventHandlerTagHelperDescriptorProvider.cs +++ b/src/Razor/Microsoft.CodeAnalysis.Razor/src/EventHandlerTagHelperDescriptorProvider.cs @@ -81,7 +81,7 @@ namespace Microsoft.CodeAnalysis.Razor { var attribute = attributes[j]; - if (Equals(attribute.AttributeClass, eventHandlerAttribute)) + if (SymbolEqualityComparer.Default.Equals(attribute.AttributeClass, eventHandlerAttribute)) { var enablePreventDefault = false; var enableStopPropagation = false; diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Sdk.Razor.CurrentVersion.targets b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Sdk.Razor.CurrentVersion.targets index e5e8d926a0..dfee69656f 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Sdk.Razor.CurrentVersion.targets +++ b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Sdk.Razor.CurrentVersion.targets @@ -30,7 +30,7 @@ Copyright (c) .NET Foundation. All rights reserved. $(MSBuildThisFileDirectory)..\..\ $(RazorSdkDirectoryRoot)tasks\ - <_RazorSdkTasksTFM Condition=" '$(MSBuildRuntimeType)' == 'Core'">netcoreapp3.1 + <_RazorSdkTasksTFM Condition=" '$(MSBuildRuntimeType)' == 'Core'">netcoreapp5.0 <_RazorSdkTasksTFM Condition=" '$(_RazorSdkTasksTFM)' == ''">net46 $(RazorSdkBuildTasksDirectoryRoot)$(_RazorSdkTasksTFM)\Microsoft.NET.Sdk.Razor.Tasks.dll @@ -516,7 +516,7 @@ Copyright (c) .NET Foundation. All rights reserved. diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/BuildVariables.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/BuildVariables.cs index 1373497c3e..d213b173c1 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/BuildVariables.cs +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/BuildVariables.cs @@ -6,7 +6,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests internal static partial class BuildVariables { private static string _msBuildPath = string.Empty; - private static string _microsoftNETCoreApp31PackageVersion = string.Empty; + private static string _MicrosoftNETCoreApp50PackageVersion = string.Empty; private static string _microsoftNetCompilersToolsetPackageVersion = string.Empty; static partial void InitializeVariables(); @@ -20,12 +20,12 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests } } - public static string MicrosoftNETCoreApp31PackageVersion + public static string MicrosoftNETCoreApp50PackageVersion { get { InitializeVariables(); - return _microsoftNETCoreApp31PackageVersion; + return _MicrosoftNETCoreApp50PackageVersion; } } diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/ApplicationPartDiscoveryIntegrationTest.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/ApplicationPartDiscoveryIntegrationTest.cs index 91a7fd89f6..f258b6eaa1 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/ApplicationPartDiscoveryIntegrationTest.cs +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/ApplicationPartDiscoveryIntegrationTest.cs @@ -97,7 +97,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests } } - // Regression test for https://github.com/aspnet/AspNetCore/issues/11315 + // Regression test for https://github.com/dotnet/aspnetcore/issues/11315 [Fact] [InitializeTestProject("AppWithP2PReference", additionalProjects: "ClassLibrary")] public async Task BuildIncrementalism_CausingRecompilation_WhenApplicationPartAttributeIsGenerated() @@ -123,7 +123,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests Assert.AssemblyHasAttribute(result, Path.Combine(OutputPath, "AppWithP2PReference.dll"), "Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute"); } - [Fact] + [Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/13303")] [InitializeTestProject("SimpleMvcFSharp", language: "F#", additionalProjects: "ClassLibrary")] public async Task Build_ProjectWithDependencyThatReferencesMvc_AddsAttributeToNonCSharpProjects() { diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest.cs index 6ccfae6bf0..598f21c93b 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest.cs +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest.cs @@ -472,7 +472,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests Assert.FileDoesNotContain(result, razorAssemblyInfo, "Microsoft.AspNetCore.Razor.Hosting.RazorConfigurationNameAttribute"); } - [Fact] + [Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/13303")] [InitializeTestProject("SimpleMvcFSharp", language: "F#")] public async Task Build_SimpleMvcFSharp_NoopsWithoutFailing() { @@ -639,13 +639,15 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests Assert.FileDoesNotExist(result, IntermediateOutputPath, "SimpleMvc.Views.dll"); } - [Fact(Skip = "Default C# version is 7.3 for netcoreapp3.1 and later https://github.com/aspnet/AspNetCore/issues/13930")] + [Fact(Skip = "Default C# version is 7.3 for netcoreapp3.1 and later https://github.com/dotnet/aspnetcore/issues/13930")] [InitializeTestProject("SimpleMvc")] public async Task Build_ImplicitCSharp8_NullableEnforcement_WarningsDuringBuild_NoBuildServer() { var result = await DotnetMSBuild( "Build", - "/p:Nullable=enable", + // Remove /p:LangVersion=Default once we've picked up a compiler that supports .NET 5.0. + // Tracked by https://github.com/dotnet/aspnetcore/issues/13304 + "/p:Nullable=enable /p:LangVersion=Default", suppressBuildServer: true); var indexFilePath = Path.Combine(RazorIntermediateOutputPath, "Views", "Home", "Index.cshtml.g.cs"); diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntrospectionTest.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntrospectionTest.cs index acff14237e..2e894fce62 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntrospectionTest.cs +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntrospectionTest.cs @@ -215,7 +215,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests [InitializeTestProject("SimpleMvc")] public async Task IntrospectJsonContentFiles_WithExcludeConfigFilesFromBuildOutputSet() { - // Verifies that the fix for https://github.com/aspnet/AspNetCore/issues/14017 works. + // Verifies that the fix for https://github.com/dotnet/aspnetcore/issues/14017 works. var result = await DotnetMSBuild("_IntrospectContentItems", "/p:ExcludeConfigFilesFromBuildOutput=true"); Assert.BuildPassed(result); @@ -229,21 +229,21 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests [InitializeTestProject("SimpleMvc")] public async Task IntrospectRazorTasksDllPath() { - // Regression test for https://github.com/aspnet/AspNetCore/issues/17308 + // Regression test for https://github.com/dotnet/aspnetcore/issues/17308 var solutionRoot = GetType().Assembly.GetCustomAttributes() .First(a => a.Key == "Testing.RepoRoot") .Value; var tfm = -#if NETCOREAPP3_1 - "netcoreapp3.1"; +#if NETCOREAPP5_0 + "netcoreapp5.0"; #else #error Target framework needs to be updated. #endif var expected = Path.Combine(solutionRoot, "artifacts", "bin", "Microsoft.NET.Sdk.Razor", Configuration, "sdk-output", "tasks", tfm, "Microsoft.NET.Sdk.Razor.Tasks.dll"); - // Verifies the fix for https://github.com/aspnet/AspNetCore/issues/17308 + // Verifies the fix for https://github.com/dotnet/aspnetcore/issues/17308 var result = await DotnetMSBuild("_IntrospectRazorTasks"); Assert.BuildPassed(result); @@ -262,7 +262,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests var tfm = "net46"; var expected = Path.Combine(solutionRoot, "artifacts", "bin", "Microsoft.NET.Sdk.Razor", Configuration, "sdk-output", "tasks", tfm, "Microsoft.NET.Sdk.Razor.Tasks.dll"); - // Verifies the fix for https://github.com/aspnet/AspNetCore/issues/17308 + // Verifies the fix for https://github.com/dotnet/aspnetcore/issues/17308 var result = await DotnetMSBuild("_IntrospectRazorTasks", msBuildProcessKind: MSBuildProcessKind.Desktop); Assert.BuildPassed(result); diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/InitializeTestProjectAttribute.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/InitializeTestProjectAttribute.cs index ebf9ddb067..0134607143 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/InitializeTestProjectAttribute.cs +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/InitializeTestProjectAttribute.cs @@ -38,7 +38,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests MSBuildIntegrationTestBase.Project = ProjectDirectory.Create(_originalProjectName, _testProjectName, _baseDirectory, _additionalProjects, _language); #if NETCOREAPP - MSBuildIntegrationTestBase.TargetFramework = "netcoreapp3.1"; + MSBuildIntegrationTestBase.TargetFramework = "netcoreapp5.0"; #else #error Target frameworks need to be updated #endif diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/MSBuildIntegrationTestBase.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/MSBuildIntegrationTestBase.cs index ddc33fb6f0..2a38d92bbe 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/MSBuildIntegrationTestBase.cs +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/MSBuildIntegrationTestBase.cs @@ -95,7 +95,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests // Let the test app know it is running as part of a test. "/p:RunningAsTest=true", - $"/p:MicrosoftNETCoreApp31PackageVersion={BuildVariables.MicrosoftNETCoreApp31PackageVersion}", + $"/p:MicrosoftNETCoreApp50PackageVersion={BuildVariables.MicrosoftNETCoreApp50PackageVersion}", $"/p:MicrosoftNetCompilersToolsetPackageVersion={BuildVariables.MicrosoftNetCompilersToolsetPackageVersion}", // Additional restore sources for projects that require built packages diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PackIntegrationTest.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PackIntegrationTest.cs index e148aa2b24..56c1cefaba 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PackIntegrationTest.cs +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PackIntegrationTest.cs @@ -11,7 +11,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests { public class PackIntegrationTest : MSBuildIntegrationTestBase, IClassFixture { - private static readonly string TFM = "netcoreapp3.1"; + private static readonly string TFM = "netcoreapp5.0"; public PackIntegrationTest(BuildServerTestFixture buildServer) : base(buildServer) diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PublishIntegrationTest.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PublishIntegrationTest.cs index 037600112b..f17512a89d 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PublishIntegrationTest.cs +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PublishIntegrationTest.cs @@ -329,7 +329,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests Assert.FileCountEquals(result, 0, Path.Combine(PublishOutputPath, "Views"), "*.cshtml"); } - [Fact] + [Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/13303")] [InitializeTestProject("SimpleMvcFSharp", language: "F#")] public async Task Publish_SimpleMvcFSharp_NoopsWithoutFailing() { @@ -434,7 +434,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests var result = await DotnetMSBuild("Publish", "/p:NoBuild=true"); Assert.BuildFailed(result); - Assert.BuildError(result, "MSB3030"); // Could not copy the file "obj/Debug/netcoreapp3.1/SimpleMvc.dll because it couldn't be found. + Assert.BuildError(result, "MSB3030"); // Could not copy the file "obj/Debug/netcoreapp5.0/SimpleMvc.dll because it couldn't be found. Assert.FileDoesNotExist(result, PublishOutputPath, "SimpleMvc.dll"); Assert.FileDoesNotExist(result, PublishOutputPath, "SimpleMvc.Views.dll"); diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/StaticWebAssetsIntegrationTest.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/StaticWebAssetsIntegrationTest.cs index 905d31f970..b87b87a662 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/StaticWebAssetsIntegrationTest.cs +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/StaticWebAssetsIntegrationTest.cs @@ -33,7 +33,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests public ITestOutputHelper Output { get; private set; } - [Fact(Skip = "https://github.com/aspnet/AspNetCore/issues/17233")] + [Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/17233")] [InitializeTestProject("AppWithPackageAndP2PReference",language: "C#", additionalProjects: new[] { "ClassLibrary", "ClassLibrary2" })] public async Task Build_GeneratesStaticWebAssetsManifest_Success_CreatesManifest() { @@ -84,7 +84,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests Assert.FileDoesNotExist(result, PublishOutputPath, "AppWithPackageAndP2PReference.StaticWebAssets.xml"); } - [ConditionalFact] + [ConditionalFact(Skip = "Flaky test: https://github.com/dotnet/aspnetcore/issues/18543")] [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] [InitializeTestProject("AppWithPackageAndP2PReferenceAndRID", additionalProjects: new[] { "ClassLibrary", "ClassLibrary2" })] public async Task Publish_CopiesStaticWebAssetsToDestinationFolder_PublishSingleFile() @@ -109,7 +109,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests Assert.FileDoesNotExist(result, publishOutputPath, "AppWithPackageAndP2PReference.StaticWebAssets.xml"); } - [Fact] + [Fact(Skip = "flaky test: https://github.com/dotnet/aspnetcore/issues/18707")] [InitializeTestProject("AppWithPackageAndP2PReference", additionalProjects: new[] { "ClassLibrary", "ClassLibrary2" })] public async Task Publish_WithBuildReferencesDisabled_CopiesStaticWebAssetsToDestinationFolder() { @@ -130,7 +130,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests Assert.FileExists(publish, PublishOutputPath, Path.Combine("wwwroot", "_content", "PackageLibraryTransitiveDependency", "js", "pkg-transitive-dep.js")); } - [Fact] + [Fact(Skip = "Flaky test: https://github.com/dotnet/aspnetcore/issues/18561")] [InitializeTestProject("AppWithPackageAndP2PReference", additionalProjects: new[] { "ClassLibrary", "ClassLibrary2" })] public async Task Publish_NoBuild_CopiesStaticWebAssetsToDestinationFolder() { @@ -188,7 +188,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests Assert.FileDoesNotExist(result, IntermediateOutputPath, "staticwebassets", "AppWithPackageAndP2PReference.StaticWebAssets.xml"); } - [Fact(Skip = "https://github.com/aspnet/AspNetCore/issues/17233")] + [Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/17233")] [InitializeTestProject("AppWithPackageAndP2PReference",language: "C#", additionalProjects: new[] { "ClassLibrary", "ClassLibrary2" })] public async Task Rebuild_Success_RecreatesManifestAndCache() { diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/Microsoft.NET.Sdk.Razor.Test.csproj b/src/Razor/Microsoft.NET.Sdk.Razor/test/Microsoft.NET.Sdk.Razor.Test.csproj index 1f3678c219..0bba7a6407 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/Microsoft.NET.Sdk.Razor.Test.csproj +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/Microsoft.NET.Sdk.Razor.Test.csproj @@ -7,7 +7,7 @@ This is also a partial workaround for https://github.com/Microsoft/msbuild/issues/2661 - this project has netcoreapp dependencies that need to be built first. --> - $(DefaultNetCoreTargetFramework) + netcoreapp5.0 true $(DefineConstants);PRESERVE_WORKING_DIRECTORY @@ -101,7 +101,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests static partial void InitializeVariables() { _msBuildPath = @"$(_DesktopMSBuildPath)"; - _microsoftNETCoreApp31PackageVersion = "$(MicrosoftNETCoreApp31PackageVersion)"; + _MicrosoftNETCoreApp50PackageVersion = "$(MicrosoftNETCoreApp50PackageVersion)"; _microsoftNetCompilersToolsetPackageVersion = "$(MicrosoftNetCompilersToolsetPackageVersion)"; } } diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/ReferenceResolverTest.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/ReferenceResolverTest.cs index 05dd86b430..5fcc9d1220 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/ReferenceResolverTest.cs +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/ReferenceResolverTest.cs @@ -142,7 +142,7 @@ namespace Microsoft.AspNetCore.Razor.Tasks [Fact] public void Resolve_Works_WhenAssemblyReferencesAreRecursive() { - // Test for https://github.com/aspnet/AspNetCore/issues/12693 + // Test for https://github.com/dotnet/aspnetcore/issues/12693 // Arrange var resolver = new TestReferencesToMvcResolver(new[] { diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs index 84ed8ac87f..1f50719819 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs @@ -361,6 +361,36 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests IntermediateNodeVerifier.Verify(document, baseline); } + internal void AssertHtmlDocumentMatchesBaseline(RazorHtmlDocument htmlDocument) + { + if (FileName == null) + { + var message = $"{nameof(AssertHtmlDocumentMatchesBaseline)} should only be called from an integration test ({nameof(FileName)} is null)."; + throw new InvalidOperationException(message); + } + + var baselineFileName = Path.ChangeExtension(FileName, ".codegen.html"); + + if (GenerateBaselines) + { + var baselineFullPath = Path.Combine(TestProjectRoot, baselineFileName); + File.WriteAllText(baselineFullPath, htmlDocument.GeneratedHtml); + return; + } + + var htmlFile = TestFile.Create(baselineFileName, GetType().GetTypeInfo().Assembly); + if (!htmlFile.Exists()) + { + throw new XunitException($"The resource {baselineFileName} was not found."); + } + + var baseline = htmlFile.ReadAllText(); + + // Normalize newlines to match those in the baseline. + var actual = htmlDocument.GeneratedHtml.Replace("\r", "").Replace("\n", "\r\n"); + Assert.Equal(baseline, actual); + } + protected void AssertCSharpDocumentMatchesBaseline(RazorCSharpDocument cSharpDocument) { if (FileName == null) diff --git a/src/Razor/test/testassets/AppWithPackageAndP2PReferenceAndRID/AppWithPackageAndP2PReferenceAndRID.csproj b/src/Razor/test/testassets/AppWithPackageAndP2PReferenceAndRID/AppWithPackageAndP2PReferenceAndRID.csproj index d657733943..c6d44d95f5 100644 --- a/src/Razor/test/testassets/AppWithPackageAndP2PReferenceAndRID/AppWithPackageAndP2PReferenceAndRID.csproj +++ b/src/Razor/test/testassets/AppWithPackageAndP2PReferenceAndRID/AppWithPackageAndP2PReferenceAndRID.csproj @@ -14,6 +14,12 @@ + + + + + + diff --git a/src/Razor/test/testassets/Directory.Build.targets b/src/Razor/test/testassets/Directory.Build.targets index c2b36add81..1c03be36fc 100644 --- a/src/Razor/test/testassets/Directory.Build.targets +++ b/src/Razor/test/testassets/Directory.Build.targets @@ -2,11 +2,7 @@ - - $(MicrosoftNETCoreAppRefPackageVersion) + $(MicrosoftNETCoreApp50PackageVersion) 99.9 diff --git a/src/Razor/test/testassets/MvcWithComponents/Test.cs b/src/Razor/test/testassets/MvcWithComponents/Test.cs new file mode 100644 index 0000000000..eaa1ddd367 --- /dev/null +++ b/src/Razor/test/testassets/MvcWithComponents/Test.cs @@ -0,0 +1,9 @@ +namespace MvcWithComponents +{ + public class Test + { + public static string Foo { get; set; } + + public static string Bar { get; set; } + } +} \ No newline at end of file diff --git a/src/Razor/test/testassets/MvcWithComponents/Views/Home/#FileName.cshtml b/src/Razor/test/testassets/MvcWithComponents/Views/Home/#FileName.cshtml new file mode 100644 index 0000000000..c227f7c471 --- /dev/null +++ b/src/Razor/test/testassets/MvcWithComponents/Views/Home/#FileName.cshtml @@ -0,0 +1 @@ +@page "/filename" diff --git a/src/Razor/test/testassets/MvcWithComponents/Views/Shared/NavMenu.razor b/src/Razor/test/testassets/MvcWithComponents/Views/Shared/NavMenu.razor index d6eede9b18..e036fead2b 100644 --- a/src/Razor/test/testassets/MvcWithComponents/Views/Shared/NavMenu.razor +++ b/src/Razor/test/testassets/MvcWithComponents/Views/Shared/NavMenu.razor @@ -1,2 +1,4 @@ +@Test.Foo @* Used in a test. Don't remove *@ + NavMenu content diff --git a/src/Razor/test/testassets/SimpleMvc22/TagHelpers/EnvironementTagHelper.cs b/src/Razor/test/testassets/SimpleMvc22/TagHelpers/EnvironementTagHelper.cs new file mode 100644 index 0000000000..cca753a803 --- /dev/null +++ b/src/Razor/test/testassets/SimpleMvc22/TagHelpers/EnvironementTagHelper.cs @@ -0,0 +1,17 @@ +using Microsoft.AspNetCore.Razor.TagHelpers; + +// Used for testing purposes to verify multiple TagHelpers applying to a single element. +namespace SimpleMvc22.TagHelpers +{ + /// + /// I made it! + /// + [HtmlTargetElement("environment")] + public class EnvironmentTagHelper : TagHelper + { + /// + /// Exclude it! + /// + public string Exclude {get; set;} + } +} \ No newline at end of file