Skip to content

Commit 1aa50fa

Browse files
pranavkmmkArtakMSFT
authored andcommitted
Account for null Endpoint
1 parent f2ee320 commit 1aa50fa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Security/Authorization/Policy/src/AuthorizationMiddleware.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public async Task Invoke(HttpContext context)
4747
var endpoint = context.GetEndpoint();
4848

4949
// Workaround for https://github.com/aspnet/AspNetCore/issues/7011. Do not use the AuthorizationMiddleware for Razor Pages
50-
if (endpoint.Metadata.Any(m => m.GetType().FullName == "Microsoft.AspNetCore.Mvc.ApplicationModels.PageRouteMetadata"))
50+
if (endpoint != null && endpoint.Metadata.Any(m => m.GetType().FullName == "Microsoft.AspNetCore.Mvc.ApplicationModels.PageRouteMetadata"))
5151
{
5252
await _next(context);
5353
return;

0 commit comments

Comments
 (0)