Skip to content

Commit 93634cd

Browse files
pranavkmJamesNK
andauthored
Follow ups for nullable (#23736)
* Follow ups for nullable * Update src/Http/Routing/src/Matching/DfaMatcherBuilder.cs Co-authored-by: James Newton-King <[email protected]> Co-authored-by: James Newton-King <[email protected]>
1 parent 380a567 commit 93634cd

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/Http/Routing/src/Matching/DfaMatcherBuilder.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,9 @@ public DfaNode BuildDfaTree(bool includeLabel = false)
247247
}
248248
}
249249

250-
AddLiteralNode(includeLabel, nextParents, parent, requiredValue.ToString());
250+
var literalValue = requiredValue?.ToString() ?? throw new InvalidOperationException($"Required value for literal '{parameterPart.Name}' must evaluate to a non-null string.");
251+
252+
AddLiteralNode(includeLabel, nextParents, parent, literalValue);
251253
}
252254
else if (segment.IsSimple && parameterPart != null)
253255
{
@@ -353,7 +355,7 @@ private static int GetPrecedenceDigitAtDepth(RouteEndpoint endpoint, int depth)
353355
if (segment is null)
354356
{
355357
// Treat "no segment" as high priority. it won't effect the algorithm, but we need to define a sort-order.
356-
return 0;
358+
return 0;
357359
}
358360

359361
return RoutePrecedence.ComputeInboundPrecedenceDigit(endpoint.RoutePattern, segment);
@@ -741,7 +743,7 @@ private void ApplyPolicies(DfaNode node)
741743
{
742744
var nodeBuilder = _nodeBuilders[i];
743745

744-
// Build a list of each
746+
// Build a list of each
745747
List<DfaNode> nextWork;
746748
if (previousWork == null)
747749
{

src/Security/Authorization/Core/src/AuthorizationServiceCollectionExtensions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ public static IServiceCollection AddAuthorizationCore(this IServiceCollection se
5151
throw new ArgumentNullException(nameof(services));
5252
}
5353

54+
if (configure == null)
55+
{
56+
throw new ArgumentNullException(nameof(configure));
57+
}
58+
5459
services.Configure(configure);
5560
return services.AddAuthorizationCore();
5661
}

0 commit comments

Comments
 (0)