Description
Is your feature request related to a problem? Please describe.
ObjectResultExecutor
gives potentially misleading log. Specifically "ObjectResultExecuting"
is define in MvcCoreLoggerExtensions
as follows:
Executing ObjectResult, writing value of type '{Type}'.
The misleading part is when a controller returns, for example, a NotFoundObjectResult(string)
or an OkObjectResult(string)
. The logs look like this in either case:
[Information] Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor: Executing ObjectResult, writing value of type 'System.String'.
Describe the solution you'd like
My suggestion is to output the declared runtime/real/concrete type of ObjectResult
along the lines of
Executing {ConcreteObjectResultType}, writing value of type '{Type}'.
The above message is more useful because
- It provides more detail as to what happened.
- It does not leak implementation details of
NotFoundObjectResult
.
Additional context
Of course, there are other ways to discover the same information (such as the Status Code) so this issue is not critical. Another point against this issue is that the ControllerActionInvoker
does specify the runtime type of ActionResult
.