Prevent KeyNotFound when logging

This commit is contained in:
Pranav K 2018-05-07 10:45:54 -07:00
parent 4e97bfe957
commit f35deb71f9
1 changed files with 1 additions and 1 deletions

View File

@ -695,7 +695,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
stringBuilder.Append($"{routeKeys[i]} = \"{routeValues[i]}\", ");
}
}
if (action.RouteValues["page"] != null)
if (action.RouteValues.TryGetValue("page", out var page) && page != null)
{
_pageExecuting(logger, stringBuilder.ToString(), action.DisplayName, null);
}