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/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.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/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/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.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/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