[Fixes #3279] Added DiagnosticSource for filters
This commit is contained in:
parent
624c918de5
commit
b6d7012c27
|
|
@ -8,6 +8,7 @@ using System.Runtime.ExceptionServices;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Mvc.Abstractions;
|
using Microsoft.AspNet.Mvc.Abstractions;
|
||||||
using Microsoft.AspNet.Mvc.Core;
|
using Microsoft.AspNet.Mvc.Core;
|
||||||
|
using Microsoft.AspNet.Mvc.Diagnostics;
|
||||||
using Microsoft.AspNet.Mvc.Filters;
|
using Microsoft.AspNet.Mvc.Filters;
|
||||||
using Microsoft.AspNet.Mvc.Formatters;
|
using Microsoft.AspNet.Mvc.Formatters;
|
||||||
using Microsoft.AspNet.Mvc.Infrastructure;
|
using Microsoft.AspNet.Mvc.Infrastructure;
|
||||||
|
|
@ -288,8 +289,16 @@ namespace Microsoft.AspNet.Mvc.Controllers
|
||||||
var current = _cursor.GetNextFilter<IAuthorizationFilter, IAsyncAuthorizationFilter>();
|
var current = _cursor.GetNextFilter<IAuthorizationFilter, IAsyncAuthorizationFilter>();
|
||||||
if (current.FilterAsync != null)
|
if (current.FilterAsync != null)
|
||||||
{
|
{
|
||||||
|
_diagnosticSource.BeforeOnAuthorizationAsync(
|
||||||
|
_authorizationContext,
|
||||||
|
current.FilterAsync);
|
||||||
|
|
||||||
await current.FilterAsync.OnAuthorizationAsync(_authorizationContext);
|
await current.FilterAsync.OnAuthorizationAsync(_authorizationContext);
|
||||||
|
|
||||||
|
_diagnosticSource.AfterOnAuthorizationAsync(
|
||||||
|
_authorizationContext,
|
||||||
|
current.FilterAsync);
|
||||||
|
|
||||||
if (_authorizationContext.Result == null)
|
if (_authorizationContext.Result == null)
|
||||||
{
|
{
|
||||||
// Only keep going if we don't have a result
|
// Only keep going if we don't have a result
|
||||||
|
|
@ -302,8 +311,16 @@ namespace Microsoft.AspNet.Mvc.Controllers
|
||||||
}
|
}
|
||||||
else if (current.Filter != null)
|
else if (current.Filter != null)
|
||||||
{
|
{
|
||||||
|
_diagnosticSource.BeforeOnAuthorization(
|
||||||
|
_authorizationContext,
|
||||||
|
current.Filter);
|
||||||
|
|
||||||
current.Filter.OnAuthorization(_authorizationContext);
|
current.Filter.OnAuthorization(_authorizationContext);
|
||||||
|
|
||||||
|
_diagnosticSource.AfterOnAuthorization(
|
||||||
|
_authorizationContext,
|
||||||
|
current.Filter);
|
||||||
|
|
||||||
if (_authorizationContext.Result == null)
|
if (_authorizationContext.Result == null)
|
||||||
{
|
{
|
||||||
// Only keep going if we don't have a result
|
// Only keep going if we don't have a result
|
||||||
|
|
@ -358,10 +375,19 @@ namespace Microsoft.AspNet.Mvc.Controllers
|
||||||
{
|
{
|
||||||
if (item.FilterAsync != null)
|
if (item.FilterAsync != null)
|
||||||
{
|
{
|
||||||
|
_diagnosticSource.BeforeOnResourceExecution(
|
||||||
|
_resourceExecutingContext,
|
||||||
|
item.FilterAsync);
|
||||||
|
|
||||||
await item.FilterAsync.OnResourceExecutionAsync(
|
await item.FilterAsync.OnResourceExecutionAsync(
|
||||||
_resourceExecutingContext,
|
_resourceExecutingContext,
|
||||||
InvokeResourceFilterAsync);
|
InvokeResourceFilterAsync);
|
||||||
|
|
||||||
|
_diagnosticSource.AfterOnResourceExecution(
|
||||||
|
_resourceExecutingContext.ActionDescriptor,
|
||||||
|
_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
|
||||||
|
|
@ -383,8 +409,16 @@ namespace Microsoft.AspNet.Mvc.Controllers
|
||||||
}
|
}
|
||||||
else if (item.Filter != null)
|
else if (item.Filter != null)
|
||||||
{
|
{
|
||||||
|
_diagnosticSource.BeforeOnResourceExecuting(
|
||||||
|
_resourceExecutingContext,
|
||||||
|
item.Filter);
|
||||||
|
|
||||||
item.Filter.OnResourceExecuting(_resourceExecutingContext);
|
item.Filter.OnResourceExecuting(_resourceExecutingContext);
|
||||||
|
|
||||||
|
_diagnosticSource.AfterOnResourceExecuting(
|
||||||
|
_resourceExecutingContext,
|
||||||
|
item.Filter);
|
||||||
|
|
||||||
if (_resourceExecutingContext.Result != null)
|
if (_resourceExecutingContext.Result != null)
|
||||||
{
|
{
|
||||||
// Short-circuited by setting a result.
|
// Short-circuited by setting a result.
|
||||||
|
|
@ -400,7 +434,17 @@ namespace Microsoft.AspNet.Mvc.Controllers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
_diagnosticSource.BeforeOnResourceExecuted(
|
||||||
|
_resourceExecutingContext.ActionDescriptor,
|
||||||
|
_resourceExecutedContext,
|
||||||
|
item.Filter);
|
||||||
|
|
||||||
item.Filter.OnResourceExecuted(await InvokeResourceFilterAsync());
|
item.Filter.OnResourceExecuted(await InvokeResourceFilterAsync());
|
||||||
|
|
||||||
|
_diagnosticSource.AfterOnResourceExecuted(
|
||||||
|
_resourceExecutingContext.ActionDescriptor,
|
||||||
|
_resourceExecutedContext,
|
||||||
|
item.Filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -500,10 +544,18 @@ namespace Microsoft.AspNet.Mvc.Controllers
|
||||||
Debug.Assert(_exceptionContext != null);
|
Debug.Assert(_exceptionContext != null);
|
||||||
if (_exceptionContext.Exception != null)
|
if (_exceptionContext.Exception != null)
|
||||||
{
|
{
|
||||||
|
_diagnosticSource.BeforeOnExceptionAsync(
|
||||||
|
_exceptionContext,
|
||||||
|
current.FilterAsync);
|
||||||
|
|
||||||
// Exception filters only run when there's an exception - unsetting it will short-circuit
|
// Exception filters only run when there's an exception - unsetting it will short-circuit
|
||||||
// other exception filters.
|
// other exception filters.
|
||||||
await current.FilterAsync.OnExceptionAsync(_exceptionContext);
|
await current.FilterAsync.OnExceptionAsync(_exceptionContext);
|
||||||
|
|
||||||
|
_diagnosticSource.AfterOnExceptionAsync(
|
||||||
|
_exceptionContext,
|
||||||
|
current.FilterAsync);
|
||||||
|
|
||||||
if (_exceptionContext.Exception == null)
|
if (_exceptionContext.Exception == null)
|
||||||
{
|
{
|
||||||
Logger.LogVerbose(
|
Logger.LogVerbose(
|
||||||
|
|
@ -521,10 +573,18 @@ namespace Microsoft.AspNet.Mvc.Controllers
|
||||||
Debug.Assert(_exceptionContext != null);
|
Debug.Assert(_exceptionContext != null);
|
||||||
if (_exceptionContext.Exception != null)
|
if (_exceptionContext.Exception != null)
|
||||||
{
|
{
|
||||||
|
_diagnosticSource.BeforeOnException(
|
||||||
|
_exceptionContext,
|
||||||
|
current.Filter);
|
||||||
|
|
||||||
// Exception filters only run when there's an exception - unsetting it will short-circuit
|
// Exception filters only run when there's an exception - unsetting it will short-circuit
|
||||||
// other exception filters.
|
// other exception filters.
|
||||||
current.Filter.OnException(_exceptionContext);
|
current.Filter.OnException(_exceptionContext);
|
||||||
|
|
||||||
|
_diagnosticSource.AfterOnException(
|
||||||
|
_exceptionContext,
|
||||||
|
current.Filter);
|
||||||
|
|
||||||
if (_exceptionContext.Exception == null)
|
if (_exceptionContext.Exception == null)
|
||||||
{
|
{
|
||||||
Logger.LogVerbose(
|
Logger.LogVerbose(
|
||||||
|
|
@ -602,8 +662,17 @@ namespace Microsoft.AspNet.Mvc.Controllers
|
||||||
{
|
{
|
||||||
if (item.FilterAsync != null)
|
if (item.FilterAsync != null)
|
||||||
{
|
{
|
||||||
|
_diagnosticSource.BeforeOnActionExecution(
|
||||||
|
_actionExecutingContext,
|
||||||
|
item.FilterAsync);
|
||||||
|
|
||||||
await item.FilterAsync.OnActionExecutionAsync(_actionExecutingContext, InvokeActionFilterAsync);
|
await item.FilterAsync.OnActionExecutionAsync(_actionExecutingContext, InvokeActionFilterAsync);
|
||||||
|
|
||||||
|
_diagnosticSource.AfterOnActionExecution(
|
||||||
|
_actionExecutingContext.ActionDescriptor,
|
||||||
|
_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
|
||||||
|
|
@ -622,8 +691,16 @@ namespace Microsoft.AspNet.Mvc.Controllers
|
||||||
}
|
}
|
||||||
else if (item.Filter != null)
|
else if (item.Filter != null)
|
||||||
{
|
{
|
||||||
|
_diagnosticSource.BeforeOnActionExecuting(
|
||||||
|
_actionExecutingContext,
|
||||||
|
item.Filter);
|
||||||
|
|
||||||
item.Filter.OnActionExecuting(_actionExecutingContext);
|
item.Filter.OnActionExecuting(_actionExecutingContext);
|
||||||
|
|
||||||
|
_diagnosticSource.AfterOnActionExecuting(
|
||||||
|
_actionExecutingContext,
|
||||||
|
item.Filter);
|
||||||
|
|
||||||
if (_actionExecutingContext.Result != null)
|
if (_actionExecutingContext.Result != null)
|
||||||
{
|
{
|
||||||
// Short-circuited by setting a result.
|
// Short-circuited by setting a result.
|
||||||
|
|
@ -641,7 +718,17 @@ namespace Microsoft.AspNet.Mvc.Controllers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
_diagnosticSource.BeforeOnActionExecuted(
|
||||||
|
_actionExecutingContext.ActionDescriptor,
|
||||||
|
_actionExecutedContext,
|
||||||
|
item.Filter);
|
||||||
|
|
||||||
item.Filter.OnActionExecuted(await InvokeActionFilterAsync());
|
item.Filter.OnActionExecuted(await InvokeActionFilterAsync());
|
||||||
|
|
||||||
|
_diagnosticSource.BeforeOnActionExecuted(
|
||||||
|
_actionExecutingContext.ActionDescriptor,
|
||||||
|
_actionExecutedContext,
|
||||||
|
item.Filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -651,34 +738,20 @@ namespace Microsoft.AspNet.Mvc.Controllers
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (_diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.BeforeActionMethod"))
|
_diagnosticSource.BeforeActionMethod(
|
||||||
{
|
ActionContext,
|
||||||
_diagnosticSource.Write(
|
_actionExecutingContext.ActionArguments,
|
||||||
"Microsoft.AspNet.Mvc.BeforeActionMethod",
|
_actionExecutingContext.Controller);
|
||||||
new
|
|
||||||
{
|
|
||||||
actionContext = ActionContext,
|
|
||||||
arguments = _actionExecutingContext.ActionArguments,
|
|
||||||
controller = _actionExecutingContext.Controller
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
result = await InvokeActionAsync(_actionExecutingContext);
|
result = await InvokeActionAsync(_actionExecutingContext);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (_diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.AfterActionMethod"))
|
_diagnosticSource.AfterActionMethod(
|
||||||
{
|
ActionContext,
|
||||||
_diagnosticSource.Write(
|
_actionExecutingContext.ActionArguments,
|
||||||
"Microsoft.AspNet.Mvc.AfterActionMethod",
|
_actionExecutingContext.Controller,
|
||||||
new
|
result);
|
||||||
{
|
|
||||||
actionContext = ActionContext,
|
|
||||||
arguments = _actionExecutingContext.ActionArguments,
|
|
||||||
controller = _actionExecutingContext.Controller,
|
|
||||||
result = result
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_actionExecutedContext = new ActionExecutedContext(
|
_actionExecutedContext = new ActionExecutedContext(
|
||||||
|
|
@ -747,8 +820,17 @@ namespace Microsoft.AspNet.Mvc.Controllers
|
||||||
var item = _cursor.GetNextFilter<IResultFilter, IAsyncResultFilter>();
|
var item = _cursor.GetNextFilter<IResultFilter, IAsyncResultFilter>();
|
||||||
if (item.FilterAsync != null)
|
if (item.FilterAsync != null)
|
||||||
{
|
{
|
||||||
|
_diagnosticSource.BeforeOnResultExecution(
|
||||||
|
_resultExecutingContext,
|
||||||
|
item.FilterAsync);
|
||||||
|
|
||||||
await item.FilterAsync.OnResultExecutionAsync(_resultExecutingContext, InvokeResultFilterAsync);
|
await item.FilterAsync.OnResultExecutionAsync(_resultExecutingContext, InvokeResultFilterAsync);
|
||||||
|
|
||||||
|
_diagnosticSource.AfterOnResultExecution(
|
||||||
|
_resultExecutingContext.ActionDescriptor,
|
||||||
|
_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
|
||||||
|
|
@ -766,8 +848,16 @@ namespace Microsoft.AspNet.Mvc.Controllers
|
||||||
}
|
}
|
||||||
else if (item.Filter != null)
|
else if (item.Filter != null)
|
||||||
{
|
{
|
||||||
|
_diagnosticSource.BeforeOnResultExecuting(
|
||||||
|
_resultExecutingContext,
|
||||||
|
item.Filter);
|
||||||
|
|
||||||
item.Filter.OnResultExecuting(_resultExecutingContext);
|
item.Filter.OnResultExecuting(_resultExecutingContext);
|
||||||
|
|
||||||
|
_diagnosticSource.AfterOnResultExecuting(
|
||||||
|
_resultExecutingContext,
|
||||||
|
item.Filter);
|
||||||
|
|
||||||
if (_resultExecutingContext.Cancel == true)
|
if (_resultExecutingContext.Cancel == true)
|
||||||
{
|
{
|
||||||
// Short-circuited by setting Cancel == true
|
// Short-circuited by setting Cancel == true
|
||||||
|
|
@ -784,7 +874,17 @@ namespace Microsoft.AspNet.Mvc.Controllers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
_diagnosticSource.BeforeOnResultExecuted(
|
||||||
|
_resultExecutingContext.ActionDescriptor,
|
||||||
|
_resultExecutedContext,
|
||||||
|
item.Filter);
|
||||||
|
|
||||||
item.Filter.OnResultExecuted(await InvokeResultFilterAsync());
|
item.Filter.OnResultExecuted(await InvokeResultFilterAsync());
|
||||||
|
|
||||||
|
_diagnosticSource.AfterOnResultExecuted(
|
||||||
|
_resultExecutingContext.ActionDescriptor,
|
||||||
|
_resultExecutedContext,
|
||||||
|
item.Filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -824,12 +924,7 @@ namespace Microsoft.AspNet.Mvc.Controllers
|
||||||
|
|
||||||
private async Task InvokeResultAsync(IActionResult result)
|
private async Task InvokeResultAsync(IActionResult result)
|
||||||
{
|
{
|
||||||
if (_diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.BeforeActionResult"))
|
_diagnosticSource.BeforeActionResult(ActionContext, result);
|
||||||
{
|
|
||||||
_diagnosticSource.Write(
|
|
||||||
"Microsoft.AspNet.Mvc.BeforeActionResult",
|
|
||||||
new { actionContext = ActionContext, result = result });
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -837,12 +932,7 @@ namespace Microsoft.AspNet.Mvc.Controllers
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (_diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.AfterActionResult"))
|
_diagnosticSource.AfterActionResult(ActionContext, result);
|
||||||
{
|
|
||||||
_diagnosticSource.Write(
|
|
||||||
"Microsoft.AspNet.Mvc.AfterActionResult",
|
|
||||||
new { actionContext = ActionContext, result = result });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,556 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using Microsoft.AspNet.Mvc.Abstractions;
|
||||||
|
using Microsoft.AspNet.Mvc.Filters;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNet.Mvc.Diagnostics
|
||||||
|
{
|
||||||
|
public static class FilterActionInvokerDiagnosticSourceExtensions
|
||||||
|
{
|
||||||
|
public static void BeforeOnAuthorizationAsync(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
AuthorizationContext authorizationContext,
|
||||||
|
IAsyncAuthorizationFilter filter)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.BeforeOnAuthorization"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.BeforeOnAuthorization",
|
||||||
|
new
|
||||||
|
{
|
||||||
|
actionDescriptor = authorizationContext.ActionDescriptor,
|
||||||
|
authorizationContext = authorizationContext,
|
||||||
|
filter = filter
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AfterOnAuthorizationAsync(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
AuthorizationContext authorizationContext,
|
||||||
|
IAsyncAuthorizationFilter filter)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.AfterOnAuthorization"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.AfterOnAuthorization",
|
||||||
|
new
|
||||||
|
{
|
||||||
|
actionDescriptor = authorizationContext.ActionDescriptor,
|
||||||
|
authorizationContext = authorizationContext,
|
||||||
|
filter = filter
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void BeforeOnAuthorization(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
AuthorizationContext authorizationContext,
|
||||||
|
IAuthorizationFilter filter)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.BeforeOnAuthorization"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.BeforeOnAuthorization",
|
||||||
|
new
|
||||||
|
{
|
||||||
|
actionDescriptor = authorizationContext.ActionDescriptor,
|
||||||
|
authorizationContext = authorizationContext,
|
||||||
|
filter = filter
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AfterOnAuthorization(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
AuthorizationContext authorizationContext,
|
||||||
|
IAuthorizationFilter filter)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.AfterOnAuthorization"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.AfterOnAuthorization",
|
||||||
|
new
|
||||||
|
{
|
||||||
|
actionDescriptor = authorizationContext.ActionDescriptor,
|
||||||
|
authorizationContext = authorizationContext,
|
||||||
|
filter = filter
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void BeforeOnResourceExecution(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
ResourceExecutingContext resourceExecutingContext,
|
||||||
|
IAsyncResourceFilter filter)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.BeforeOnResourceExecution"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.BeforeOnResourceExecution",
|
||||||
|
new
|
||||||
|
{
|
||||||
|
actionDescriptor = resourceExecutingContext.ActionDescriptor,
|
||||||
|
resourceExecutingContext = resourceExecutingContext,
|
||||||
|
filter = filter
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AfterOnResourceExecution(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
ActionDescriptor actionDescriptor,
|
||||||
|
ResourceExecutedContext resourceExecutedContext,
|
||||||
|
IAsyncResourceFilter filter)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.AfterOnResourceExecution"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.AfterOnResourceExecution",
|
||||||
|
new
|
||||||
|
{
|
||||||
|
actionDescriptor = actionDescriptor,
|
||||||
|
resourceExecutedContext = resourceExecutedContext,
|
||||||
|
filter = filter
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void BeforeOnResourceExecuting(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
ResourceExecutingContext resourceExecutingContext,
|
||||||
|
IResourceFilter filter)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.BeforeOnResourceExecuting"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.BeforeOnResourceExecuting",
|
||||||
|
new
|
||||||
|
{
|
||||||
|
actionDescriptor = resourceExecutingContext.ActionDescriptor,
|
||||||
|
resourceExecutingContext = resourceExecutingContext,
|
||||||
|
filter = filter
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AfterOnResourceExecuting(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
ResourceExecutingContext resourceExecutingContext,
|
||||||
|
IResourceFilter filter)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.AfterOnResourceExecuting"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.AfterOnResourceExecuting",
|
||||||
|
new
|
||||||
|
{
|
||||||
|
actionDescriptor = resourceExecutingContext.ActionDescriptor,
|
||||||
|
resourceExecutingContext = resourceExecutingContext,
|
||||||
|
filter = filter
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void BeforeOnResourceExecuted(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
ActionDescriptor actionDescriptor,
|
||||||
|
ResourceExecutedContext resourceExecutedContext,
|
||||||
|
IResourceFilter filter)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.BeforeOnResourceExecuted"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.BeforeOnResourceExecuted",
|
||||||
|
new
|
||||||
|
{
|
||||||
|
actionDescriptor = actionDescriptor,
|
||||||
|
resourceExecutedContext = resourceExecutedContext,
|
||||||
|
filter = filter
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AfterOnResourceExecuted(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
ActionDescriptor actionDescriptor,
|
||||||
|
ResourceExecutedContext resourceExecutedContext,
|
||||||
|
IResourceFilter filter)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.AfterOnResourceExecuted"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.AfterOnResourceExecuted",
|
||||||
|
new
|
||||||
|
{
|
||||||
|
actionDescriptor = actionDescriptor,
|
||||||
|
resourceExecutedContext = resourceExecutedContext,
|
||||||
|
filter = filter
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void BeforeOnExceptionAsync(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
ExceptionContext exceptionContext,
|
||||||
|
IAsyncExceptionFilter filter)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.BeforeOnException"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.BeforeOnException",
|
||||||
|
new
|
||||||
|
{
|
||||||
|
actionDescriptor = exceptionContext.ActionDescriptor,
|
||||||
|
exceptionContext = exceptionContext,
|
||||||
|
filter = filter
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AfterOnExceptionAsync(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
ExceptionContext exceptionContext,
|
||||||
|
IAsyncExceptionFilter filter)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.AfterOnException"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.AfterOnException",
|
||||||
|
new
|
||||||
|
{
|
||||||
|
actionDescriptor = exceptionContext.ActionDescriptor,
|
||||||
|
exceptionContext = exceptionContext,
|
||||||
|
filter = filter
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void BeforeOnException(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
ExceptionContext exceptionContext,
|
||||||
|
IExceptionFilter filter)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.BeforeOnException"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.BeforeOnException",
|
||||||
|
new
|
||||||
|
{
|
||||||
|
actionDescriptor = exceptionContext.ActionDescriptor,
|
||||||
|
exceptionContext = exceptionContext,
|
||||||
|
filter = filter
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AfterOnException(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
ExceptionContext exceptionContext,
|
||||||
|
IExceptionFilter filter)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.AfterOnException"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.AfterOnException",
|
||||||
|
new
|
||||||
|
{
|
||||||
|
actionDescriptor = exceptionContext.ActionDescriptor,
|
||||||
|
exceptionContext = exceptionContext,
|
||||||
|
filter = filter
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void BeforeOnActionExecution(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
ActionExecutingContext actionExecutingContext,
|
||||||
|
IAsyncActionFilter filter)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.BeforeOnActionExecution"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.BeforeOnActionExecution",
|
||||||
|
new
|
||||||
|
{
|
||||||
|
actionDescriptor = actionExecutingContext.ActionDescriptor,
|
||||||
|
actionExecutingContext = actionExecutingContext,
|
||||||
|
filter = filter
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AfterOnActionExecution(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
ActionDescriptor actionDescriptor,
|
||||||
|
ActionExecutedContext actionExecutedContext,
|
||||||
|
IAsyncActionFilter filter)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.AfterOnActionExecution"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.AfterOnActionExecution",
|
||||||
|
new
|
||||||
|
{
|
||||||
|
actionDescriptor = actionDescriptor,
|
||||||
|
actionExecutedContext = actionExecutedContext,
|
||||||
|
filter = filter
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void BeforeOnActionExecuting(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
ActionExecutingContext actionExecutingContext,
|
||||||
|
IActionFilter filter)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.BeforeOnActionExecuting"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.BeforeOnActionExecuting",
|
||||||
|
new
|
||||||
|
{
|
||||||
|
actionDescriptor = actionExecutingContext.ActionDescriptor,
|
||||||
|
actionExecutingContext = actionExecutingContext,
|
||||||
|
filter = filter
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AfterOnActionExecuting(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
ActionExecutingContext actionExecutingContext,
|
||||||
|
IActionFilter filter)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.AfterOnActionExecuting"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.AfterOnActionExecuting",
|
||||||
|
new
|
||||||
|
{
|
||||||
|
actionDescriptor = actionExecutingContext.ActionDescriptor,
|
||||||
|
actionExecutingContext = actionExecutingContext,
|
||||||
|
filter = filter
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void BeforeOnActionExecuted(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
ActionDescriptor actionDescriptor,
|
||||||
|
ActionExecutedContext actionExecutedContext,
|
||||||
|
IActionFilter filter)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.BeforeOnActionExecuted"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.BeforeOnActionExecuted",
|
||||||
|
new
|
||||||
|
{
|
||||||
|
actionDescriptor = actionDescriptor,
|
||||||
|
actionExecutedContext = actionExecutedContext,
|
||||||
|
filter = filter
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AfterOnActionExecuted(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
ActionDescriptor actionDescriptor,
|
||||||
|
ActionExecutedContext actionExecutedContext,
|
||||||
|
IActionFilter filter)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.AfterOnActionExecuted"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.AfterOnActionExecuted",
|
||||||
|
new
|
||||||
|
{
|
||||||
|
actionDescriptor = actionDescriptor,
|
||||||
|
actionExecutedContext = actionExecutedContext,
|
||||||
|
filter = filter
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void BeforeActionMethod(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
ActionContext actionContext,
|
||||||
|
IDictionary<string, object> actionArguments,
|
||||||
|
object controller)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.BeforeActionMethod"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.BeforeActionMethod",
|
||||||
|
new
|
||||||
|
{
|
||||||
|
actionContext = actionContext,
|
||||||
|
arguments = actionArguments,
|
||||||
|
controller = controller
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AfterActionMethod(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
ActionContext actionContext,
|
||||||
|
IDictionary<string, object> actionArguments,
|
||||||
|
object controller,
|
||||||
|
IActionResult result)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.AfterActionMethod"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.AfterActionMethod",
|
||||||
|
new
|
||||||
|
{
|
||||||
|
actionContext = actionContext,
|
||||||
|
arguments = actionArguments,
|
||||||
|
controller = controller,
|
||||||
|
result = result
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void BeforeOnResultExecution(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
ResultExecutingContext resultExecutingContext,
|
||||||
|
IAsyncResultFilter filter)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.BeforeOnResultExecution"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.BeforeOnResultExecution",
|
||||||
|
new
|
||||||
|
{
|
||||||
|
actionDescriptor = resultExecutingContext.ActionDescriptor,
|
||||||
|
resultExecutingContext = resultExecutingContext,
|
||||||
|
filter = filter
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AfterOnResultExecution(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
ActionDescriptor actionDescriptor,
|
||||||
|
ResultExecutedContext resultExecutedContext,
|
||||||
|
IAsyncResultFilter filter)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.AfterOnResultExecution"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.AfterOnResultExecution",
|
||||||
|
new
|
||||||
|
{
|
||||||
|
actionDescriptor = actionDescriptor,
|
||||||
|
resultExecutedContext = resultExecutedContext,
|
||||||
|
filter = filter
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void BeforeOnResultExecuting(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
ResultExecutingContext resultExecutingContext,
|
||||||
|
IResultFilter filter)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.BeforeOnResultExecuting"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.BeforeOnResultExecuting",
|
||||||
|
new
|
||||||
|
{
|
||||||
|
actionDescriptor = resultExecutingContext.ActionDescriptor,
|
||||||
|
resultExecutingContext = resultExecutingContext,
|
||||||
|
filter = filter
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AfterOnResultExecuting(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
ResultExecutingContext resultExecutingContext,
|
||||||
|
IResultFilter filter)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.AfterOnResultExecuting"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.AfterOnResultExecuting",
|
||||||
|
new
|
||||||
|
{
|
||||||
|
actionDescriptor = resultExecutingContext.ActionDescriptor,
|
||||||
|
resultExecutingContext = resultExecutingContext,
|
||||||
|
filter = filter
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void BeforeOnResultExecuted(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
ActionDescriptor actionDescriptor,
|
||||||
|
ResultExecutedContext resultExecutedContext,
|
||||||
|
IResultFilter filter)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.BeforeOnResultExecuted"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.BeforeOnResultExecuted",
|
||||||
|
new
|
||||||
|
{
|
||||||
|
actionDescriptor = actionDescriptor,
|
||||||
|
resultExecutedContext = resultExecutedContext,
|
||||||
|
filter = filter
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AfterOnResultExecuted(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
ActionDescriptor actionDescriptor,
|
||||||
|
ResultExecutedContext resultExecutedContext,
|
||||||
|
IResultFilter filter)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.AfterOnResultExecuted"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.AfterOnResultExecuted",
|
||||||
|
new
|
||||||
|
{
|
||||||
|
actionDescriptor = actionDescriptor,
|
||||||
|
resultExecutedContext = resultExecutedContext,
|
||||||
|
filter = filter
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void BeforeActionResult(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
ActionContext actionContext,
|
||||||
|
IActionResult result)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.BeforeActionResult"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.BeforeActionResult",
|
||||||
|
new { actionContext = actionContext, result = result });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AfterActionResult(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
ActionContext actionContext,
|
||||||
|
IActionResult result)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.AfterActionResult"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.AfterActionResult",
|
||||||
|
new { actionContext = actionContext, result = result });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System.Diagnostics;
|
||||||
|
using Microsoft.AspNet.Http;
|
||||||
|
using Microsoft.AspNet.Mvc.Abstractions;
|
||||||
|
using Microsoft.AspNet.Routing;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNet.Mvc.Diagnostics
|
||||||
|
{
|
||||||
|
public static class MvcRouteHandlerDiagnosticSourceExtensions
|
||||||
|
{
|
||||||
|
public static void BeforeAction(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
ActionDescriptor actionDescriptor,
|
||||||
|
HttpContext httpContext,
|
||||||
|
RouteData routeData)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.BeforeAction"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.BeforeAction",
|
||||||
|
new { actionDescriptor, httpContext = httpContext, routeData = routeData });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AfterAction(
|
||||||
|
this DiagnosticSource diagnosticSource,
|
||||||
|
ActionDescriptor actionDescriptor,
|
||||||
|
HttpContext httpContext,
|
||||||
|
RouteData routeData)
|
||||||
|
{
|
||||||
|
if (diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.AfterAction"))
|
||||||
|
{
|
||||||
|
diagnosticSource.Write(
|
||||||
|
"Microsoft.AspNet.Mvc.AfterAction",
|
||||||
|
new { actionDescriptor, httpContext = httpContext, routeData = routeData });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -7,6 +7,7 @@ using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Http;
|
using Microsoft.AspNet.Http;
|
||||||
using Microsoft.AspNet.Mvc.Abstractions;
|
using Microsoft.AspNet.Mvc.Abstractions;
|
||||||
using Microsoft.AspNet.Mvc.Core;
|
using Microsoft.AspNet.Mvc.Core;
|
||||||
|
using Microsoft.AspNet.Mvc.Diagnostics;
|
||||||
using Microsoft.AspNet.Mvc.Internal;
|
using Microsoft.AspNet.Mvc.Internal;
|
||||||
using Microsoft.AspNet.Mvc.Logging;
|
using Microsoft.AspNet.Mvc.Logging;
|
||||||
using Microsoft.AspNet.Mvc.Routing;
|
using Microsoft.AspNet.Mvc.Routing;
|
||||||
|
|
@ -85,12 +86,7 @@ namespace Microsoft.AspNet.Mvc.Infrastructure
|
||||||
{
|
{
|
||||||
context.RouteData = newRouteData;
|
context.RouteData = newRouteData;
|
||||||
|
|
||||||
if (_diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.BeforeAction"))
|
_diagnosticSource.BeforeAction(actionDescriptor, context.HttpContext, context.RouteData);
|
||||||
{
|
|
||||||
_diagnosticSource.Write(
|
|
||||||
"Microsoft.AspNet.Mvc.BeforeAction",
|
|
||||||
new { actionDescriptor, httpContext = context.HttpContext, routeData = context.RouteData });
|
|
||||||
}
|
|
||||||
|
|
||||||
using (_logger.ActionScope(actionDescriptor))
|
using (_logger.ActionScope(actionDescriptor))
|
||||||
{
|
{
|
||||||
|
|
@ -102,12 +98,7 @@ namespace Microsoft.AspNet.Mvc.Infrastructure
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (_diagnosticSource.IsEnabled("Microsoft.AspNet.Mvc.AfterAction"))
|
_diagnosticSource.AfterAction(actionDescriptor, context.HttpContext, context.RouteData);
|
||||||
{
|
|
||||||
_diagnosticSource.Write(
|
|
||||||
"Microsoft.AspNet.Mvc.AfterAction",
|
|
||||||
new { actionDescriptor, httpContext = context.HttpContext, routeData = context.RouteData });
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!context.IsHandled)
|
if (!context.IsHandled)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue