diff --git a/eng/PatchConfig.props b/eng/PatchConfig.props index c44676b170..97027e2767 100644 --- a/eng/PatchConfig.props +++ b/eng/PatchConfig.props @@ -43,7 +43,13 @@ Later on, this will be checked using this condition: Microsoft.AspNetCore.AspNetCoreModule; Microsoft.AspNetCore.AspNetCoreModuleV2; + Microsoft.AspNetCore.Identity.UI; java:signalr; + Microsoft.AspNetCore.Mvc.Core; + Microsoft.AspNetCore.Mvc.RazorPages; + Microsoft.AspNetCore.AzureAppServicesIntegration; + Microsoft.AspNetCore.AzureAppServices.HostingStartup; + Microsoft.AspNetCore.AzureAppServices.SiteExtension; diff --git a/src/Mvc/Mvc.Core/src/MvcCoreLoggerExtensions.cs b/src/Mvc/Mvc.Core/src/MvcCoreLoggerExtensions.cs index 65e56e1ef5..165d3ab90c 100644 --- a/src/Mvc/Mvc.Core/src/MvcCoreLoggerExtensions.cs +++ b/src/Mvc/Mvc.Core/src/MvcCoreLoggerExtensions.cs @@ -31,6 +31,7 @@ namespace Microsoft.AspNetCore.Mvc private static readonly double TimestampToTicks = TimeSpan.TicksPerSecond / (double)Stopwatch.Frequency; private static readonly Action _actionExecuting; + private static readonly Action _controllerActionExecuting; private static readonly Action _actionExecuted; private static readonly Action _pageExecuting; @@ -41,7 +42,7 @@ namespace Microsoft.AspNetCore.Mvc private static readonly Action _contentResultExecuting; private static readonly Action _actionMethodExecuting; - private static readonly Action _actionMethodExecutingWithArguments; + private static readonly Action _actionMethodExecutingWithArguments; private static readonly Action _actionMethodExecuted; private static readonly Action _logFilterExecutionPlan; @@ -159,6 +160,11 @@ namespace Microsoft.AspNetCore.Mvc new EventId(1, "ActionExecuting"), "Route matched with {RouteData}. Executing action {ActionName}"); + _controllerActionExecuting = LoggerMessage.Define( + LogLevel.Information, + new EventId(3, "ControllerActionExecuting"), + "Route matched with {RouteData}. Executing controller action with signature {MethodInfo} on controller {Controller} ({AssemblyName})."); + _actionExecuted = LoggerMessage.Define( LogLevel.Information, new EventId(2, "ActionExecuted"), @@ -189,10 +195,10 @@ namespace Microsoft.AspNetCore.Mvc new EventId(1, "ActionMethodExecuting"), "Executing action method {ActionName} - Validation state: {ValidationState}"); - _actionMethodExecutingWithArguments = LoggerMessage.Define( - LogLevel.Information, + _actionMethodExecutingWithArguments = LoggerMessage.Define( + LogLevel.Trace, new EventId(1, "ActionMethodExecutingWithArguments"), - "Executing action method {ActionName} with arguments ({Arguments}) - Validation state: {ValidationState}"); + "Executing action method {ActionName} with arguments ({Arguments})"); _actionMethodExecuted = LoggerMessage.Define( LogLevel.Information, @@ -713,13 +719,29 @@ namespace Microsoft.AspNetCore.Mvc stringBuilder.Append($"{routeKeys[i]} = \"{routeValues[i]}\", "); } } + if (action.RouteValues.TryGetValue("page", out var page) && page != null) { _pageExecuting(logger, stringBuilder.ToString(), action.DisplayName, null); } else { - _actionExecuting(logger, stringBuilder.ToString(), action.DisplayName, null); + if (action is ControllerActionDescriptor controllerActionDescriptor) + { + var controllerType = controllerActionDescriptor.ControllerTypeInfo.AsType(); + var controllerName = TypeNameHelper.GetTypeDisplayName(controllerType); + _controllerActionExecuting( + logger, + stringBuilder.ToString(), + controllerActionDescriptor.MethodInfo, + controllerName, + controllerType.Assembly.GetName().Name, + null); + } + else + { + _actionExecuting(logger, stringBuilder.ToString(), action.DisplayName, null); + } } } } @@ -858,21 +880,17 @@ namespace Microsoft.AspNetCore.Mvc var actionName = context.ActionDescriptor.DisplayName; var validationState = context.ModelState.ValidationState; + _actionMethodExecuting(logger, actionName, validationState, null); - string[] convertedArguments; - if (arguments == null) + if (arguments != null && logger.IsEnabled(LogLevel.Trace)) { - _actionMethodExecuting(logger, actionName, validationState, null); - } - else - { - convertedArguments = new string[arguments.Length]; + var convertedArguments = new string[arguments.Length]; for (var i = 0; i < arguments.Length; i++) { convertedArguments[i] = Convert.ToString(arguments[i]); } - _actionMethodExecutingWithArguments(logger, actionName, convertedArguments, validationState, null); + _actionMethodExecutingWithArguments(logger, actionName, convertedArguments, null); } } } diff --git a/src/Mvc/Mvc.RazorPages/src/PageLoggerExtensions.cs b/src/Mvc/Mvc.RazorPages/src/PageLoggerExtensions.cs index 9c965f3244..a48b9a744a 100644 --- a/src/Mvc/Mvc.RazorPages/src/PageLoggerExtensions.cs +++ b/src/Mvc/Mvc.RazorPages/src/PageLoggerExtensions.cs @@ -13,8 +13,9 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages { public const string PageFilter = "Page Filter"; - private static readonly Action _handlerMethodExecuting; + private static readonly Action _handlerMethodExecuting; private static readonly Action _implicitHandlerMethodExecuting; + private static readonly Action _handlerMethodExecutingWithArguments; private static readonly Action _handlerMethodExecuted; private static readonly Action _implicitHandlerMethodExecuted; private static readonly Action _pageFilterShortCircuit; @@ -26,10 +27,15 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages { // These numbers start at 101 intentionally to avoid conflict with the IDs used by ResourceInvoker. - _handlerMethodExecuting = LoggerMessage.Define( + _handlerMethodExecuting = LoggerMessage.Define( LogLevel.Information, new EventId(101, "ExecutingHandlerMethod"), - "Executing handler method {HandlerName} with arguments ({Arguments}) - ModelState is {ValidationState}"); + "Executing handler method {HandlerName} - ModelState is {ValidationState}"); + + _handlerMethodExecutingWithArguments = LoggerMessage.Define( + LogLevel.Trace, + new EventId(103, "HandlerMethodExecutingWithArguments"), + "Executing handler method {HandlerName} with arguments ({Arguments})"); _handlerMethodExecuted = LoggerMessage.Define( LogLevel.Information, @@ -73,23 +79,19 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages { var handlerName = handler.MethodInfo.DeclaringType.FullName + "." + handler.MethodInfo.Name; - string[] convertedArguments; - if (arguments == null) + var validationState = context.ModelState.ValidationState; + _handlerMethodExecuting(logger, handlerName, validationState, null); + + if (arguments != null && logger.IsEnabled(LogLevel.Trace)) { - convertedArguments = null; - } - else - { - convertedArguments = new string[arguments.Length]; + var convertedArguments = new string[arguments.Length]; for (var i = 0; i < arguments.Length; i++) { convertedArguments[i] = Convert.ToString(arguments[i]); } + + _handlerMethodExecutingWithArguments(logger, handlerName, convertedArguments, null); } - - var validationState = context.ModelState.ValidationState; - - _handlerMethodExecuting(logger, handlerName, convertedArguments, validationState, null); } } diff --git a/src/Mvc/benchmarkapps/BasicViews/BasicViews.csproj b/src/Mvc/benchmarkapps/BasicViews/BasicViews.csproj index 6cb22ad18a..359adaace7 100644 --- a/src/Mvc/benchmarkapps/BasicViews/BasicViews.csproj +++ b/src/Mvc/benchmarkapps/BasicViews/BasicViews.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.0 $(BenchmarksTargetFramework) diff --git a/src/Mvc/shared/Mvc.Views.TestCommon/Microsoft.AspNetCore.Mvc.Views.TestCommon.csproj b/src/Mvc/shared/Mvc.Views.TestCommon/Microsoft.AspNetCore.Mvc.Views.TestCommon.csproj index e91f1684ff..3cfcc41982 100644 --- a/src/Mvc/shared/Mvc.Views.TestCommon/Microsoft.AspNetCore.Mvc.Views.TestCommon.csproj +++ b/src/Mvc/shared/Mvc.Views.TestCommon/Microsoft.AspNetCore.Mvc.Views.TestCommon.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.0 diff --git a/src/Mvc/test/WebSites/ApplicationModelWebSite/ApplicationModelWebSite.csproj b/src/Mvc/test/WebSites/ApplicationModelWebSite/ApplicationModelWebSite.csproj index 63b09ef8fa..7efc319231 100644 --- a/src/Mvc/test/WebSites/ApplicationModelWebSite/ApplicationModelWebSite.csproj +++ b/src/Mvc/test/WebSites/ApplicationModelWebSite/ApplicationModelWebSite.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.0 @@ -7,7 +7,6 @@ - diff --git a/src/Mvc/test/WebSites/RazorBuildWebSite/RazorBuildWebSite.csproj b/src/Mvc/test/WebSites/RazorBuildWebSite/RazorBuildWebSite.csproj index 77bed0b15f..2f74444d93 100644 --- a/src/Mvc/test/WebSites/RazorBuildWebSite/RazorBuildWebSite.csproj +++ b/src/Mvc/test/WebSites/RazorBuildWebSite/RazorBuildWebSite.csproj @@ -19,7 +19,6 @@ - diff --git a/src/Mvc/test/WebSites/RazorPagesWebSite/RazorPagesWebSite.csproj b/src/Mvc/test/WebSites/RazorPagesWebSite/RazorPagesWebSite.csproj index a7ccaf6ebf..70dfc9e4c9 100644 --- a/src/Mvc/test/WebSites/RazorPagesWebSite/RazorPagesWebSite.csproj +++ b/src/Mvc/test/WebSites/RazorPagesWebSite/RazorPagesWebSite.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.0 diff --git a/src/Mvc/test/WebSites/TagHelpersWebSite/TagHelpersWebSite.csproj b/src/Mvc/test/WebSites/TagHelpersWebSite/TagHelpersWebSite.csproj index 4717009c54..35ca43b4bb 100644 --- a/src/Mvc/test/WebSites/TagHelpersWebSite/TagHelpersWebSite.csproj +++ b/src/Mvc/test/WebSites/TagHelpersWebSite/TagHelpersWebSite.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.0 @@ -8,7 +8,6 @@ - diff --git a/src/PackageArchive/Archive.CiServer.Patch.Compat/ArchiveBaseline.2.1.10.txt b/src/PackageArchive/Archive.CiServer.Patch.Compat/ArchiveBaseline.2.1.10.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/PackageArchive/Archive.CiServer.Patch.Compat/ArchiveBaseline.2.2.4.txt b/src/PackageArchive/Archive.CiServer.Patch.Compat/ArchiveBaseline.2.2.4.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/PackageArchive/Archive.CiServer.Patch/ArchiveBaseline.2.1.10.txt b/src/PackageArchive/Archive.CiServer.Patch/ArchiveBaseline.2.1.10.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/PackageArchive/Archive.CiServer.Patch/ArchiveBaseline.2.2.4.txt b/src/PackageArchive/Archive.CiServer.Patch/ArchiveBaseline.2.2.4.txt new file mode 100644 index 0000000000..e69de29bb2