Merge branch 'master' into merge/release/3.1-to-master\n\nCommit migrated from 3252bbb2dc

This commit is contained in:
Doug Bunting 2020-02-20 14:24:03 -08:00 committed by GitHub
commit 5565519125
38 changed files with 133 additions and 95 deletions

View File

@ -110,11 +110,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
if (string.Equals(selectedMethod.Name, ViewComponentTypes.AsyncMethodName, StringComparison.Ordinal)) if (string.Equals(selectedMethod.Name, ViewComponentTypes.AsyncMethodName, StringComparison.Ordinal))
{ {
// Will invoke asynchronously. Method must not return Task or Task<T>. // Will invoke asynchronously. Method must not return Task or Task<T>.
if (Equals(returnType, _taskSymbol)) if (SymbolEqualityComparer.Default.Equals(returnType, _taskSymbol))
{ {
// This is ok. // This is ok.
} }
else if (returnType.IsGenericType && Equals(returnType.ConstructedFrom, _genericTaskSymbol)) else if (returnType.IsGenericType && SymbolEqualityComparer.Default.Equals(returnType.ConstructedFrom, _genericTaskSymbol))
{ {
// This is ok. // This is ok.
} }
@ -134,13 +134,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
method = null; method = null;
return false; return false;
} }
else if (Equals(returnType, _taskSymbol)) else if (SymbolEqualityComparer.Default.Equals(returnType, _taskSymbol))
{ {
diagnostic = RazorExtensionsDiagnosticFactory.CreateViewComponent_SyncMethod_CannotReturnTask(type.ToDisplayString(FullNameTypeDisplayFormat)); diagnostic = RazorExtensionsDiagnosticFactory.CreateViewComponent_SyncMethod_CannotReturnTask(type.ToDisplayString(FullNameTypeDisplayFormat));
method = null; method = null;
return false; 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)); diagnostic = RazorExtensionsDiagnosticFactory.CreateViewComponent_SyncMethod_CannotReturnTask(type.ToDisplayString(FullNameTypeDisplayFormat));
method = null; method = null;
@ -208,13 +208,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
private string GetIndexerValueTypeName(IParameterSymbol parameter) private string GetIndexerValueTypeName(IParameterSymbol parameter)
{ {
INamedTypeSymbol dictionaryType; INamedTypeSymbol dictionaryType;
if (Equals((parameter.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol)) if (SymbolEqualityComparer.Default.Equals((parameter.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol))
{ {
dictionaryType = (INamedTypeSymbol)parameter.Type; 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 else
{ {
@ -234,7 +234,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
private string GetShortName(INamedTypeSymbol componentType) 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 var name = viewComponentAttribute
?.NamedArguments ?.NamedArguments
.Where(namedArgument => string.Equals(namedArgument.Key, ViewComponentTypes.ViewComponent.Name, StringComparison.Ordinal)) .Where(namedArgument => string.Equals(namedArgument.Key, ViewComponentTypes.ViewComponent.Name, StringComparison.Ordinal))

View File

@ -73,7 +73,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
return false; 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) if (attribute != null)
{ {

View File

@ -40,7 +40,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
"; ";
var output = context.CodeWriter.GenerateCode(); var output = context.CodeWriter.GenerateCode();
Assert.Equal(expected, output); Assert.Equal(expected, output, ignoreLineEndingDifferences: true);
} }
} }
} }

View File

@ -104,11 +104,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X
if (string.Equals(selectedMethod.Name, ViewComponentTypes.AsyncMethodName, StringComparison.Ordinal)) if (string.Equals(selectedMethod.Name, ViewComponentTypes.AsyncMethodName, StringComparison.Ordinal))
{ {
// Will invoke asynchronously. Method must not return Task or Task<T>. // Will invoke asynchronously. Method must not return Task or Task<T>.
if (Equals(returnType, _taskSymbol)) if (SymbolEqualityComparer.Default.Equals(returnType, _taskSymbol))
{ {
// This is ok. // This is ok.
} }
else if (returnType.IsGenericType && Equals(returnType.ConstructedFrom, _genericTaskSymbol)) else if (returnType.IsGenericType && SymbolEqualityComparer.Default.Equals(returnType.ConstructedFrom, _genericTaskSymbol))
{ {
// This is ok. // This is ok.
} }
@ -128,13 +128,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X
method = null; method = null;
return false; return false;
} }
else if (Equals(returnType, _taskSymbol)) else if (SymbolEqualityComparer.Default.Equals(returnType, _taskSymbol))
{ {
diagnostic = RazorExtensionsDiagnosticFactory.CreateViewComponent_SyncMethod_CannotReturnTask(type.ToDisplayString(FullNameTypeDisplayFormat)); diagnostic = RazorExtensionsDiagnosticFactory.CreateViewComponent_SyncMethod_CannotReturnTask(type.ToDisplayString(FullNameTypeDisplayFormat));
method = null; method = null;
return false; 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)); diagnostic = RazorExtensionsDiagnosticFactory.CreateViewComponent_SyncMethod_CannotReturnTask(type.ToDisplayString(FullNameTypeDisplayFormat));
method = null; method = null;
@ -223,13 +223,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X
private string GetIndexerValueTypeName(IParameterSymbol parameter) private string GetIndexerValueTypeName(IParameterSymbol parameter)
{ {
INamedTypeSymbol dictionaryType; INamedTypeSymbol dictionaryType;
if (Equals((parameter.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol)) if (SymbolEqualityComparer.Default.Equals((parameter.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol))
{ {
dictionaryType = (INamedTypeSymbol)parameter.Type; 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 else
{ {
@ -249,7 +249,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X
private string GetShortName(INamedTypeSymbol componentType) 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 var name = viewComponentAttribute
?.NamedArguments ?.NamedArguments
.Where(namedArgument => string.Equals(namedArgument.Key, ViewComponentTypes.ViewComponent.Name, StringComparison.Ordinal)) .Where(namedArgument => string.Equals(namedArgument.Key, ViewComponentTypes.ViewComponent.Name, StringComparison.Ordinal))

View File

@ -75,7 +75,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X
return false; 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) if (attribute != null)
{ {

View File

@ -82,7 +82,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X
// Arrange // Arrange
var content = @" var content = @"
@* some comment *@ @* some comment *@
@page @page
"; ";
var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create(content, "Test.cshtml")); var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create(content, "Test.cshtml"));
@ -363,7 +363,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X
{ {
PageDirective.Register(builder); PageDirective.Register(builder);
} }
private static DocumentIntermediateNode CreateIRDocument(RazorEngine engine, RazorCodeDocument codeDocument) private static DocumentIntermediateNode CreateIRDocument(RazorEngine engine, RazorCodeDocument codeDocument)
{ {
for (var i = 0; i < engine.Phases.Count; i++) for (var i = 0; i < engine.Phases.Count; i++)

View File

@ -104,11 +104,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
if (string.Equals(selectedMethod.Name, ViewComponentTypes.AsyncMethodName, StringComparison.Ordinal)) if (string.Equals(selectedMethod.Name, ViewComponentTypes.AsyncMethodName, StringComparison.Ordinal))
{ {
// Will invoke asynchronously. Method must not return Task or Task<T>. // Will invoke asynchronously. Method must not return Task or Task<T>.
if (Equals(returnType, _taskSymbol)) if (SymbolEqualityComparer.Default.Equals(returnType, _taskSymbol))
{ {
// This is ok. // This is ok.
} }
else if (returnType.IsGenericType && Equals(returnType.ConstructedFrom, _genericTaskSymbol)) else if (returnType.IsGenericType && SymbolEqualityComparer.Default.Equals(returnType.ConstructedFrom, _genericTaskSymbol))
{ {
// This is ok. // This is ok.
} }
@ -128,13 +128,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
method = null; method = null;
return false; return false;
} }
else if (Equals(returnType, _taskSymbol)) else if (SymbolEqualityComparer.Default.Equals(returnType, _taskSymbol))
{ {
diagnostic = RazorExtensionsDiagnosticFactory.CreateViewComponent_SyncMethod_CannotReturnTask(type.ToDisplayString(FullNameTypeDisplayFormat)); diagnostic = RazorExtensionsDiagnosticFactory.CreateViewComponent_SyncMethod_CannotReturnTask(type.ToDisplayString(FullNameTypeDisplayFormat));
method = null; method = null;
return false; 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)); diagnostic = RazorExtensionsDiagnosticFactory.CreateViewComponent_SyncMethod_CannotReturnTask(type.ToDisplayString(FullNameTypeDisplayFormat));
method = null; method = null;
@ -223,13 +223,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
private string GetIndexerValueTypeName(IParameterSymbol parameter) private string GetIndexerValueTypeName(IParameterSymbol parameter)
{ {
INamedTypeSymbol dictionaryType; INamedTypeSymbol dictionaryType;
if (Equals((parameter.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol)) if (SymbolEqualityComparer.Default.Equals((parameter.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol))
{ {
dictionaryType = (INamedTypeSymbol)parameter.Type; 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 else
{ {
@ -249,7 +249,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
private string GetShortName(INamedTypeSymbol componentType) 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 var name = viewComponentAttribute
?.NamedArguments ?.NamedArguments
.Where(namedArgument => string.Equals(namedArgument.Key, ViewComponentTypes.ViewComponent.Name, StringComparison.Ordinal)) .Where(namedArgument => string.Equals(namedArgument.Key, ViewComponentTypes.ViewComponent.Name, StringComparison.Ordinal))

View File

@ -75,7 +75,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
return false; 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) if (attribute != null)
{ {

View File

@ -82,7 +82,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
// Arrange // Arrange
var content = @" var content = @"
@* some comment *@ @* some comment *@
@page @page
"; ";
var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create(content, "Test.cshtml")); var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create(content, "Test.cshtml"));

View File

@ -18,6 +18,11 @@ namespace Microsoft.AspNetCore.Razor.Language
public ClassifiedSpanVisitor(RazorSourceDocument source) public ClassifiedSpanVisitor(RazorSourceDocument source)
{ {
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
_source = source; _source = source;
_spans = new List<ClassifiedSpanInternal>(); _spans = new List<ClassifiedSpanInternal>();
_currentBlockKind = BlockKindInternal.Markup; _currentBlockKind = BlockKindInternal.Markup;

View File

@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
Pass.Engine = Engine; Pass.Engine = Engine;
} }
private DefaultRazorProjectEngine ProjectEngine { get; } private DefaultRazorProjectEngine ProjectEngine { get; }
private RazorEngine Engine { get; } private RazorEngine Engine { get; }
@ -81,7 +81,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
Assert.Equal(expected, block.Content, ignoreLineEndingDifferences: true); Assert.Equal(expected, block.Content, ignoreLineEndingDifferences: true);
} }
// See: https://github.com/aspnet/AspNetCore/issues/6480 // See: https://github.com/dotnet/aspnetcore/issues/6480
[Fact] [Fact]
public void Execute_RewritesHtml_HtmlAttributePrefix() public void Execute_RewritesHtml_HtmlAttributePrefix()
{ {

View File

@ -5120,7 +5120,7 @@ namespace Test
CompileToAssembly(generated); CompileToAssembly(generated);
} }
[Fact] // https://github.com/aspnet/Blazor/issues/597 [Fact] // https://github.com/dotnet/blazor/issues/597
public void Regression_597() public void Regression_597()
{ {
// Arrange // Arrange
@ -5186,7 +5186,7 @@ namespace Test
CompileToAssembly(generated); CompileToAssembly(generated);
} }
[Fact] // https://github.com/aspnet/Blazor/issues/772 [Fact] // https://github.com/dotnet/blazor/issues/772
public void Regression_772() public void Regression_772()
{ {
// Arrange // Arrange
@ -5224,7 +5224,7 @@ Welcome to your new app.
d => Assert.Equal("RZ1035", d.Id)); 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() public void Regression_773()
{ {
// Arrange // Arrange

View File

@ -95,7 +95,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
Assert.Contains(typeof(IDoCoolThings), component.GetType().GetInterfaces()); 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() public void DeclarationConfiguration_FunctionsBlockHasLineMappings_MappingsApplyToError()
{ {
// Arrange & Act 1 // Arrange & Act 1

View File

@ -23,7 +23,6 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="$(MicrosoftAspNetCoreTestingPackageVersion)" /> <PackageReference Include="Microsoft.AspNetCore.Testing" Version="$(MicrosoftAspNetCoreTestingPackageVersion)" />
<PackageReference Include="Moq" Version="$(MoqPackageVersion)" /> <PackageReference Include="Moq" Version="$(MoqPackageVersion)" />
<PackageReference Include="Newtonsoft.Json" Version="$(TEST_NewtonsoftJsonPackageVersion)" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -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. 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. 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. 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
--> -->
<TargetFramework>netcoreapp3.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>

View File

@ -121,7 +121,7 @@ Delta: Gamma: Beta: Test B
var actual = builder.ToString(); var actual = builder.ToString();
Assert.Equal(expected, actual); Assert.Equal(expected, actual, ignoreLineEndingDifferences: true);
} }
} }
} }

View File

@ -235,7 +235,7 @@ namespace Microsoft.CodeAnalysis.Razor
// We need to check the constructor argument length here, because this can show up as 0 // 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 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( results.Add(new ElementBindData(
type.ContainingAssembly.Name, type.ContainingAssembly.Name,
@ -246,7 +246,7 @@ namespace Microsoft.CodeAnalysis.Razor
(string)attribute.ConstructorArguments[2].Value, (string)attribute.ConstructorArguments[2].Value,
(string)attribute.ConstructorArguments[3].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( results.Add(new ElementBindData(
type.ContainingAssembly.Name, type.ContainingAssembly.Name,
@ -257,7 +257,7 @@ namespace Microsoft.CodeAnalysis.Razor
(string)attribute.ConstructorArguments[2].Value, (string)attribute.ConstructorArguments[2].Value,
(string)attribute.ConstructorArguments[3].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( results.Add(new ElementBindData(
type.ContainingAssembly.Name, type.ContainingAssembly.Name,

View File

@ -301,6 +301,7 @@ namespace Microsoft.CodeAnalysis.Razor
b.Name = ComponentMetadata.ChildContent.ParameterAttributeName; b.Name = ComponentMetadata.ChildContent.ParameterAttributeName;
b.TypeName = typeof(string).FullName; b.TypeName = typeof(string).FullName;
b.Metadata.Add(ComponentMetadata.Component.ChildContentParameterNameKey, bool.TrueString); b.Metadata.Add(ComponentMetadata.Component.ChildContentParameterNameKey, bool.TrueString);
b.Metadata.Add(TagHelperMetadata.Common.PropertyName, b.Name);
if (childContentName == null) if (childContentName == null)
{ {
@ -327,7 +328,7 @@ namespace Microsoft.CodeAnalysis.Razor
var properties = new Dictionary<string, (IPropertySymbol, PropertyKind)>(StringComparer.Ordinal); var properties = new Dictionary<string, (IPropertySymbol, PropertyKind)>(StringComparer.Ordinal);
do do
{ {
if (Equals(type, symbols.ComponentBase)) if (SymbolEqualityComparer.Default.Equals(type, symbols.ComponentBase))
{ {
// The ComponentBase base class doesn't have any [Parameter]. // The ComponentBase base class doesn't have any [Parameter].
// Bail out now to avoid walking through its many members, plus the members // Bail out now to avoid walking through its many members, plus the members
@ -380,7 +381,7 @@ namespace Microsoft.CodeAnalysis.Razor
kind = PropertyKind.Ignored; 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) if (property.IsOverride)
{ {
@ -398,7 +399,7 @@ namespace Microsoft.CodeAnalysis.Razor
kind = PropertyKind.Enum; 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; kind = PropertyKind.ChildContent;
} }
@ -406,12 +407,12 @@ namespace Microsoft.CodeAnalysis.Razor
if (kind == PropertyKind.Default && if (kind == PropertyKind.Default &&
property.Type is INamedTypeSymbol namedType && property.Type is INamedTypeSymbol namedType &&
namedType.IsGenericType && namedType.IsGenericType &&
Equals(namedType.ConstructedFrom, symbols.RenderFragmentOfT)) SymbolEqualityComparer.Default.Equals(namedType.ConstructedFrom, symbols.RenderFragmentOfT))
{ {
kind = PropertyKind.ChildContent; 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; kind = PropertyKind.EventCallback;
} }
@ -419,7 +420,7 @@ namespace Microsoft.CodeAnalysis.Razor
if (kind == PropertyKind.Default && if (kind == PropertyKind.Default &&
property.Type is INamedTypeSymbol namedType2 && property.Type is INamedTypeSymbol namedType2 &&
namedType2.IsGenericType && namedType2.IsGenericType &&
Equals(namedType2.ConstructedFrom, symbols.EventCallbackOfT)) SymbolEqualityComparer.Default.Equals(namedType2.ConstructedFrom, symbols.EventCallbackOfT))
{ {
kind = PropertyKind.EventCallback; kind = PropertyKind.EventCallback;
} }

View File

@ -80,7 +80,7 @@ namespace Microsoft.CodeAnalysis.Razor
{ {
var targetElementAttributes = type var targetElementAttributes = type
.GetAttributes() .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 there isn't an attribute specifying the tag name derive it from the name
if (!targetElementAttributes.Any()) if (!targetElementAttributes.Any())
@ -139,7 +139,7 @@ namespace Microsoft.CodeAnalysis.Razor
private void AddAllowedChildren(INamedTypeSymbol type, TagHelperDescriptorBuilder builder) 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) if (restrictChildrenAttribute == null)
{ {
return; return;
@ -174,7 +174,7 @@ namespace Microsoft.CodeAnalysis.Razor
private void AddTagOutputHint(INamedTypeSymbol type, TagHelperDescriptorBuilder builder) private void AddTagOutputHint(INamedTypeSymbol type, TagHelperDescriptorBuilder builder)
{ {
string outputElementHint = null; 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) if (outputElementHintAttribute != null)
{ {
outputElementHint = (string)(outputElementHintAttribute.ConstructorArguments[0]).Value; outputElementHint = (string)(outputElementHintAttribute.ConstructorArguments[0]).Value;
@ -189,7 +189,7 @@ namespace Microsoft.CodeAnalysis.Razor
{ {
var attributeNameAttribute = property var attributeNameAttribute = property
.GetAttributes() .GetAttributes()
.Where(a => Equals(a.AttributeClass, _htmlAttributeNameAttributeSymbol)) .Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _htmlAttributeNameAttributeSymbol))
.FirstOrDefault(); .FirstOrDefault();
bool hasExplicitName; bool hasExplicitName;
@ -310,13 +310,13 @@ namespace Microsoft.CodeAnalysis.Razor
private IReadOnlyList<ITypeSymbol> GetDictionaryArgumentTypes(IPropertySymbol property) private IReadOnlyList<ITypeSymbol> GetDictionaryArgumentTypes(IPropertySymbol property)
{ {
INamedTypeSymbol dictionaryType; INamedTypeSymbol dictionaryType;
if (Equals((property.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol)) if (SymbolEqualityComparer.Default.Equals((property.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol))
{ {
dictionaryType = (INamedTypeSymbol)property.Type; 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 else
{ {
@ -380,7 +380,7 @@ namespace Microsoft.CodeAnalysis.Razor
private bool IsPotentialDictionaryProperty(IPropertySymbol property) private bool IsPotentialDictionaryProperty(IPropertySymbol property)
{ {
return 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; GetDictionaryArgumentTypes(property)?[0].SpecialType == SpecialType.System_String;
} }
@ -397,8 +397,8 @@ namespace Microsoft.CodeAnalysis.Razor
property.Parameters.Length == 0 && property.Parameters.Length == 0 &&
property.GetMethod != null && property.GetMethod != null &&
property.GetMethod.DeclaredAccessibility == Accessibility.Public && property.GetMethod.DeclaredAccessibility == Accessibility.Public &&
property.GetAttributes().Where(a => Equals(a.AttributeClass, _htmlAttributeNotBoundAttributeSymbol)).FirstOrDefault() == null && property.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _htmlAttributeNotBoundAttributeSymbol)).FirstOrDefault() == null &&
(property.GetAttributes().Any(a => Equals(a.AttributeClass, _htmlAttributeNameAttributeSymbol)) || (property.GetAttributes().Any(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _htmlAttributeNameAttributeSymbol)) ||
property.SetMethod != null && property.SetMethod.DeclaredAccessibility == Accessibility.Public || property.SetMethod != null && property.SetMethod.DeclaredAccessibility == Accessibility.Public ||
IsPotentialDictionaryProperty(property)) && IsPotentialDictionaryProperty(property)) &&
!accessibleProperties.ContainsKey(property.Name)) !accessibleProperties.ContainsKey(property.Name))
@ -418,7 +418,7 @@ namespace Microsoft.CodeAnalysis.Razor
{ {
if (ExcludeHidden) 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) if (editorBrowsableAttribute == null)
{ {

View File

@ -81,7 +81,7 @@ namespace Microsoft.CodeAnalysis.Razor
{ {
var attribute = attributes[j]; var attribute = attributes[j];
if (Equals(attribute.AttributeClass, eventHandlerAttribute)) if (SymbolEqualityComparer.Default.Equals(attribute.AttributeClass, eventHandlerAttribute))
{ {
var enablePreventDefault = false; var enablePreventDefault = false;
var enableStopPropagation = false; var enableStopPropagation = false;

View File

@ -30,7 +30,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<!-- Paths to tools, tasks, and extensions are calculated relative to the RazorSdkDirectoryRoot. This can be modified to test a local build. --> <!-- Paths to tools, tasks, and extensions are calculated relative to the RazorSdkDirectoryRoot. This can be modified to test a local build. -->
<RazorSdkDirectoryRoot Condition="'$(RazorSdkDirectoryRoot)'==''">$(MSBuildThisFileDirectory)..\..\</RazorSdkDirectoryRoot> <RazorSdkDirectoryRoot Condition="'$(RazorSdkDirectoryRoot)'==''">$(MSBuildThisFileDirectory)..\..\</RazorSdkDirectoryRoot>
<RazorSdkBuildTasksDirectoryRoot Condition="'$(RazorSdkBuildTasksDirectoryRoot)'==''">$(RazorSdkDirectoryRoot)tasks\</RazorSdkBuildTasksDirectoryRoot> <RazorSdkBuildTasksDirectoryRoot Condition="'$(RazorSdkBuildTasksDirectoryRoot)'==''">$(RazorSdkDirectoryRoot)tasks\</RazorSdkBuildTasksDirectoryRoot>
<_RazorSdkTasksTFM Condition=" '$(MSBuildRuntimeType)' == 'Core'">netcoreapp3.1</_RazorSdkTasksTFM> <_RazorSdkTasksTFM Condition=" '$(MSBuildRuntimeType)' == 'Core'">netcoreapp5.0</_RazorSdkTasksTFM>
<_RazorSdkTasksTFM Condition=" '$(_RazorSdkTasksTFM)' == ''">net46</_RazorSdkTasksTFM> <_RazorSdkTasksTFM Condition=" '$(_RazorSdkTasksTFM)' == ''">net46</_RazorSdkTasksTFM>
<RazorSdkBuildTasksAssembly>$(RazorSdkBuildTasksDirectoryRoot)$(_RazorSdkTasksTFM)\Microsoft.NET.Sdk.Razor.Tasks.dll</RazorSdkBuildTasksAssembly> <RazorSdkBuildTasksAssembly>$(RazorSdkBuildTasksDirectoryRoot)$(_RazorSdkTasksTFM)\Microsoft.NET.Sdk.Razor.Tasks.dll</RazorSdkBuildTasksAssembly>
</PropertyGroup> </PropertyGroup>
@ -516,7 +516,7 @@ Copyright (c) .NET Foundation. All rights reserved.
</Target> </Target>
<!-- <!--
Temporarary workaround for https://github.com/aspnet/AspNetCore/issues/6859. This can be removed after a VS insertion with a newer copy of the DesignTime targets. Temporarary workaround for https://github.com/dotnet/aspnetcore/issues/6859. This can be removed after a VS insertion with a newer copy of the DesignTime targets.
--> -->
<ItemGroup> <ItemGroup>
<Content Update="$(_RazorComponentInclude)"> <Content Update="$(_RazorComponentInclude)">

View File

@ -6,7 +6,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
internal static partial class BuildVariables internal static partial class BuildVariables
{ {
private static string _msBuildPath = string.Empty; private static string _msBuildPath = string.Empty;
private static string _microsoftNETCoreApp31PackageVersion = string.Empty; private static string _MicrosoftNETCoreApp50PackageVersion = string.Empty;
private static string _microsoftNetCompilersToolsetPackageVersion = string.Empty; private static string _microsoftNetCompilersToolsetPackageVersion = string.Empty;
static partial void InitializeVariables(); static partial void InitializeVariables();
@ -20,12 +20,12 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
} }
} }
public static string MicrosoftNETCoreApp31PackageVersion public static string MicrosoftNETCoreApp50PackageVersion
{ {
get get
{ {
InitializeVariables(); InitializeVariables();
return _microsoftNETCoreApp31PackageVersion; return _MicrosoftNETCoreApp50PackageVersion;
} }
} }

View File

@ -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] [Fact]
[InitializeTestProject("AppWithP2PReference", additionalProjects: "ClassLibrary")] [InitializeTestProject("AppWithP2PReference", additionalProjects: "ClassLibrary")]
public async Task BuildIncrementalism_CausingRecompilation_WhenApplicationPartAttributeIsGenerated() 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"); 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")] [InitializeTestProject("SimpleMvcFSharp", language: "F#", additionalProjects: "ClassLibrary")]
public async Task Build_ProjectWithDependencyThatReferencesMvc_AddsAttributeToNonCSharpProjects() public async Task Build_ProjectWithDependencyThatReferencesMvc_AddsAttributeToNonCSharpProjects()
{ {

View File

@ -472,7 +472,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
Assert.FileDoesNotContain(result, razorAssemblyInfo, "Microsoft.AspNetCore.Razor.Hosting.RazorConfigurationNameAttribute"); Assert.FileDoesNotContain(result, razorAssemblyInfo, "Microsoft.AspNetCore.Razor.Hosting.RazorConfigurationNameAttribute");
} }
[Fact] [Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/13303")]
[InitializeTestProject("SimpleMvcFSharp", language: "F#")] [InitializeTestProject("SimpleMvcFSharp", language: "F#")]
public async Task Build_SimpleMvcFSharp_NoopsWithoutFailing() public async Task Build_SimpleMvcFSharp_NoopsWithoutFailing()
{ {
@ -639,13 +639,15 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
Assert.FileDoesNotExist(result, IntermediateOutputPath, "SimpleMvc.Views.dll"); 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")] [InitializeTestProject("SimpleMvc")]
public async Task Build_ImplicitCSharp8_NullableEnforcement_WarningsDuringBuild_NoBuildServer() public async Task Build_ImplicitCSharp8_NullableEnforcement_WarningsDuringBuild_NoBuildServer()
{ {
var result = await DotnetMSBuild( var result = await DotnetMSBuild(
"Build", "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); suppressBuildServer: true);
var indexFilePath = Path.Combine(RazorIntermediateOutputPath, "Views", "Home", "Index.cshtml.g.cs"); var indexFilePath = Path.Combine(RazorIntermediateOutputPath, "Views", "Home", "Index.cshtml.g.cs");

View File

@ -215,7 +215,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
[InitializeTestProject("SimpleMvc")] [InitializeTestProject("SimpleMvc")]
public async Task IntrospectJsonContentFiles_WithExcludeConfigFilesFromBuildOutputSet() 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"); var result = await DotnetMSBuild("_IntrospectContentItems", "/p:ExcludeConfigFilesFromBuildOutput=true");
Assert.BuildPassed(result); Assert.BuildPassed(result);
@ -229,21 +229,21 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
[InitializeTestProject("SimpleMvc")] [InitializeTestProject("SimpleMvc")]
public async Task IntrospectRazorTasksDllPath() 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<AssemblyMetadataAttribute>() var solutionRoot = GetType().Assembly.GetCustomAttributes<AssemblyMetadataAttribute>()
.First(a => a.Key == "Testing.RepoRoot") .First(a => a.Key == "Testing.RepoRoot")
.Value; .Value;
var tfm = var tfm =
#if NETCOREAPP3_1 #if NETCOREAPP5_0
"netcoreapp3.1"; "netcoreapp5.0";
#else #else
#error Target framework needs to be updated. #error Target framework needs to be updated.
#endif #endif
var expected = Path.Combine(solutionRoot, "artifacts", "bin", "Microsoft.NET.Sdk.Razor", Configuration, "sdk-output", "tasks", tfm, "Microsoft.NET.Sdk.Razor.Tasks.dll"); 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"); var result = await DotnetMSBuild("_IntrospectRazorTasks");
Assert.BuildPassed(result); Assert.BuildPassed(result);
@ -262,7 +262,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
var tfm = "net46"; 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"); 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); var result = await DotnetMSBuild("_IntrospectRazorTasks", msBuildProcessKind: MSBuildProcessKind.Desktop);
Assert.BuildPassed(result); Assert.BuildPassed(result);

View File

@ -38,7 +38,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
MSBuildIntegrationTestBase.Project = ProjectDirectory.Create(_originalProjectName, _testProjectName, _baseDirectory, _additionalProjects, _language); MSBuildIntegrationTestBase.Project = ProjectDirectory.Create(_originalProjectName, _testProjectName, _baseDirectory, _additionalProjects, _language);
#if NETCOREAPP #if NETCOREAPP
MSBuildIntegrationTestBase.TargetFramework = "netcoreapp3.1"; MSBuildIntegrationTestBase.TargetFramework = "netcoreapp5.0";
#else #else
#error Target frameworks need to be updated #error Target frameworks need to be updated
#endif #endif

View File

@ -95,7 +95,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
// Let the test app know it is running as part of a test. // Let the test app know it is running as part of a test.
"/p:RunningAsTest=true", "/p:RunningAsTest=true",
$"/p:MicrosoftNETCoreApp31PackageVersion={BuildVariables.MicrosoftNETCoreApp31PackageVersion}", $"/p:MicrosoftNETCoreApp50PackageVersion={BuildVariables.MicrosoftNETCoreApp50PackageVersion}",
$"/p:MicrosoftNetCompilersToolsetPackageVersion={BuildVariables.MicrosoftNetCompilersToolsetPackageVersion}", $"/p:MicrosoftNetCompilersToolsetPackageVersion={BuildVariables.MicrosoftNetCompilersToolsetPackageVersion}",
// Additional restore sources for projects that require built packages // Additional restore sources for projects that require built packages

View File

@ -11,7 +11,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
{ {
public class PackIntegrationTest : MSBuildIntegrationTestBase, IClassFixture<BuildServerTestFixture> public class PackIntegrationTest : MSBuildIntegrationTestBase, IClassFixture<BuildServerTestFixture>
{ {
private static readonly string TFM = "netcoreapp3.1"; private static readonly string TFM = "netcoreapp5.0";
public PackIntegrationTest(BuildServerTestFixture buildServer) public PackIntegrationTest(BuildServerTestFixture buildServer)
: base(buildServer) : base(buildServer)

View File

@ -329,7 +329,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
Assert.FileCountEquals(result, 0, Path.Combine(PublishOutputPath, "Views"), "*.cshtml"); Assert.FileCountEquals(result, 0, Path.Combine(PublishOutputPath, "Views"), "*.cshtml");
} }
[Fact] [Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/13303")]
[InitializeTestProject("SimpleMvcFSharp", language: "F#")] [InitializeTestProject("SimpleMvcFSharp", language: "F#")]
public async Task Publish_SimpleMvcFSharp_NoopsWithoutFailing() public async Task Publish_SimpleMvcFSharp_NoopsWithoutFailing()
{ {
@ -434,7 +434,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
var result = await DotnetMSBuild("Publish", "/p:NoBuild=true"); var result = await DotnetMSBuild("Publish", "/p:NoBuild=true");
Assert.BuildFailed(result); 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.dll");
Assert.FileDoesNotExist(result, PublishOutputPath, "SimpleMvc.Views.dll"); Assert.FileDoesNotExist(result, PublishOutputPath, "SimpleMvc.Views.dll");

View File

@ -33,7 +33,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
public ITestOutputHelper Output { get; private set; } 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" })] [InitializeTestProject("AppWithPackageAndP2PReference",language: "C#", additionalProjects: new[] { "ClassLibrary", "ClassLibrary2" })]
public async Task Build_GeneratesStaticWebAssetsManifest_Success_CreatesManifest() public async Task Build_GeneratesStaticWebAssetsManifest_Success_CreatesManifest()
{ {
@ -84,7 +84,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
Assert.FileDoesNotExist(result, PublishOutputPath, "AppWithPackageAndP2PReference.StaticWebAssets.xml"); Assert.FileDoesNotExist(result, PublishOutputPath, "AppWithPackageAndP2PReference.StaticWebAssets.xml");
} }
[ConditionalFact] [ConditionalFact(Skip = "Flaky test: https://github.com/dotnet/aspnetcore/issues/18543")]
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
[InitializeTestProject("AppWithPackageAndP2PReferenceAndRID", additionalProjects: new[] { "ClassLibrary", "ClassLibrary2" })] [InitializeTestProject("AppWithPackageAndP2PReferenceAndRID", additionalProjects: new[] { "ClassLibrary", "ClassLibrary2" })]
public async Task Publish_CopiesStaticWebAssetsToDestinationFolder_PublishSingleFile() public async Task Publish_CopiesStaticWebAssetsToDestinationFolder_PublishSingleFile()
@ -109,7 +109,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
Assert.FileDoesNotExist(result, publishOutputPath, "AppWithPackageAndP2PReference.StaticWebAssets.xml"); 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" })] [InitializeTestProject("AppWithPackageAndP2PReference", additionalProjects: new[] { "ClassLibrary", "ClassLibrary2" })]
public async Task Publish_WithBuildReferencesDisabled_CopiesStaticWebAssetsToDestinationFolder() 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")); 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" })] [InitializeTestProject("AppWithPackageAndP2PReference", additionalProjects: new[] { "ClassLibrary", "ClassLibrary2" })]
public async Task Publish_NoBuild_CopiesStaticWebAssetsToDestinationFolder() public async Task Publish_NoBuild_CopiesStaticWebAssetsToDestinationFolder()
{ {
@ -188,7 +188,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
Assert.FileDoesNotExist(result, IntermediateOutputPath, "staticwebassets", "AppWithPackageAndP2PReference.StaticWebAssets.xml"); 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" })] [InitializeTestProject("AppWithPackageAndP2PReference",language: "C#", additionalProjects: new[] { "ClassLibrary", "ClassLibrary2" })]
public async Task Rebuild_Success_RecreatesManifestAndCache() public async Task Rebuild_Success_RecreatesManifestAndCache()
{ {

View File

@ -7,7 +7,7 @@
This is also a partial workaround for https://github.com/Microsoft/msbuild/issues/2661 - this project 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. has netcoreapp dependencies that need to be built first.
--> -->
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework> <TargetFramework>netcoreapp5.0</TargetFramework>
<PreserveCompilationContext>true</PreserveCompilationContext> <PreserveCompilationContext>true</PreserveCompilationContext>
<DefineConstants Condition="'$(PreserveWorkingDirectory)'=='true'">$(DefineConstants);PRESERVE_WORKING_DIRECTORY</DefineConstants> <DefineConstants Condition="'$(PreserveWorkingDirectory)'=='true'">$(DefineConstants);PRESERVE_WORKING_DIRECTORY</DefineConstants>
<!-- Copy references locally so that we can use them in the test. --> <!-- Copy references locally so that we can use them in the test. -->
@ -101,7 +101,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
static partial void InitializeVariables() static partial void InitializeVariables()
{ {
_msBuildPath = @"$(_DesktopMSBuildPath)"; _msBuildPath = @"$(_DesktopMSBuildPath)";
_microsoftNETCoreApp31PackageVersion = "$(MicrosoftNETCoreApp31PackageVersion)"; _MicrosoftNETCoreApp50PackageVersion = "$(MicrosoftNETCoreApp50PackageVersion)";
_microsoftNetCompilersToolsetPackageVersion = "$(MicrosoftNetCompilersToolsetPackageVersion)"; _microsoftNetCompilersToolsetPackageVersion = "$(MicrosoftNetCompilersToolsetPackageVersion)";
} }
} }

View File

@ -142,7 +142,7 @@ namespace Microsoft.AspNetCore.Razor.Tasks
[Fact] [Fact]
public void Resolve_Works_WhenAssemblyReferencesAreRecursive() public void Resolve_Works_WhenAssemblyReferencesAreRecursive()
{ {
// Test for https://github.com/aspnet/AspNetCore/issues/12693 // Test for https://github.com/dotnet/aspnetcore/issues/12693
// Arrange // Arrange
var resolver = new TestReferencesToMvcResolver(new[] var resolver = new TestReferencesToMvcResolver(new[]
{ {

View File

@ -14,6 +14,12 @@
<ItemGroup> <ItemGroup>
<!-- Avoid referencing the AspNetCore framework since we want the ability to target work-in-progress shims --> <!-- Avoid referencing the AspNetCore framework since we want the ability to target work-in-progress shims -->
<FrameworkReference Remove="Microsoft.AspNetCore.App" /> <FrameworkReference Remove="Microsoft.AspNetCore.App" />
<!-- RID specific installs attempts to restore runtime packs which cause cyclical dependencies .-->
<KnownFrameworkReference Remove="Microsoft.AspNetCore.App" />
<KnownFrameworkReference Remove="Microsoft.WindowsDesktop.App" />
<KnownFrameworkReference Remove="Microsoft.WindowsDesktop.App.WPF" />
<KnownFrameworkReference Remove="Microsoft.WindowsDesktop.App.WindowsForms" />
</ItemGroup> </ItemGroup>
<PropertyGroup Condition="'$(RunningAsTest)' == ''"> <PropertyGroup Condition="'$(RunningAsTest)' == ''">

View File

@ -2,11 +2,7 @@
<Import Project="RazorTest.Introspection.targets" /> <Import Project="RazorTest.Introspection.targets" />
<PropertyGroup> <PropertyGroup>
<!-- <RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)' ">$(MicrosoftNETCoreApp50PackageVersion)</RuntimeFrameworkVersion>
The runtime version is only useful to restore and compile test projects, and not used to run tests.
We'll keep it pinned to a version that has already been shipped.
-->
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)' ">$(MicrosoftNETCoreAppRefPackageVersion)</RuntimeFrameworkVersion>
<!-- aspnet/BuildTools#662 Don't police what version of NetCoreApp we use --> <!-- aspnet/BuildTools#662 Don't police what version of NetCoreApp we use -->
<NETCoreAppMaximumVersion>99.9</NETCoreAppMaximumVersion> <NETCoreAppMaximumVersion>99.9</NETCoreAppMaximumVersion>
</PropertyGroup> </PropertyGroup>

View File

@ -0,0 +1,9 @@
namespace MvcWithComponents
{
public class Test
{
public static string Foo { get; set; }
public static string Bar { get; set; }
}
}

View File

@ -0,0 +1 @@
@page "/filename"

View File

@ -1,2 +1,4 @@
@Test.Foo @* Used in a test. Don't remove *@
NavMenu content NavMenu content

View File

@ -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
{
/// <summary>
/// I made it!
/// </summary>
[HtmlTargetElement("environment")]
public class EnvironmentTagHelper : TagHelper
{
/// <summary>
/// Exclude it!
/// </summary>
public string Exclude {get; set;}
}
}