ObjectResultExecutor could output a clearer log w.r.t the concrete type of ObjectResult #21393
Labels
area-mvc
Includes: MVC, Actions and Controllers, Localization, CORS, most templates
Done
This issue has been fixed
enhancement
This issue represents an ask for new feature or an enhancement to an existing one
good first issue
Good for newcomers.
Milestone
Is your feature request related to a problem? Please describe.
ObjectResultExecutor
gives potentially misleading log. Specifically"ObjectResultExecuting"
is define inMvcCoreLoggerExtensions
as follows:Executing ObjectResult, writing value of type '{Type}'.
The misleading part is when a controller returns, for example, a
NotFoundObjectResult(string)
or anOkObjectResult(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 ofExecuting {ConcreteObjectResultType}, writing value of type '{Type}'.
The above message is more useful because
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 ofActionResult
.The text was updated successfully, but these errors were encountered: