Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
1fed78a
Only add MethodInfo to route handler endpoints (#44021)
captainsafia Sep 16, 2022
778b46f
Update versions for 7.0.0 RTM (#43992)
dougbu Sep 16, 2022
282f781
[release/7.0] Update dependencies from dotnet/runtime dotnet/efcore (…
dotnet-maestro[bot] Sep 17, 2022
0b76f2a
[release/7.0] Update dependencies from dotnet/efcore (#44045)
dotnet-maestro[bot] Sep 19, 2022
3dd6d58
[release/7.0] Update dependencies from dotnet/source-build-externals …
dotnet-maestro[bot] Sep 19, 2022
6c69f05
Merge pull request #44034 from dotnet-maestro-bot/merge/release/7.0-r…
Tratcher Sep 19, 2022
4f252ab
Update dependencies from https://github.com/dotnet/efcore build 20220…
dotnet-maestro[bot] Sep 20, 2022
e5a28d4
Revert Ubuntu.1804.Armarch.Open change (#44073)
Tratcher Sep 20, 2022
35c3d66
Update dependencies from https://github.com/dotnet/runtime build 2022…
dotnet-maestro[bot] Sep 20, 2022
c735b8c
[release/7.0] Update dependencies from dotnet/efcore dotnet/runtime (…
dotnet-maestro[bot] Sep 21, 2022
b5d6077
[release/7.0] Update dependencies from dotnet/runtime dotnet/efcore (…
dotnet-maestro[bot] Sep 22, 2022
5195e68
Fix DetectMisplacedLambdaAttribute analyzer and tests (#44061)
halter73 Sep 23, 2022
d812ea3
[release/7.0] Update dependencies from dotnet/efcore dotnet/runtime (…
dotnet-maestro[bot] Sep 23, 2022
963e68e
Update dependencies from https://github.com/dotnet/efcore build 20220…
dotnet-maestro[bot] Sep 23, 2022
ec6d8bb
Retry template tests (#44145)
HaoK Sep 23, 2022
97c3519
Update dependencies from https://github.com/dotnet/arcade build 20220…
dotnet-maestro[bot] Sep 23, 2022
8a037c1
Update dependencies from https://github.com/dotnet/runtime build 2022…
dotnet-maestro[bot] Sep 24, 2022
a2d223c
[release/7.0] Update spa-templates to ref new 7.0 branch (#44134)
dougbu Sep 24, 2022
6a59850
[release/7.0] Update dependencies from dotnet/efcore dotnet/runtime (…
dotnet-maestro[bot] Sep 24, 2022
07faa98
[release/7.0] Remove Kevin from CodeOwners (#44161)
dougbu Sep 24, 2022
36d7295
Merge branch 'main' into merge/release/7.0-to-main
dougbu Sep 24, 2022
bb856e7
Revert Ubuntu.1804.Armarch.Open change (#44073)
Tratcher Sep 20, 2022
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
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Users referenced in this file will automatically be requested as reviewers for PRs that modify the given paths.
# See https://help.github.com/articles/about-code-owners/

* @Pilchie
/**/PublicAPI.*Shipped.txt @dotnet/aspnet-api-review
/global.json @dotnet/aspnet-build @dougbu @wtgodbe
/.azure/ @dotnet/aspnet-build @dougbu @wtgodbe
Expand Down
1 change: 1 addition & 0 deletions eng/Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
<DotNetProjects Include="
$(RepoRoot)src\Framework\App.Ref\src\Microsoft.AspNetCore.App.Ref.csproj;
$(RepoRoot)src\Framework\App.Ref.Internal\src\Microsoft.AspNetCore.App.Ref.Internal.csproj;
$(RepoRoot)src\Framework\AspNetCoreAnalyzers\test\Microsoft.AspNetCore.App.Analyzers.Test.csproj;
$(RepoRoot)src\Framework\test\Microsoft.AspNetCore.App.UnitTests.csproj;
$(RepoRoot)src\Caching\**\*.*proj;
$(RepoRoot)src\DefaultBuilder\**\*.*proj;
Expand Down
2 changes: 1 addition & 1 deletion eng/targets/Helix.Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<HelixQueueDebian11>(Debian.11.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:debian-11-helix-amd64-20211001171307-0ece9b3</HelixQueueDebian11>
<HelixQueueFedora34>(Fedora.34.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:fedora-34-helix-20210924174119-4f64125</HelixQueueFedora34>
<HelixQueueMariner>(Mariner)[email protected]/dotnet-buildtools/prereqs:cbl-mariner-1.0-helix-20210528192219-92bf620</HelixQueueMariner>
<HelixQueueArmDebian11>(Debian.11.Arm64.Open)Ubuntu.2004[email protected]/dotnet-buildtools/prereqs:debian-11-helix-arm64v8-20211001171229-97d8652</HelixQueueArmDebian11>
<HelixQueueArmDebian11>(Debian.11.Arm64.Open)Ubuntu.1804[email protected]/dotnet-buildtools/prereqs:debian-11-helix-arm64v8-20211001171229-97d8652</HelixQueueArmDebian11>

<!-- Do not attempt to override global property. -->
<RunQuarantinedTests Condition=" '$(RunQuarantinedTests)' == '' ">false</RunQuarantinedTests>
Expand Down
1 change: 1 addition & 0 deletions eng/test-configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
{"testName": {"contains": "POST_ServerAbort_ClientReceivesAbort"}},
{"testName": {"contains": "POST_ServerAbortAfterWrite_ClientReceivesAbort"}},
{"testAssembly": {"contains": "IIS"}},
{"testAssembly": {"contains": "Template"}},
{"failureMessage": {"contains":"(Site is started but no worker process found)"}},
{"failureMessage": {"contains": "network disconnected"}}
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics;
using System.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
Expand All @@ -22,23 +23,17 @@ private static void DetectMisplacedLambdaAttribute(
// Hello();
// return "foo";
// }
IMethodSymbol? methodSymbol = null;

// () => Hello() has a single child which is a BlockOperation so we check to see if
// expression associated with that operation is an invocation expression
if (lambda.ChildOperations.FirstOrDefault().Syntax is InvocationExpressionSyntax innerInvocation)
// All lambdas have a single child which is a BlockOperation. We search ChildOperations for
// the invocation expression.
if (lambda.ChildOperations.Count != 1 || lambda.ChildOperations.FirstOrDefault() is not IBlockOperation blockOperation)
{
methodSymbol = lambda.Symbol;
}

if (lambda.ChildOperations.FirstOrDefault().ChildOperations.FirstOrDefault() is IReturnOperation returnOperation
&& returnOperation.ReturnedValue is IInvocationOperation returnedInvocation)
{
methodSymbol = returnedInvocation.TargetMethod;
Debug.Fail("Expected a single top-level BlockOperation for all lambdas.");
return;
}

// If no method definition was found for the lambda, then abort.
if (methodSymbol is null)
if (GetReturnedInvocation(blockOperation) is not IMethodSymbol methodSymbol)
{
return;
}
Expand Down Expand Up @@ -73,5 +68,38 @@ static bool IsInValidNamespace(INamespaceSymbol? @namespace)

return false;
}

static IMethodSymbol? GetReturnedInvocation(IBlockOperation blockOperation)
{
foreach (var op in blockOperation.ChildOperations.Reverse())
{
if (op is IReturnOperation returnStatement)
{
if (returnStatement.ReturnedValue is IInvocationOperation invocationReturn)
{
return invocationReturn.TargetMethod;
}

// Sometimes expression backed lambdas include an IReturnOperation with a null ReturnedValue
// right after the IExpressionStatementOperation whose Operation is the real ReturnedValue,
// so we keep looking backwards rather than returning null immediately.
}
else if (op is IExpressionStatementOperation expression)
{
if (expression.Operation is IInvocationOperation invocationExpression)
{
return invocationExpression.TargetMethod;
}

return null;
}
else
{
return null;
}
}

return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public WebApplicationBuilderAnalyzerTest()
TrimAssemblyExtension(typeof(Microsoft.Extensions.Hosting.HostingHostBuilderExtensions).Assembly.Location),
TrimAssemblyExtension(typeof(Microsoft.AspNetCore.Builder.ConfigureHostBuilder).Assembly.Location),
TrimAssemblyExtension(typeof(Microsoft.AspNetCore.Builder.ConfigureWebHostBuilder).Assembly.Location),
TrimAssemblyExtension(typeof(Microsoft.AspNetCore.Builder.EndpointRoutingApplicationBuilderExtensions).Assembly.Location),
TrimAssemblyExtension(typeof(Microsoft.AspNetCore.Hosting.HostingAbstractionsWebHostBuilderExtensions).Assembly.Location),
TrimAssemblyExtension(typeof(Microsoft.Extensions.Logging.ILoggingBuilder).Assembly.Location),
TrimAssemblyExtension(typeof(Microsoft.Extensions.Logging.ConsoleLoggerExtensions).Assembly.Location),
Expand Down
6 changes: 5 additions & 1 deletion src/Http/Routing/src/RouteEndpointDataSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,13 @@ private RouteEndpointBuilder CreateRouteEndpointBuilder(
{
DisplayName = displayName,
ApplicationServices = _applicationServices,
Metadata = { handler.Method },
};

if (isRouteHandler)
{
builder.Metadata.Add(handler.Method);
}

if (entry.HttpMethods is not null)
{
builder.Metadata.Add(new HttpMethodMetadata(entry.HttpMethods));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,9 @@ public void MapEndpoint_AttributesCollectedAsMetadata()
// Assert
var endpointBuilder1 = GetRouteEndpointBuilder(builder);
Assert.Equal("/", endpointBuilder1.RoutePattern.RawText);
Assert.Equal(3, endpointBuilder1.Metadata.Count);
Assert.Equal(((RequestDelegate)Handle).Method, endpointBuilder1.Metadata[0]);
Assert.IsType<Attribute1>(endpointBuilder1.Metadata[1]);
Assert.IsType<Attribute2>(endpointBuilder1.Metadata[2]);
Assert.Equal(2, endpointBuilder1.Metadata.Count);
Assert.IsType<Attribute1>(endpointBuilder1.Metadata[0]);
Assert.IsType<Attribute2>(endpointBuilder1.Metadata[1]);
}

[Fact]
Expand Down Expand Up @@ -228,11 +227,10 @@ public void MapEndpoint_PrecedenceOfMetadata_BuilderMetadataReturned()

// As with the Delegate Map method overloads for route handlers, the attributes on the RequestDelegate
// can override the HttpMethodMetadata. Extension methods could already do this.
Assert.Equal(4, endpoint.Metadata.Count);
Assert.Equal(((RequestDelegate)HandleHttpMetdata).Method, endpoint.Metadata[0]);
Assert.Equal("METHOD", GetMethod(endpoint.Metadata[1]));
Assert.Equal("ATTRIBUTE", GetMethod(endpoint.Metadata[2]));
Assert.Equal("BUILDER", GetMethod(endpoint.Metadata[3]));
Assert.Equal(3, endpoint.Metadata.Count);
Assert.Equal("METHOD", GetMethod(endpoint.Metadata[0]));
Assert.Equal("ATTRIBUTE", GetMethod(endpoint.Metadata[1]));
Assert.Equal("BUILDER", GetMethod(endpoint.Metadata[2]));

Assert.Equal("BUILDER", endpoint.Metadata.GetMetadata<IHttpMethodMetadata>()?.HttpMethods.Single());

Expand Down