Skip to content

[automated] Merge branch 'release/3.1-preview1' => 'release/3.1' #14645

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
ea8c2b9
SignalR Negotiate protocol versioning (#13389)
mikaelm12 Sep 4, 2019
7d59ae1
SignalR ConnectionToken/ConnectionAddress feature (#13773)
mikaelm12 Sep 16, 2019
de15b0c
Add support for negotiateVersion query string parameter and Connectio…
mikaelm12 Sep 18, 2019
b5db4a9
[TS] Add support for negotiateVersion and connectionToken (#14157)
BrennanConroy Sep 25, 2019
1aa29f0
C# and Java client negotiateVersion cleanup (#14196)
BrennanConroy Sep 25, 2019
e6f183e
Add RenderTreeBuilder extension methods for "prevent default" and "st…
SteveSandersonMS Sep 26, 2019
3249dce
Refactor EventHandlerInfosForElement storage to avoid ad-hoc assumpti…
SteveSandersonMS Sep 26, 2019
3cd4726
Keep track of preventDefault/stopBubbling flags on JS side
SteveSandersonMS Sep 26, 2019
31ee4a8
Simplify: once we start tracking event info for a given element, ther…
SteveSandersonMS Sep 26, 2019
e7e2ded
Implement actual "stop bubbling"
SteveSandersonMS Sep 26, 2019
86a8dcf
Implement actual "prevent default"
SteveSandersonMS Sep 26, 2019
d2887cc
Update JS binaries
SteveSandersonMS Sep 26, 2019
cdef672
Fix newly-created bug with 'on' prefix mismatch
SteveSandersonMS Sep 26, 2019
896feb4
Make navigation interception participate in synthetic event bubbling
SteveSandersonMS Sep 26, 2019
580184d
Rename "stop bubbling" to "stop propagation" for consistency with JS
SteveSandersonMS Sep 26, 2019
2339282
Update JS binaries
SteveSandersonMS Sep 26, 2019
05c284f
Add some E2E scenario code for bubbling
SteveSandersonMS Sep 27, 2019
47d1ffc
E2E scenario code for preventDefault+navigation
SteveSandersonMS Sep 27, 2019
eab8ba8
Make navigation+bubbling interactions work like native
SteveSandersonMS Sep 27, 2019
62f596c
Actual event bubbling E2E tests
SteveSandersonMS Sep 27, 2019
6f8b31b
Move navigation preventDefault tests to their own page
SteveSandersonMS Sep 27, 2019
0d30083
E2E tests for navigation+preventDefault
SteveSandersonMS Sep 27, 2019
aca8db6
CR: Rename RenderTreeBuilderExtensions to WebRenderTreeBuilderExtensions
SteveSandersonMS Oct 1, 2019
428017a
Regenerate blazor.server.js
SteveSandersonMS Oct 1, 2019
2fc6041
Update ref assembly
SteveSandersonMS Oct 1, 2019
206f793
Add unit tests for illegal ParameterView access
SteveSandersonMS Sep 27, 2019
2e7c864
Fix comment
SteveSandersonMS Sep 27, 2019
612a667
Have ParameterView track its owning RenderBatchBuilder
SteveSandersonMS Sep 27, 2019
d59baa8
Wrap up lifetime concept as a type, and implement expiry
SteveSandersonMS Sep 27, 2019
e6656a6
Complete test cases
SteveSandersonMS Sep 27, 2019
c2a45b4
Typo
SteveSandersonMS Sep 28, 2019
9afb1ce
CR: Clarify comment
SteveSandersonMS Sep 29, 2019
1ac8ff1
Add specific unit test in ParameterViewTest
SteveSandersonMS Sep 29, 2019
762cbde
CR: Add some "in" plus clean up "using"
SteveSandersonMS Sep 29, 2019
ebe81c2
Fix test that was illegally holding ParameterView references
SteveSandersonMS Sep 30, 2019
00ebfb4
When using auth, use CascadingAuthenticationState explicitly. Fixes #…
SteveSandersonMS Sep 29, 2019
fa93369
Fix null reference exception for Streaming null object (#14004) (#14515)
BrennanConroy Oct 1, 2019
8e6cd2c
Port https://github.com/aspnet/AspNetCore/pull/12879 to 3.1 (#14638)
ryanbrandenburg Oct 1, 2019
361428a
Updated npm dependencies (#14595)
mkArtakMSFT Oct 1, 2019
92f771f
Update templates for 3.1 (#14637)
ryanbrandenburg Oct 1, 2019
0a1e208
[3.1] Re-implement SameSite for 2019 (#13776)
Tratcher Oct 1, 2019
12cba32
Make UseStatusCodePagesWithReExecute clear Endpoints (#14531)
Tratcher Oct 1, 2019
66425a5
Update dependencies from https://github.com/aspnet/AspNetCore-Tooling…
dotnet-maestro[bot] Oct 1, 2019
5df258a
HttpSys GoAway (#14522)
Tratcher Oct 1, 2019
51ae61b
Support attaching to an existing request queue in HTTP.SYS (#14182)
bkatms Oct 1, 2019
29a1d50
Throw when UseAuthorization is incorrectly configured
pranavkm Sep 24, 2019
cc368c8
Prevent null refs in RemoteJSRuntime
pranavkm Oct 1, 2019
6bc4d27
Support parameters on server-side rendered components
javiercn Sep 26, 2019
1ed31bd
Merge pull request #14402 from aspnet/brecon/negotiateVersion
Oct 1, 2019
ff095dd
Merge pull request #14651 from aspnet/darc-release/3.1-preview1-96d6c…
wtgodbe Oct 2, 2019
b14db57
Updated Blazor macOS Catalina/iOS 13 workaround (#14576)
SteveSandersonMS Oct 2, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@
<Uri>https://github.com/aspnet/Blazor</Uri>
<Sha>348e050ecd9bd8924581afb677089ae5e2d5e508</Sha>
</Dependency>
<Dependency Name="Microsoft.AspNetCore.Razor.Language" Version="3.1.0-preview1.19472.1">
<Dependency Name="Microsoft.AspNetCore.Razor.Language" Version="3.1.0-preview1.19501.1">
<Uri>https://github.com/aspnet/AspNetCore-Tooling</Uri>
<Sha>9dc38f98bd6eb330aa1463c38bb2f6c6eccdb309</Sha>
<Sha>1e85487b5011a3541c78be97baa4407abf87ea1a</Sha>
</Dependency>
<Dependency Name="Microsoft.AspNetCore.Mvc.Razor.Extensions" Version="3.1.0-preview1.19472.1">
<Dependency Name="Microsoft.AspNetCore.Mvc.Razor.Extensions" Version="3.1.0-preview1.19501.1">
<Uri>https://github.com/aspnet/AspNetCore-Tooling</Uri>
<Sha>9dc38f98bd6eb330aa1463c38bb2f6c6eccdb309</Sha>
<Sha>1e85487b5011a3541c78be97baa4407abf87ea1a</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Razor" Version="3.1.0-preview1.19472.1">
<Dependency Name="Microsoft.CodeAnalysis.Razor" Version="3.1.0-preview1.19501.1">
<Uri>https://github.com/aspnet/AspNetCore-Tooling</Uri>
<Sha>9dc38f98bd6eb330aa1463c38bb2f6c6eccdb309</Sha>
<Sha>1e85487b5011a3541c78be97baa4407abf87ea1a</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.Sdk.Razor" Version="3.1.0-preview1.19472.1">
<Dependency Name="Microsoft.NET.Sdk.Razor" Version="3.1.0-preview1.19501.1">
<Uri>https://github.com/aspnet/AspNetCore-Tooling</Uri>
<Sha>9dc38f98bd6eb330aa1463c38bb2f6c6eccdb309</Sha>
<Sha>1e85487b5011a3541c78be97baa4407abf87ea1a</Sha>
</Dependency>
<Dependency Name="dotnet-ef" Version="3.1.0-preview1.19472.2">
<Uri>https://github.com/aspnet/EntityFrameworkCore</Uri>
Expand Down
8 changes: 4 additions & 4 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@
<MicrosoftEntityFrameworkCoreToolsPackageVersion>3.1.0-preview1.19472.2</MicrosoftEntityFrameworkCoreToolsPackageVersion>
<MicrosoftEntityFrameworkCorePackageVersion>3.1.0-preview1.19472.2</MicrosoftEntityFrameworkCorePackageVersion>
<!-- Packages from aspnet/AspNetCore-Tooling -->
<MicrosoftAspNetCoreMvcRazorExtensionsPackageVersion>3.1.0-preview1.19472.1</MicrosoftAspNetCoreMvcRazorExtensionsPackageVersion>
<MicrosoftAspNetCoreRazorLanguagePackageVersion>3.1.0-preview1.19472.1</MicrosoftAspNetCoreRazorLanguagePackageVersion>
<MicrosoftCodeAnalysisRazorPackageVersion>3.1.0-preview1.19472.1</MicrosoftCodeAnalysisRazorPackageVersion>
<MicrosoftNETSdkRazorPackageVersion>3.1.0-preview1.19472.1</MicrosoftNETSdkRazorPackageVersion>
<MicrosoftAspNetCoreMvcRazorExtensionsPackageVersion>3.1.0-preview1.19501.1</MicrosoftAspNetCoreMvcRazorExtensionsPackageVersion>
<MicrosoftAspNetCoreRazorLanguagePackageVersion>3.1.0-preview1.19501.1</MicrosoftAspNetCoreRazorLanguagePackageVersion>
<MicrosoftCodeAnalysisRazorPackageVersion>3.1.0-preview1.19501.1</MicrosoftCodeAnalysisRazorPackageVersion>
<MicrosoftNETSdkRazorPackageVersion>3.1.0-preview1.19501.1</MicrosoftNETSdkRazorPackageVersion>
</PropertyGroup>
<!--

Expand Down
12 changes: 11 additions & 1 deletion src/Analyzers/Analyzers/src/StartupAnalyzer.Diagnostics.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Collections.Immutable;
Expand All @@ -19,6 +19,7 @@ static Diagnostics()
{
// ASP
BuildServiceProviderShouldNotCalledInConfigureServicesMethod,
IncorrectlyConfiguredAuthorizationMiddleware,

// MVC
UnsupportedUseMvcWithEndpointRouting,
Expand All @@ -42,6 +43,15 @@ static Diagnostics()
DiagnosticSeverity.Warning,
isEnabledByDefault: true,
helpLinkUri: "https://aka.ms/YJggeFn");

internal readonly static DiagnosticDescriptor IncorrectlyConfiguredAuthorizationMiddleware = new DiagnosticDescriptor(
"ASP0001",
"Authorization middleware is incorrectly configured.",
"The call to UseAuthorization should appear between app.UseRouting() and app.UseEndpoints(..) for authorization to be correctly evaluated.",
"Usage",
DiagnosticSeverity.Warning,
isEnabledByDefault: true,
helpLinkUri: "https://aka.ms/AA64fv1");
}
}
}
3 changes: 2 additions & 1 deletion src/Analyzers/Analyzers/src/StartupAnalyzer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
Expand Down Expand Up @@ -82,6 +82,7 @@ private void OnCompilationStart(CompilationStartAnalysisContext context)
var analysis = builder.Build();
new UseMvcAnalyzer(analysis).AnalyzeSymbol(context);
new BuildServiceProviderValidator(analysis).AnalyzeSymbol(context);
new UseAuthorizationAnalyzer(analysis).AnalyzeSymbol(context);
});

}, SymbolKind.NamedType);
Expand Down
82 changes: 82 additions & 0 deletions src/Analyzers/Analyzers/src/UseAuthorizationAnalyzer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Diagnostics;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;

namespace Microsoft.AspNetCore.Analyzers
{
internal class UseAuthorizationAnalyzer
{
private readonly StartupAnalysis _context;

public UseAuthorizationAnalyzer(StartupAnalysis context)
{
_context = context;
}

public void AnalyzeSymbol(SymbolAnalysisContext context)
{
Debug.Assert(context.Symbol.Kind == SymbolKind.NamedType);
Debug.Assert(StartupFacts.IsStartupClass(_context.StartupSymbols, (INamedTypeSymbol)context.Symbol));

var type = (INamedTypeSymbol)context.Symbol;

foreach (var middlewareAnalysis in _context.GetRelatedAnalyses<MiddlewareAnalysis>(type))
{
MiddlewareItem? useAuthorizationItem = default;
MiddlewareItem? useRoutingItem = default;

var length = middlewareAnalysis.Middleware.Length;
for (var i = length - 1; i >= 0; i-- )
{
var middlewareItem = middlewareAnalysis.Middleware[i];
var middleware = middlewareItem.UseMethod.Name;

if (middleware == "UseAuthorization")
{
if (useRoutingItem != null && useAuthorizationItem == null)
{
// This looks like
//
// app.UseAuthorization();
// ...
// app.UseRouting();
// app.UseEndpoints(...);

context.ReportDiagnostic(Diagnostic.Create(
StartupAnalyzer.Diagnostics.IncorrectlyConfiguredAuthorizationMiddleware,
middlewareItem.Operation.Syntax.GetLocation(),
middlewareItem.UseMethod.Name));
}

useAuthorizationItem = middlewareItem;
}
else if (middleware == "UseEndpoints")
{
if (useAuthorizationItem != null)
{
// This configuration looks like
//
// app.UseRouting();
// app.UseEndpoints(...);
// ...
// app.UseAuthorization();
//

context.ReportDiagnostic(Diagnostic.Create(
StartupAnalyzer.Diagnostics.IncorrectlyConfiguredAuthorizationMiddleware,
useAuthorizationItem.Operation.Syntax.GetLocation(),
middlewareItem.UseMethod.Name));
}
}
else if (middleware == "UseRouting")
{
useRoutingItem = middlewareItem;
}
}
}
}
}
}
87 changes: 86 additions & 1 deletion src/Analyzers/Analyzers/test/StartupAnalyzerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public async Task StartupAnalyzer_MvcOptionsAnalysis_MultipleMiddleware()

Assert.Collection(
middlewareAnalysis.Middleware,
item => Assert.Equal("UseAuthorization", item.UseMethod.Name),
item => Assert.Equal("UseStaticFiles", item.UseMethod.Name),
item => Assert.Equal("UseMiddleware", item.UseMethod.Name),
item => Assert.Equal("UseMvc", item.UseMethod.Name),
item => Assert.Equal("UseRouting", item.UseMethod.Name),
Expand Down Expand Up @@ -228,5 +228,90 @@ public async Task StartupAnalyzer_ServicesAnalysis_CallBuildServiceProvider()
AnalyzerAssert.DiagnosticLocation(source.MarkerLocations["MM1"], diagnostic.Location);
});
}

[Fact]
public async Task StartupAnalyzer_UseAuthorizationConfiguredCorrectly_ReportsNoDiagnostics()
{
// Arrange
var source = Read(nameof(TestFiles.StartupAnalyzerTest.UseAuthConfiguredCorrectly));

// Act
var diagnostics = await Runner.GetDiagnosticsAsync(source.Source);

// Assert
var middlewareAnalysis = Assert.Single(Analyses.OfType<MiddlewareAnalysis>());
Assert.NotEmpty(middlewareAnalysis.Middleware);
Assert.Empty(diagnostics);
}

[Fact]
public async Task StartupAnalyzer_UseAuthorizationInvokedMultipleTimesInEndpointRoutingBlock_ReportsNoDiagnostics()
{
// Arrange
var source = Read(nameof(TestFiles.StartupAnalyzerTest.UseAuthMultipleTimes));

// Act
var diagnostics = await Runner.GetDiagnosticsAsync(source.Source);

// Assert
var middlewareAnalysis = Assert.Single(Analyses.OfType<MiddlewareAnalysis>());
Assert.NotEmpty(middlewareAnalysis.Middleware);
Assert.Empty(diagnostics);
}

[Fact]
public async Task StartupAnalyzer_UseAuthorizationConfiguredBeforeUseRouting_ReportsDiagnostics()
{
// Arrange
var source = Read(nameof(TestFiles.StartupAnalyzerTest.UseAuthBeforeUseRouting));

// Act
var diagnostics = await Runner.GetDiagnosticsAsync(source.Source);

// Assert
var middlewareAnalysis = Assert.Single(Analyses.OfType<MiddlewareAnalysis>());
Assert.NotEmpty(middlewareAnalysis.Middleware);
Assert.Collection(diagnostics,
diagnostic =>
{
Assert.Same(StartupAnalyzer.Diagnostics.IncorrectlyConfiguredAuthorizationMiddleware, diagnostic.Descriptor);
AnalyzerAssert.DiagnosticLocation(source.DefaultMarkerLocation, diagnostic.Location);
});
}

[Fact]
public async Task StartupAnalyzer_UseAuthorizationConfiguredAfterUseEndpoints_ReportsDiagnostics()
{
// Arrange
var source = Read(nameof(TestFiles.StartupAnalyzerTest.UseAuthAfterUseEndpoints));

// Act
var diagnostics = await Runner.GetDiagnosticsAsync(source.Source);

// Assert
var middlewareAnalysis = Assert.Single(Analyses.OfType<MiddlewareAnalysis>());
Assert.NotEmpty(middlewareAnalysis.Middleware);
Assert.Collection(diagnostics,
diagnostic =>
{
Assert.Same(StartupAnalyzer.Diagnostics.IncorrectlyConfiguredAuthorizationMiddleware, diagnostic.Descriptor);
AnalyzerAssert.DiagnosticLocation(source.DefaultMarkerLocation, diagnostic.Location);
});
}

[Fact]
public async Task StartupAnalyzer_MultipleUseAuthorization_ReportsNoDiagnostics()
{
// Arrange
var source = Read(nameof(TestFiles.StartupAnalyzerTest.UseAuthFallbackPolicy));

// Act
var diagnostics = await Runner.GetDiagnosticsAsync(source.Source);

// Assert
var middlewareAnalysis = Assert.Single(Analyses.OfType<MiddlewareAnalysis>());
Assert.NotEmpty(middlewareAnalysis.Middleware);
Assert.Empty(diagnostics);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using Microsoft.AspNetCore.Builder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using Microsoft.AspNetCore.Authorization;
Expand All @@ -18,7 +18,7 @@ public void Configure(IApplicationBuilder app)
{
/*MM1*/app.UseMvcWithDefaultRoute();

app.UseAuthorization();
app.UseStaticFiles();
app.UseMiddleware<AuthorizationMiddleware>();

/*MM2*/app.UseMvc();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using Microsoft.AspNetCore.Authorization;
Expand All @@ -16,7 +16,7 @@ public void ConfigureServices(IServiceCollection services)

public void Configure(IApplicationBuilder app)
{
app.UseAuthorization();
app.UseStaticFiles();
app.UseMiddleware<AuthorizationMiddleware>();

/*MM*/app.UseMvc();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using Microsoft.AspNetCore.Builder;

namespace Microsoft.AspNetCore.Analyzers.TestFiles.StartupAnalyzerTest
{
public class UseAuthAfterUseEndpoints
{
public void Configure(IApplicationBuilder app)
{
app.UseRouting();
app.UseEndpoints(r => { });
/*MM*/app.UseAuthorization();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using Microsoft.AspNetCore.Builder;

namespace Microsoft.AspNetCore.Analyzers.TestFiles.StartupAnalyzerTest
{
public class UseAuthBeforeUseRouting
{
public void Configure(IApplicationBuilder app)
{
app.UseFileServer();
/*MM*/app.UseAuthorization();
app.UseRouting();
app.UseEndpoints(r => { });
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using Microsoft.AspNetCore.Builder;

namespace Microsoft.AspNetCore.Analyzers.TestFiles.StartupAnalyzerTest
{
public class UseAuthConfiguredCorrectly
{
public void Configure(IApplicationBuilder app)
{
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(r => { });
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using Microsoft.AspNetCore.Builder;

namespace Microsoft.AspNetCore.Analyzers.TestFiles.StartupAnalyzerTest
{
public class UseAuthFallbackPolicy
{
public void Configure(IApplicationBuilder app)
{
// This sort of setup would be useful if the user wants to use Auth for non-endpoint content to be handled using the Fallback policy, while
// using the second instance for regular endpoint routing based auth. We do not want to produce a warning in this case.
app.UseAuthorization();
app.UseStaticFiles();

app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(r => { });
}
}
}
Loading