Merge branch 'release/3.1' into merge/release/3.1-preview2-to-release/3.1

This commit is contained in:
William Godbe 2019-10-30 13:39:36 -07:00 committed by GitHub
commit 58c9ececc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 53 additions and 12 deletions

View File

@ -13,21 +13,21 @@
<Uri>https://github.com/aspnet/Blazor</Uri>
<Sha>1eea415dd9381f7f13585fe3a5c60ce73ce65174</Sha>
</Dependency>
<Dependency Name="Microsoft.AspNetCore.Razor.Language" Version="3.1.0-preview2.19528.1">
<Dependency Name="Microsoft.AspNetCore.Razor.Language" Version="3.1.0-preview3.19530.1">
<Uri>https://github.com/aspnet/AspNetCore-Tooling</Uri>
<Sha>d273a0f4ccfd17a50b490492929bb3617ca73c32</Sha>
<Sha>80dfa87c89b1cd8639653bb2dad74184c01adb9d</Sha>
</Dependency>
<Dependency Name="Microsoft.AspNetCore.Mvc.Razor.Extensions" Version="3.1.0-preview2.19528.1">
<Dependency Name="Microsoft.AspNetCore.Mvc.Razor.Extensions" Version="3.1.0-preview3.19530.1">
<Uri>https://github.com/aspnet/AspNetCore-Tooling</Uri>
<Sha>d273a0f4ccfd17a50b490492929bb3617ca73c32</Sha>
<Sha>80dfa87c89b1cd8639653bb2dad74184c01adb9d</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Razor" Version="3.1.0-preview2.19528.1">
<Dependency Name="Microsoft.CodeAnalysis.Razor" Version="3.1.0-preview3.19530.1">
<Uri>https://github.com/aspnet/AspNetCore-Tooling</Uri>
<Sha>d273a0f4ccfd17a50b490492929bb3617ca73c32</Sha>
<Sha>80dfa87c89b1cd8639653bb2dad74184c01adb9d</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.Sdk.Razor" Version="3.1.0-preview2.19528.1">
<Dependency Name="Microsoft.NET.Sdk.Razor" Version="3.1.0-preview3.19530.1">
<Uri>https://github.com/aspnet/AspNetCore-Tooling</Uri>
<Sha>d273a0f4ccfd17a50b490492929bb3617ca73c32</Sha>
<Sha>80dfa87c89b1cd8639653bb2dad74184c01adb9d</Sha>
</Dependency>
<Dependency Name="dotnet-ef" Version="3.1.0-preview2.19525.5">
<Uri>https://github.com/aspnet/EntityFrameworkCore</Uri>

View File

@ -168,10 +168,10 @@
<MicrosoftEntityFrameworkCoreToolsPackageVersion>3.1.0-preview2.19525.5</MicrosoftEntityFrameworkCoreToolsPackageVersion>
<MicrosoftEntityFrameworkCorePackageVersion>3.1.0-preview2.19525.5</MicrosoftEntityFrameworkCorePackageVersion>
<!-- Packages from aspnet/AspNetCore-Tooling -->
<MicrosoftAspNetCoreMvcRazorExtensionsPackageVersion>3.1.0-preview2.19528.1</MicrosoftAspNetCoreMvcRazorExtensionsPackageVersion>
<MicrosoftAspNetCoreRazorLanguagePackageVersion>3.1.0-preview2.19528.1</MicrosoftAspNetCoreRazorLanguagePackageVersion>
<MicrosoftCodeAnalysisRazorPackageVersion>3.1.0-preview2.19528.1</MicrosoftCodeAnalysisRazorPackageVersion>
<MicrosoftNETSdkRazorPackageVersion>3.1.0-preview2.19528.1</MicrosoftNETSdkRazorPackageVersion>
<MicrosoftAspNetCoreMvcRazorExtensionsPackageVersion>3.1.0-preview3.19530.1</MicrosoftAspNetCoreMvcRazorExtensionsPackageVersion>
<MicrosoftAspNetCoreRazorLanguagePackageVersion>3.1.0-preview3.19530.1</MicrosoftAspNetCoreRazorLanguagePackageVersion>
<MicrosoftCodeAnalysisRazorPackageVersion>3.1.0-preview3.19530.1</MicrosoftCodeAnalysisRazorPackageVersion>
<MicrosoftNETSdkRazorPackageVersion>3.1.0-preview3.19530.1</MicrosoftNETSdkRazorPackageVersion>
</PropertyGroup>
<!--

View File

@ -581,6 +581,14 @@ namespace Microsoft.AspNetCore.Components.Rendering
/// <param name="sequence">An integer that represents the position of the instruction in the source code.</param>
public void OpenRegion(int sequence)
{
// We are entering a new scope, since we track the "duplicate attributes" per
// element/component we might need to clean them up now.
if (_hasSeenAddMultipleAttributes)
{
var indexOfLastElementOrComponent = _openElementIndices.Peek();
ProcessDuplicateAttributes(first: indexOfLastElementOrComponent + 1);
}
_openElementIndices.Push(_entries.Count);
Append(RenderTreeFrame.Region(sequence));
}

View File

@ -298,6 +298,39 @@ namespace Microsoft.AspNetCore.Components.Rendering
frame => AssertFrame.Attribute(frame, "attribute7", "the end"));
}
[Fact]
public void CanAddMultipleAttributes_WithChildRegion()
{
// This represents bug https://github.com/aspnet/AspNetCore/issues/16570
// If a sequence of attributes is terminated by a call to builder.OpenRegion,
// then the attribute deduplication logic wasn't working correctly
// Arrange
var builder = new RenderTreeBuilder();
// Act
builder.OpenElement(0, "myelement");
builder.AddAttribute(0, "attribute1", "value1");
builder.AddMultipleAttributes(1, new Dictionary<string, object>()
{
{ "attribute1", "value2" },
});
builder.OpenRegion(2);
builder.OpenElement(3, "child");
builder.CloseElement();
builder.CloseRegion();
builder.CloseElement();
// Assert
var frames = builder.GetFrames().AsEnumerable().ToArray();
Assert.Collection(
frames,
frame => AssertFrame.Element(frame, "myelement", 4),
frame => AssertFrame.Attribute(frame, "attribute1", "value2"),
frame => AssertFrame.Region(frame, 2, 2),
frame => AssertFrame.Element(frame, "child", 1, 3));
}
[Fact]
public void CanAddMultipleAttributes_DictionaryObject()
{