Add asserts to DiagnosticSource

This commit is contained in:
Ryan Nowak 2016-05-13 13:38:51 -07:00
parent 6dbc808fde
commit 51e133ab9f
2 changed files with 148 additions and 13 deletions

View File

@ -262,24 +262,24 @@ namespace Microsoft.AspNetCore.Mvc.Internal
await item.FilterAsync.OnResourceExecutionAsync(_resourceExecutingContext, InvokeResourceFilterAwaitedAsync); await item.FilterAsync.OnResourceExecutionAsync(_resourceExecutingContext, InvokeResourceFilterAwaitedAsync);
_diagnosticSource.AfterOnResourceExecution(_resourceExecutedContext, item.FilterAsync);
if (_resourceExecutedContext == null) if (_resourceExecutedContext == null)
{ {
// If we get here then the filter didn't call 'next' indicating a short circuit // If we get here then the filter didn't call 'next' indicating a short circuit
if (_resourceExecutingContext.Result != null)
{
Logger.ResourceFilterShortCircuited(item.FilterAsync);
await InvokeResultAsync(_resourceExecutingContext.Result);
}
_resourceExecutedContext = new ResourceExecutedContext(_resourceExecutingContext, _filters) _resourceExecutedContext = new ResourceExecutedContext(_resourceExecutingContext, _filters)
{ {
Canceled = true, Canceled = true,
Result = _resourceExecutingContext.Result, Result = _resourceExecutingContext.Result,
}; };
} }
_diagnosticSource.AfterOnResourceExecution(_resourceExecutedContext, item.FilterAsync);
if (_resourceExecutingContext.Result != null)
{
Logger.ResourceFilterShortCircuited(item.FilterAsync);
await InvokeResultAsync(_resourceExecutingContext.Result);
}
} }
else if (item.Filter != null) else if (item.Filter != null)
{ {
@ -509,8 +509,6 @@ namespace Microsoft.AspNetCore.Mvc.Internal
await item.FilterAsync.OnActionExecutionAsync(_actionExecutingContext, InvokeActionFilterAwaitedAsync); await item.FilterAsync.OnActionExecutionAsync(_actionExecutingContext, InvokeActionFilterAwaitedAsync);
_diagnosticSource.AfterOnActionExecution(_actionExecutedContext, item.FilterAsync);
if (_actionExecutedContext == null) if (_actionExecutedContext == null)
{ {
// If we get here then the filter didn't call 'next' indicating a short circuit // If we get here then the filter didn't call 'next' indicating a short circuit
@ -525,6 +523,8 @@ namespace Microsoft.AspNetCore.Mvc.Internal
Result = _actionExecutingContext.Result, Result = _actionExecutingContext.Result,
}; };
} }
_diagnosticSource.AfterOnActionExecution(_actionExecutedContext, item.FilterAsync);
} }
else if (item.Filter != null) else if (item.Filter != null)
{ {
@ -665,8 +665,6 @@ namespace Microsoft.AspNetCore.Mvc.Internal
await item.FilterAsync.OnResultExecutionAsync(_resultExecutingContext, InvokeResultFilterAwaitedAsync); await item.FilterAsync.OnResultExecutionAsync(_resultExecutingContext, InvokeResultFilterAwaitedAsync);
_diagnosticSource.AfterOnResultExecution(_resultExecutedContext, item.FilterAsync);
if (_resultExecutedContext == null || _resultExecutingContext.Cancel == true) if (_resultExecutedContext == null || _resultExecutingContext.Cancel == true)
{ {
// Short-circuited by not calling next || Short-circuited by setting Cancel == true // Short-circuited by not calling next || Short-circuited by setting Cancel == true
@ -681,6 +679,8 @@ namespace Microsoft.AspNetCore.Mvc.Internal
Canceled = true, Canceled = true,
}; };
} }
_diagnosticSource.AfterOnResultExecution(_resultExecutedContext, item.FilterAsync);
} }
else if (item.Filter != null) else if (item.Filter != null)
{ {

View File

@ -10,6 +10,9 @@ using Microsoft.AspNetCore.Routing;
namespace Microsoft.AspNetCore.Mvc.Internal namespace Microsoft.AspNetCore.Mvc.Internal
{ {
// We're doing a lot of asserts here because these methods are really tedious to test and
// highly dependent on the details of the invoker's state machine. Basically if we wrote the
// obvious unit tests that would generate a lot of boilerplate and wouldn't cover the hard parts.
public static class MvcCoreDiagnosticSourceExtensions public static class MvcCoreDiagnosticSourceExtensions
{ {
public static void BeforeAction( public static void BeforeAction(
@ -18,6 +21,11 @@ namespace Microsoft.AspNetCore.Mvc.Internal
HttpContext httpContext, HttpContext httpContext,
RouteData routeData) RouteData routeData)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(actionDescriptor != null);
Debug.Assert(httpContext != null);
Debug.Assert(routeData != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeAction")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeAction"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -32,6 +40,11 @@ namespace Microsoft.AspNetCore.Mvc.Internal
HttpContext httpContext, HttpContext httpContext,
RouteData routeData) RouteData routeData)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(actionDescriptor != null);
Debug.Assert(httpContext != null);
Debug.Assert(routeData != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterAction")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterAction"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -45,6 +58,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
AuthorizationFilterContext authorizationContext, AuthorizationFilterContext authorizationContext,
IAsyncAuthorizationFilter filter) IAsyncAuthorizationFilter filter)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(authorizationContext != null);
Debug.Assert(filter != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnAuthorization")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnAuthorization"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -63,6 +80,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
AuthorizationFilterContext authorizationContext, AuthorizationFilterContext authorizationContext,
IAsyncAuthorizationFilter filter) IAsyncAuthorizationFilter filter)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(authorizationContext != null);
Debug.Assert(filter != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnAuthorization")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnAuthorization"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -81,6 +102,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
AuthorizationFilterContext authorizationContext, AuthorizationFilterContext authorizationContext,
IAuthorizationFilter filter) IAuthorizationFilter filter)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(authorizationContext != null);
Debug.Assert(filter != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnAuthorization")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnAuthorization"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -99,6 +124,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
AuthorizationFilterContext authorizationContext, AuthorizationFilterContext authorizationContext,
IAuthorizationFilter filter) IAuthorizationFilter filter)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(authorizationContext != null);
Debug.Assert(filter != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnAuthorization")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnAuthorization"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -117,6 +146,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
ResourceExecutingContext resourceExecutingContext, ResourceExecutingContext resourceExecutingContext,
IAsyncResourceFilter filter) IAsyncResourceFilter filter)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(resourceExecutingContext != null);
Debug.Assert(filter != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResourceExecution")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResourceExecution"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -135,6 +168,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
ResourceExecutedContext resourceExecutedContext, ResourceExecutedContext resourceExecutedContext,
IAsyncResourceFilter filter) IAsyncResourceFilter filter)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(resourceExecutedContext != null);
Debug.Assert(filter != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResourceExecution")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResourceExecution"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -153,6 +190,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
ResourceExecutingContext resourceExecutingContext, ResourceExecutingContext resourceExecutingContext,
IResourceFilter filter) IResourceFilter filter)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(resourceExecutingContext != null);
Debug.Assert(filter != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuting")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuting"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -171,6 +212,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
ResourceExecutingContext resourceExecutingContext, ResourceExecutingContext resourceExecutingContext,
IResourceFilter filter) IResourceFilter filter)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(resourceExecutingContext != null);
Debug.Assert(filter != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResourceExecuting")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResourceExecuting"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -189,6 +234,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
ResourceExecutedContext resourceExecutedContext, ResourceExecutedContext resourceExecutedContext,
IResourceFilter filter) IResourceFilter filter)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(resourceExecutedContext != null);
Debug.Assert(filter != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuted")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuted"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -207,6 +256,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
ResourceExecutedContext resourceExecutedContext, ResourceExecutedContext resourceExecutedContext,
IResourceFilter filter) IResourceFilter filter)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(resourceExecutedContext != null);
Debug.Assert(filter != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResourceExecuted")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResourceExecuted"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -225,6 +278,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
ExceptionContext exceptionContext, ExceptionContext exceptionContext,
IAsyncExceptionFilter filter) IAsyncExceptionFilter filter)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(exceptionContext != null);
Debug.Assert(filter != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnException")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnException"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -243,6 +300,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
ExceptionContext exceptionContext, ExceptionContext exceptionContext,
IAsyncExceptionFilter filter) IAsyncExceptionFilter filter)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(exceptionContext != null);
Debug.Assert(filter != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnException")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnException"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -261,6 +322,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
ExceptionContext exceptionContext, ExceptionContext exceptionContext,
IExceptionFilter filter) IExceptionFilter filter)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(exceptionContext != null);
Debug.Assert(filter != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnException")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnException"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -279,6 +344,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
ExceptionContext exceptionContext, ExceptionContext exceptionContext,
IExceptionFilter filter) IExceptionFilter filter)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(exceptionContext != null);
Debug.Assert(filter != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnException")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnException"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -297,6 +366,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
ActionExecutingContext actionExecutingContext, ActionExecutingContext actionExecutingContext,
IAsyncActionFilter filter) IAsyncActionFilter filter)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(actionExecutingContext != null);
Debug.Assert(filter != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnActionExecution")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnActionExecution"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -315,6 +388,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
ActionExecutedContext actionExecutedContext, ActionExecutedContext actionExecutedContext,
IAsyncActionFilter filter) IAsyncActionFilter filter)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(actionExecutedContext != null);
Debug.Assert(filter != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnActionExecution")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnActionExecution"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -333,6 +410,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
ActionExecutingContext actionExecutingContext, ActionExecutingContext actionExecutingContext,
IActionFilter filter) IActionFilter filter)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(actionExecutingContext != null);
Debug.Assert(filter != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnActionExecuting")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnActionExecuting"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -351,6 +432,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
ActionExecutingContext actionExecutingContext, ActionExecutingContext actionExecutingContext,
IActionFilter filter) IActionFilter filter)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(actionExecutingContext != null);
Debug.Assert(filter != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnActionExecuting")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnActionExecuting"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -369,6 +454,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
ActionExecutedContext actionExecutedContext, ActionExecutedContext actionExecutedContext,
IActionFilter filter) IActionFilter filter)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(actionExecutedContext != null);
Debug.Assert(filter != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnActionExecuted")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnActionExecuted"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -387,6 +476,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
ActionExecutedContext actionExecutedContext, ActionExecutedContext actionExecutedContext,
IActionFilter filter) IActionFilter filter)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(actionExecutedContext != null);
Debug.Assert(filter != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnActionExecuted")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnActionExecuted"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -406,6 +499,11 @@ namespace Microsoft.AspNetCore.Mvc.Internal
IDictionary<string, object> actionArguments, IDictionary<string, object> actionArguments,
object controller) object controller)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(actionContext != null);
Debug.Assert(actionArguments != null);
Debug.Assert(controller != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeActionMethod")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeActionMethod"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -426,6 +524,11 @@ namespace Microsoft.AspNetCore.Mvc.Internal
object controller, object controller,
IActionResult result) IActionResult result)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(actionContext != null);
Debug.Assert(actionArguments != null);
Debug.Assert(controller != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterActionMethod")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterActionMethod"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -445,6 +548,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
ResultExecutingContext resultExecutingContext, ResultExecutingContext resultExecutingContext,
IAsyncResultFilter filter) IAsyncResultFilter filter)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(resultExecutingContext != null);
Debug.Assert(filter != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResultExecution")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResultExecution"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -463,6 +570,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
ResultExecutedContext resultExecutedContext, ResultExecutedContext resultExecutedContext,
IAsyncResultFilter filter) IAsyncResultFilter filter)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(resultExecutedContext != null);
Debug.Assert(filter != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResultExecution")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResultExecution"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -481,6 +592,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
ResultExecutingContext resultExecutingContext, ResultExecutingContext resultExecutingContext,
IResultFilter filter) IResultFilter filter)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(resultExecutingContext != null);
Debug.Assert(filter != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResultExecuting")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResultExecuting"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -499,6 +614,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
ResultExecutingContext resultExecutingContext, ResultExecutingContext resultExecutingContext,
IResultFilter filter) IResultFilter filter)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(resultExecutingContext != null);
Debug.Assert(filter != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResultExecuting")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResultExecuting"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -517,6 +636,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
ResultExecutedContext resultExecutedContext, ResultExecutedContext resultExecutedContext,
IResultFilter filter) IResultFilter filter)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(resultExecutedContext != null);
Debug.Assert(filter != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResultExecuted")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResultExecuted"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -535,6 +658,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
ResultExecutedContext resultExecutedContext, ResultExecutedContext resultExecutedContext,
IResultFilter filter) IResultFilter filter)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(resultExecutedContext != null);
Debug.Assert(filter != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResultExecuted")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResultExecuted"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -553,6 +680,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
ActionContext actionContext, ActionContext actionContext,
IActionResult result) IActionResult result)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(actionContext != null);
Debug.Assert(result != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeActionResult")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeActionResult"))
{ {
diagnosticSource.Write( diagnosticSource.Write(
@ -566,6 +697,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
ActionContext actionContext, ActionContext actionContext,
IActionResult result) IActionResult result)
{ {
Debug.Assert(diagnosticSource != null);
Debug.Assert(actionContext != null);
Debug.Assert(result != null);
if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterActionResult")) if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterActionResult"))
{ {
diagnosticSource.Write( diagnosticSource.Write(