Skip to content

Commit d17dd16

Browse files
committed
React to dependencies and PR feedback
1 parent ed0cf96 commit d17dd16

16 files changed

+22
-26
lines changed

src/Http/Http.Results/src/AcceptedAtRoute.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Reflection;
66
using Microsoft.AspNetCore.Builder;
77
using Microsoft.AspNetCore.Http.Metadata;
8+
using Microsoft.AspNetCore.Internal;
89
using Microsoft.AspNetCore.Routing;
910
using Microsoft.Extensions.DependencyInjection;
1011
using Microsoft.Extensions.Logging;
@@ -52,7 +53,7 @@ internal AcceptedAtRoute(
5253
RouteValueDictionary routeValues)
5354
{
5455
RouteName = routeName;
55-
RouteValues = HttpResultsHelper.EnsureValue(routeValues);
56+
RouteValues = routeValues ?? new RouteValueDictionary();
5657
}
5758

5859
/// <summary>

src/Http/Http.Results/src/AcceptedAtRouteOfT.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Reflection;
66
using Microsoft.AspNetCore.Builder;
77
using Microsoft.AspNetCore.Http.Metadata;
8+
using Microsoft.AspNetCore.Internal;
89
using Microsoft.AspNetCore.Routing;
910
using Microsoft.Extensions.DependencyInjection;
1011
using Microsoft.Extensions.Logging;
@@ -58,7 +59,7 @@ internal AcceptedAtRoute(
5859
{
5960
Value = value;
6061
RouteName = routeName;
61-
RouteValues = HttpResultsHelper.EnsureValue(routeValues);
62+
RouteValues = routeValues ?? new RouteValueDictionary();
6263
HttpResultsHelper.ApplyProblemDetailsDefaultsIfNeeded(Value, StatusCode);
6364
}
6465

src/Http/Http.Results/src/CreatedAtRoute.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Reflection;
66
using Microsoft.AspNetCore.Builder;
77
using Microsoft.AspNetCore.Http.Metadata;
8+
using Microsoft.AspNetCore.Internal;
89
using Microsoft.AspNetCore.Routing;
910
using Microsoft.Extensions.DependencyInjection;
1011
using Microsoft.Extensions.Logging;
@@ -52,7 +53,7 @@ internal CreatedAtRoute(
5253
RouteValueDictionary routeValues)
5354
{
5455
RouteName = routeName;
55-
RouteValues = HttpResultsHelper.EnsureValue(routeValues);
56+
RouteValues = routeValues ?? new RouteValueDictionary();
5657
}
5758

5859
/// <summary>

src/Http/Http.Results/src/CreatedAtRouteOfT.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Reflection;
66
using Microsoft.AspNetCore.Builder;
77
using Microsoft.AspNetCore.Http.Metadata;
8+
using Microsoft.AspNetCore.Internal;
89
using Microsoft.AspNetCore.Routing;
910
using Microsoft.Extensions.DependencyInjection;
1011
using Microsoft.Extensions.Logging;
@@ -58,7 +59,7 @@ internal CreatedAtRoute(
5859
{
5960
Value = value;
6061
RouteName = routeName;
61-
RouteValues = HttpResultsHelper.EnsureValue(routeValues);
62+
RouteValues = routeValues ?? new RouteValueDictionary();
6263
HttpResultsHelper.ApplyProblemDetailsDefaultsIfNeeded(Value, StatusCode);
6364
}
6465

src/Http/Http.Results/src/Microsoft.AspNetCore.Http.Results.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<Compile Include="$(SharedSourceRoot)ProblemDetails\ProblemDetailsDefaults.cs" LinkBase="Shared" />
2020
<Compile Include="$(SharedSourceRoot)ApiExplorerTypes\*.cs" LinkBase="Shared" />
2121
<Compile Include="$(SharedSourceRoot)RoutingMetadata\AcceptsMetadata.cs" LinkBase="Shared" />
22+
<Compile Include="$(SharedSourceRoot)RouteValueDictionaryTrimmerWarning.cs" LinkBase="Shared" />
2223
</ItemGroup>
2324

2425
<ItemGroup>

src/Http/Http.Results/src/PublicAPI.Unshipped.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ static Microsoft.AspNetCore.Http.TypedResults.Created<TValue>(System.Uri? uri, T
2222
*REMOVED*static Microsoft.AspNetCore.Http.TypedResults.Created(System.Uri! uri) -> Microsoft.AspNetCore.Http.HttpResults.Created!
2323
*REMOVED*static Microsoft.AspNetCore.Http.TypedResults.Created(string! uri) -> Microsoft.AspNetCore.Http.HttpResults.Created!
2424
*REMOVED*static Microsoft.AspNetCore.Http.TypedResults.Created<TValue>(System.Uri! uri, TValue? value) -> Microsoft.AspNetCore.Http.HttpResults.Created<TValue>!
25-
*REMOVED*static Microsoft.AspNetCore.Http.TypedResults.Created<TValue>(string! uri, TValue? value) -> Microsoft.AspNetCore.Http.HttpResults.Created<TValue>!
25+
*REMOVED*static Microsoft.AspNetCore.Http.TypedResults.Created<TValue>(string! uri, TValue? value) -> Microsoft.AspNetCore.Http.HttpResults.Created<TValue>!

src/Http/Http.Results/src/RedirectToRouteHttpResult.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.Diagnostics.CodeAnalysis;
5+
using Microsoft.AspNetCore.Internal;
56
using Microsoft.AspNetCore.Routing;
67
using Microsoft.Extensions.DependencyInjection;
78
using Microsoft.Extensions.Logging;

src/Http/Http.Results/src/Results.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using Microsoft.AspNetCore.Authentication;
1010
using Microsoft.AspNetCore.Hosting;
1111
using Microsoft.AspNetCore.Http.HttpResults;
12+
using Microsoft.AspNetCore.Internal;
1213
using Microsoft.AspNetCore.Mvc;
1314
using Microsoft.AspNetCore.Routing;
1415
using Microsoft.Net.Http.Headers;
@@ -674,9 +675,6 @@ public static IResult ValidationProblem(
674675
return TypedResults.Problem(problemDetails);
675676
}
676677

677-
// Remove once https://github.com/dotnet/aspnetcore/pull/45886 is done.
678-
[UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = "<Pending>")]
679-
[UnconditionalSuppressMessage("AOT", "IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.", Justification = "<Pending>")]
680678
private static void CopyExtensions(IDictionary<string, object?>? extensions, HttpValidationProblemDetails problemDetails)
681679
{
682680
if (extensions is not null)

src/Http/Http.Results/src/TypedResults.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using Microsoft.AspNetCore.Authentication;
1010
using Microsoft.AspNetCore.Hosting;
1111
using Microsoft.AspNetCore.Http.HttpResults;
12+
using Microsoft.AspNetCore.Internal;
1213
using Microsoft.AspNetCore.Mvc;
1314
using Microsoft.AspNetCore.Routing;
1415
using Microsoft.Net.Http.Headers;
@@ -712,9 +713,6 @@ public static ProblemHttpResult Problem(
712713
return new(problemDetails);
713714
}
714715

715-
// Remove once https://github.com/dotnet/aspnetcore/pull/45886 is done.
716-
[UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = "<Pending>")]
717-
[UnconditionalSuppressMessage("AOT", "IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.", Justification = "<Pending>")]
718716
private static void CopyExtensions(IDictionary<string, object?>? extensions, ProblemDetails problemDetails)
719717
{
720718
if (extensions is not null)

src/Http/Http.Results/test/ResultsTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ public void Created_WithNullStringUriAndValue_SetsLocationNull()
586586
//Arrange
587587
object value = new { };
588588

589-
// Act
589+
// Act
590590
var result = Results.Created(default(string), value) as Created<object>;
591591

592592
//Assert
@@ -600,7 +600,7 @@ public void Created_WithEmptyStringUriAndValue_SetsLocationEmpty()
600600
//Arrange
601601
object value = new { };
602602

603-
// Act
603+
// Act
604604
var result = Results.Created(string.Empty, value) as Created<object>;
605605

606606
//Assert
@@ -614,7 +614,7 @@ public void Created_WithNullUriAndValue_SetsLocationNull()
614614
//Arrange
615615
object value = new { };
616616

617-
// Act
617+
// Act
618618
var result = Results.Created(default(Uri), value) as Created<object>;
619619

620620
//Assert
@@ -737,7 +737,7 @@ public void Json_WithAllArgs_ResultHasCorrectValues()
737737
var options = new JsonSerializerOptions();
738738
var contentType = "application/custom+json";
739739
var statusCode = StatusCodes.Status208AlreadyReported;
740-
740+
741741
// Act
742742
var result = Results.Json(data, options, contentType, statusCode) as JsonHttpResult<object>;
743743

src/Http/Routing/src/LinkGeneratorEndpointNameAddressExtensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System.Diagnostics.CodeAnalysis;
55
using Microsoft.AspNetCore.Http;
6+
using Microsoft.AspNetCore.Internal;
67

78
namespace Microsoft.AspNetCore.Routing;
89

src/Http/Routing/src/LinkGeneratorRouteValuesAddressExtensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System.Diagnostics.CodeAnalysis;
55
using Microsoft.AspNetCore.Http;
6+
using Microsoft.AspNetCore.Internal;
67

78
namespace Microsoft.AspNetCore.Routing;
89

src/Http/Routing/src/Microsoft.AspNetCore.Routing.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
<Compile Include="$(SharedSourceRoot)RoutingMetadata\AcceptsMetadata.cs" LinkBase="Shared" />
3434
<Compile Include="$(SharedSourceRoot)Json\JsonSerializerExtensions.cs" LinkBase="Shared"/>
3535
<Compile Include="$(SharedSourceRoot)RouteHandlers\ExecuteHandlerHelper.cs" LinkBase="Shared"/>
36+
<Compile Include="$(SharedSourceRoot)RouteValueDictionaryTrimmerWarning.cs" LinkBase="Shared" />
3637
</ItemGroup>
3738

3839
<ItemGroup>

src/Http/Routing/src/Patterns/RoutePatternFactory.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Collections.ObjectModel;
66
using System.Diagnostics.CodeAnalysis;
77
using System.Linq;
8+
using Microsoft.AspNetCore.Internal;
89
using Microsoft.AspNetCore.Routing.Constraints;
910

1011
namespace Microsoft.AspNetCore.Routing.Patterns;

src/Http/Routing/src/RouteValueDictionaryTrimmerWarning.cs

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/Http/Http.Results/src/RouteValueDictionaryTrimmerWarning.cs renamed to src/Shared/RouteValueDictionaryTrimmerWarning.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
namespace Microsoft.AspNetCore.Routing;
4+
namespace Microsoft.AspNetCore.Internal;
55

66
internal static class RouteValueDictionaryTrimmerWarning
77
{

0 commit comments

Comments
 (0)