MVC use concrete types for DiagnosticListener (#11730)

* MVC use concrete types for DiagnosticListener

* Use DiagnosticListener not DiagnosticSource

* Implement interface explicitly

* Code check

* Feedback

* Feedback

* IReadOnlyDictionary

* Remove InstrumentationContext

* DiagnosticSource in RazorPageActivator

* Code check

* Feedback
This commit is contained in:
Ben Adams 2019-07-15 21:38:46 +02:00 committed by Ryan Nowak
parent 8b9503ee9e
commit 09722d1ce5
24 changed files with 2435 additions and 776 deletions

View File

@ -88,13 +88,13 @@ namespace Microsoft.AspNetCore.Hosting.Tests
public void ActivityStopDoesNotFireIfNoListenerAttachedForStart()
{
// Arrange
var diagnosticSource = new DiagnosticListener("DummySource");
var diagnosticListener = new DiagnosticListener("DummySource");
var logger = new LoggerWithScopes(isEnabled: true);
var hostingApplication = CreateApplication(out var features, diagnosticSource: diagnosticSource, logger: logger);
var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener, logger: logger);
var startFired = false;
var stopFired = false;
diagnosticSource.Subscribe(new CallbackDiagnosticListener(pair =>
diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair =>
{
// This should not fire
if (pair.Key == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Start")
@ -128,14 +128,14 @@ namespace Microsoft.AspNetCore.Hosting.Tests
[Fact]
public void ActivityIsNotCreatedWhenIsEnabledForActivityIsFalse()
{
var diagnosticSource = new DiagnosticListener("DummySource");
var hostingApplication = CreateApplication(out var features, diagnosticSource: diagnosticSource);
var diagnosticListener = new DiagnosticListener("DummySource");
var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
bool eventsFired = false;
bool isEnabledActivityFired = false;
bool isEnabledStartFired = false;
diagnosticSource.Subscribe(new CallbackDiagnosticListener(pair =>
diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair =>
{
eventsFired |= pair.Key.StartsWith("Microsoft.AspNetCore.Hosting.HttpRequestIn");
}), (s, o, arg3) =>
@ -162,14 +162,14 @@ namespace Microsoft.AspNetCore.Hosting.Tests
[Fact]
public void ActivityIsCreatedButNotLoggedWhenIsEnabledForActivityStartIsFalse()
{
var diagnosticSource = new DiagnosticListener("DummySource");
var hostingApplication = CreateApplication(out var features, diagnosticSource: diagnosticSource);
var diagnosticListener = new DiagnosticListener("DummySource");
var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
bool eventsFired = false;
bool isEnabledStartFired = false;
bool isEnabledActivityFired = false;
diagnosticSource.Subscribe(new CallbackDiagnosticListener(pair =>
diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair =>
{
eventsFired |= pair.Key.StartsWith("Microsoft.AspNetCore.Hosting.HttpRequestIn");
}), (s, o, arg3) =>
@ -199,12 +199,12 @@ namespace Microsoft.AspNetCore.Hosting.Tests
[Fact]
public void ActivityIsCreatedAndLogged()
{
var diagnosticSource = new DiagnosticListener("DummySource");
var hostingApplication = CreateApplication(out var features, diagnosticSource: diagnosticSource);
var diagnosticListener = new DiagnosticListener("DummySource");
var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
bool startCalled = false;
diagnosticSource.Subscribe(new CallbackDiagnosticListener(pair =>
diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair =>
{
if (pair.Key == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Start")
{
@ -224,11 +224,11 @@ namespace Microsoft.AspNetCore.Hosting.Tests
[Fact]
public void ActivityIsStoppedDuringStopCall()
{
var diagnosticSource = new DiagnosticListener("DummySource");
var hostingApplication = CreateApplication(out var features, diagnosticSource: diagnosticSource);
var diagnosticListener = new DiagnosticListener("DummySource");
var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
bool endCalled = false;
diagnosticSource.Subscribe(new CallbackDiagnosticListener(pair =>
diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair =>
{
if (pair.Key == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Stop")
{
@ -249,11 +249,11 @@ namespace Microsoft.AspNetCore.Hosting.Tests
[Fact]
public void ActivityIsStoppedDuringUnhandledExceptionCall()
{
var diagnosticSource = new DiagnosticListener("DummySource");
var hostingApplication = CreateApplication(out var features, diagnosticSource: diagnosticSource);
var diagnosticListener = new DiagnosticListener("DummySource");
var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
bool endCalled = false;
diagnosticSource.Subscribe(new CallbackDiagnosticListener(pair =>
diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair =>
{
if (pair.Key == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Stop")
{
@ -273,11 +273,11 @@ namespace Microsoft.AspNetCore.Hosting.Tests
[Fact]
public void ActivityIsAvailableDuringUnhandledExceptionCall()
{
var diagnosticSource = new DiagnosticListener("DummySource");
var hostingApplication = CreateApplication(out var features, diagnosticSource: diagnosticSource);
var diagnosticListener = new DiagnosticListener("DummySource");
var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
bool endCalled = false;
diagnosticSource.Subscribe(new CallbackDiagnosticListener(pair =>
diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair =>
{
if (pair.Key == "Microsoft.AspNetCore.Hosting.UnhandledException")
{
@ -295,10 +295,10 @@ namespace Microsoft.AspNetCore.Hosting.Tests
[Fact]
public void ActivityIsAvailibleDuringRequest()
{
var diagnosticSource = new DiagnosticListener("DummySource");
var hostingApplication = CreateApplication(out var features, diagnosticSource: diagnosticSource);
var diagnosticListener = new DiagnosticListener("DummySource");
var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
diagnosticSource.Subscribe(new CallbackDiagnosticListener(pair => { }),
diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => { }),
s =>
{
if (s.StartsWith("Microsoft.AspNetCore.Hosting.HttpRequestIn"))
@ -317,10 +317,10 @@ namespace Microsoft.AspNetCore.Hosting.Tests
[Fact]
public void ActivityParentIdAndBaggeReadFromHeaders()
{
var diagnosticSource = new DiagnosticListener("DummySource");
var hostingApplication = CreateApplication(out var features, diagnosticSource: diagnosticSource);
var diagnosticListener = new DiagnosticListener("DummySource");
var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
diagnosticSource.Subscribe(new CallbackDiagnosticListener(pair => { }),
diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => { }),
s =>
{
if (s.StartsWith("Microsoft.AspNetCore.Hosting.HttpRequestIn"))
@ -349,10 +349,10 @@ namespace Microsoft.AspNetCore.Hosting.Tests
[Fact]
public void ActivityTraceParentAndTraceStateFromHeaders()
{
var diagnosticSource = new DiagnosticListener("DummySource");
var hostingApplication = CreateApplication(out var features, diagnosticSource: diagnosticSource);
var diagnosticListener = new DiagnosticListener("DummySource");
var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
diagnosticSource.Subscribe(new CallbackDiagnosticListener(pair => { }),
diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => { }),
s =>
{
if (s.StartsWith("Microsoft.AspNetCore.Hosting.HttpRequestIn"))
@ -385,11 +385,11 @@ namespace Microsoft.AspNetCore.Hosting.Tests
[Fact]
public void ActivityOnExportHookIsCalled()
{
var diagnosticSource = new DiagnosticListener("DummySource");
var hostingApplication = CreateApplication(out var features, diagnosticSource: diagnosticSource);
var diagnosticListener = new DiagnosticListener("DummySource");
var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
bool onActivityImportCalled = false;
diagnosticSource.Subscribe(
diagnosticListener.Subscribe(
observer: new CallbackDiagnosticListener(pair => { }),
isEnabled: (s, o, _) => true,
onActivityImport: (activity, context) =>
@ -422,7 +422,7 @@ namespace Microsoft.AspNetCore.Hosting.Tests
}
private static HostingApplication CreateApplication(out FeatureCollection features,
DiagnosticListener diagnosticSource = null, ILogger logger = null, Action<DefaultHttpContext> configure = null)
DiagnosticListener diagnosticListener = null, ILogger logger = null, Action<DefaultHttpContext> configure = null)
{
var httpContextFactory = new Mock<IHttpContextFactory>();
@ -436,7 +436,7 @@ namespace Microsoft.AspNetCore.Hosting.Tests
var hostingApplication = new HostingApplication(
ctx => Task.CompletedTask,
logger ?? new NullScopeLogger(),
diagnosticSource ?? new NoopDiagnosticSource(),
diagnosticListener ?? new NoopDiagnosticListener(),
httpContextFactory.Object);
return hostingApplication;
@ -490,11 +490,11 @@ namespace Microsoft.AspNetCore.Hosting.Tests
}
}
private class NoopDiagnosticSource : DiagnosticListener
private class NoopDiagnosticListener : DiagnosticListener
{
private readonly bool _isEnabled;
public NoopDiagnosticSource(bool isEnabled = false) : base("DummyListener")
public NoopDiagnosticListener(bool isEnabled = false) : base("DummyListener")
{
_isEnabled = isEnabled;
}

View File

@ -159,7 +159,7 @@ namespace Microsoft.AspNetCore.Http
// This property exists because of backwards compatibility.
// We send an anonymous object with an HttpContext property
// via DiagnosticSource in various events throughout the pipeline. Instead
// via DiagnosticListener in various events throughout the pipeline. Instead
// we just send the HttpContext to avoid extra allocations
[EditorBrowsable(EditorBrowsableState.Never)]
public HttpContext HttpContext => this;

View File

@ -1726,6 +1726,310 @@ namespace Microsoft.AspNetCore.Mvc.Core.Infrastructure
{
}
}
namespace Microsoft.AspNetCore.Mvc.Diagnostics
{
public sealed partial class AfterAction : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.AfterAction";
public AfterAction(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Http.HttpContext httpContext, Microsoft.AspNetCore.Routing.RouteData routeData) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Http.HttpContext HttpContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
public Microsoft.AspNetCore.Routing.RouteData RouteData { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
public sealed partial class AfterActionMethod : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.AfterActionMethod";
public AfterActionMethod(Microsoft.AspNetCore.Mvc.ActionContext actionContext, System.Collections.Generic.IReadOnlyDictionary<string, object> arguments, object controller, Microsoft.AspNetCore.Mvc.IActionResult result) { }
public Microsoft.AspNetCore.Mvc.ActionContext ActionContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public System.Collections.Generic.IReadOnlyDictionary<string, object> Arguments { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public object Controller { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
public Microsoft.AspNetCore.Mvc.IActionResult Result { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
public sealed partial class AfterActionResult : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.AfterActionResult";
public AfterActionResult(Microsoft.AspNetCore.Mvc.ActionContext actionContext, Microsoft.AspNetCore.Mvc.IActionResult result) { }
public Microsoft.AspNetCore.Mvc.ActionContext ActionContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
public Microsoft.AspNetCore.Mvc.IActionResult Result { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
public sealed partial class AfterOnActionExecuted : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.AfterOnActionExecuted";
public AfterOnActionExecuted(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.ActionExecutedContext actionExecutedContext, Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata filter) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.ActionExecutedContext ActionExecutedContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
}
public sealed partial class AfterOnActionExecuting : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.AfterOnActionExecuting";
public AfterOnActionExecuting(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.ActionExecutingContext actionExecutingContext, Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata filter) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.ActionExecutingContext ActionExecutingContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
}
public sealed partial class AfterOnActionExecution : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.AfterOnActionExecution";
public AfterOnActionExecution(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.ActionExecutedContext actionExecutedContext, Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata filter) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.ActionExecutedContext ActionExecutedContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
}
public sealed partial class AfterOnAuthorization : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.AfterOnAuthorization";
public AfterOnAuthorization(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.AuthorizationFilterContext authorizationContext, Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata filter) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.AuthorizationFilterContext AuthorizationContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
}
public sealed partial class AfterOnException : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.AfterOnException";
public AfterOnException(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.ExceptionContext exceptionContext, Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata filter) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.ExceptionContext ExceptionContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
}
public sealed partial class AfterOnResourceExecuted : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.AfterOnResourceExecuted";
public AfterOnResourceExecuted(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.ResourceExecutedContext resourceExecutedContext, Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata filter) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.ResourceExecutedContext ResourceExecutedContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
public sealed partial class AfterOnResourceExecuting : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.AfterOnResourceExecuting";
public AfterOnResourceExecuting(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.ResourceExecutingContext resourceExecutingContext, Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata filter) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.ResourceExecutingContext ResourceExecutingContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
public sealed partial class AfterOnResourceExecution : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.AfterOnResourceExecution";
public AfterOnResourceExecution(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.ResourceExecutedContext resourceExecutedContext, Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata filter) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.ResourceExecutedContext ResourceExecutedContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
public sealed partial class AfterOnResultExecuted : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.AfterOnResultExecuted";
public AfterOnResultExecuted(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.ResultExecutedContext resultExecutedContext, Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata filter) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.ResultExecutedContext ResultExecutedContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
public sealed partial class AfterOnResultExecuting : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.AfterOnResultExecuting";
public AfterOnResultExecuting(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.ResultExecutingContext resultExecutingContext, Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata filter) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.ResultExecutingContext ResultExecutingContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
public sealed partial class AfterOnResultExecution : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.AfterOnResultExecution";
public AfterOnResultExecution(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.ResultExecutedContext resultExecutedContext, Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata filter) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.ResultExecutedContext ResultExecutedContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
public sealed partial class BeforeAction : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.BeforeAction";
public BeforeAction(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Http.HttpContext httpContext, Microsoft.AspNetCore.Routing.RouteData routeData) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Http.HttpContext HttpContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
public Microsoft.AspNetCore.Routing.RouteData RouteData { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
public sealed partial class BeforeActionMethod : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.BeforeActionMethod";
public BeforeActionMethod(Microsoft.AspNetCore.Mvc.ActionContext actionContext, System.Collections.Generic.IReadOnlyDictionary<string, object> arguments, object controller) { }
public Microsoft.AspNetCore.Mvc.ActionContext ActionContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public System.Collections.Generic.IReadOnlyDictionary<string, object> Arguments { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public object Controller { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
}
public sealed partial class BeforeActionResult : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.BeforeActionResult";
public BeforeActionResult(Microsoft.AspNetCore.Mvc.ActionContext actionContext, Microsoft.AspNetCore.Mvc.IActionResult result) { }
public Microsoft.AspNetCore.Mvc.ActionContext ActionContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
public Microsoft.AspNetCore.Mvc.IActionResult Result { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
public sealed partial class BeforeOnActionExecuted : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.BeforeOnActionExecuted";
public BeforeOnActionExecuted(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.ActionExecutedContext actionExecutedContext, Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata filter) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.ActionExecutedContext ActionExecutedContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
}
public sealed partial class BeforeOnActionExecuting : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.BeforeOnActionExecuting";
public BeforeOnActionExecuting(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.ActionExecutingContext actionExecutingContext, Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata filter) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.ActionExecutingContext ActionExecutingContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
}
public sealed partial class BeforeOnActionExecution : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.BeforeOnActionExecution";
public BeforeOnActionExecution(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.ActionExecutingContext actionExecutingContext, Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata filter) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.ActionExecutingContext ActionExecutingContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
}
public sealed partial class BeforeOnAuthorization : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.BeforeOnAuthorization";
public BeforeOnAuthorization(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.AuthorizationFilterContext authorizationContext, Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata filter) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.AuthorizationFilterContext AuthorizationContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
}
public sealed partial class BeforeOnException : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.BeforeOnException";
public BeforeOnException(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.ExceptionContext exceptionContext, Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata filter) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.ExceptionContext ExceptionContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
}
public sealed partial class BeforeOnResourceExecuted : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuted";
public BeforeOnResourceExecuted(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.ResourceExecutedContext resourceExecutedContext, Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata filter) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.ResourceExecutedContext ResourceExecutedContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
public sealed partial class BeforeOnResourceExecuting : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuting";
public BeforeOnResourceExecuting(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.ResourceExecutingContext resourceExecutingContext, Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata filter) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.ResourceExecutingContext ResourceExecutingContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
public sealed partial class BeforeOnResourceExecution : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.BeforeOnResourceExecution";
public BeforeOnResourceExecution(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.ResourceExecutingContext resourceExecutingContext, Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata filter) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.ResourceExecutingContext ResourceExecutingContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
public sealed partial class BeforeOnResultExecuted : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.BeforeOnResultExecuted";
public BeforeOnResultExecuted(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.ResultExecutedContext resultExecutedContext, Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata filter) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.ResultExecutedContext ResultExecutedContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
public sealed partial class BeforeOnResultExecuting : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.BeforeOnResultExecuting";
public BeforeOnResultExecuting(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.ResultExecutingContext resultExecutingContext, Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata filter) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.ResultExecutingContext ResultExecutingContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
public sealed partial class BeforeOnResultExecution : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.BeforeOnResultExecution";
public BeforeOnResultExecution(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.ResultExecutingContext resultExecutingContext, Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata filter) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.ResultExecutingContext ResultExecutingContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
public abstract partial class EventData : System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, object>>, System.Collections.Generic.IReadOnlyCollection<System.Collections.Generic.KeyValuePair<string, object>>, System.Collections.Generic.IReadOnlyList<System.Collections.Generic.KeyValuePair<string, object>>, System.Collections.IEnumerable
{
protected const string EventNamespace = "Microsoft.AspNetCore.Mvc.";
protected EventData() { }
protected abstract int Count { get; }
protected abstract System.Collections.Generic.KeyValuePair<string, object> this[int index] { get; }
int System.Collections.Generic.IReadOnlyCollection<System.Collections.Generic.KeyValuePair<System.String,System.Object>>.Count { get { throw null; } }
System.Collections.Generic.KeyValuePair<string, object> System.Collections.Generic.IReadOnlyList<System.Collections.Generic.KeyValuePair<System.String,System.Object>>.this[int index] { get { throw null; } }
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<string, object>> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String,System.Object>>.GetEnumerator() { throw null; }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public partial struct Enumerator : System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<string, object>>, System.Collections.IEnumerator, System.IDisposable
{
private object _dummy;
private int _dummyPrimitive;
public System.Collections.Generic.KeyValuePair<string, object> Current { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
object System.Collections.IEnumerator.Current { get { throw null; } }
public void Dispose() { }
public bool MoveNext() { throw null; }
void System.Collections.IEnumerator.Reset() { }
}
}
}
namespace Microsoft.AspNetCore.Mvc.Filters
{
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=true, Inherited=true)]

View File

@ -0,0 +1,64 @@
// 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;
using System.Collections;
using System.Collections.Generic;
namespace Microsoft.AspNetCore.Mvc.Diagnostics
{
public abstract class EventData : IReadOnlyList<KeyValuePair<string, object>>
{
protected const string EventNamespace = "Microsoft.AspNetCore.Mvc.";
protected abstract int Count { get; }
protected abstract KeyValuePair<string, object> this[int index] { get; }
int IReadOnlyCollection<KeyValuePair<string, object>>.Count => Count;
KeyValuePair<string, object> IReadOnlyList<KeyValuePair<string, object>>.this[int index] => this[index];
Enumerator GetEnumerator() => new Enumerator(this);
IEnumerator<KeyValuePair<string, object>> IEnumerable<KeyValuePair<string, object>>.GetEnumerator()
=> GetEnumerator();
IEnumerator IEnumerable.GetEnumerator()
=> GetEnumerator();
public struct Enumerator : IEnumerator<KeyValuePair<string, object>>
{
private readonly EventData _eventData;
private readonly int _count;
private int _index;
public KeyValuePair<string, object> Current { get; private set; }
internal Enumerator(EventData eventData)
{
_eventData = eventData;
_count = eventData.Count;
_index = -1;
Current = default;
}
public bool MoveNext()
{
var index = _index + 1;
if (index >= _count)
{
return false;
}
_index = index;
Current = _eventData[index];
return true;
}
public void Dispose() { }
object IEnumerator.Current => Current;
void IEnumerator.Reset() => throw new NotSupportedException();
}
}
}

View File

@ -0,0 +1,736 @@
// 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;
using System.Collections.Generic;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Routing;
namespace Microsoft.AspNetCore.Mvc.Diagnostics
{
public sealed class BeforeAction : EventData
{
public const string EventName = EventNamespace + nameof(BeforeAction);
public BeforeAction(ActionDescriptor actionDescriptor, HttpContext httpContext, RouteData routeData)
{
ActionDescriptor = actionDescriptor;
HttpContext = httpContext;
RouteData = routeData;
}
public ActionDescriptor ActionDescriptor { get; }
public HttpContext HttpContext { get; }
public RouteData RouteData { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(HttpContext), HttpContext),
2 => new KeyValuePair<string, object>(nameof(RouteData), RouteData),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class AfterAction : EventData
{
public const string EventName = EventNamespace + nameof(AfterAction);
public AfterAction(ActionDescriptor actionDescriptor, HttpContext httpContext, RouteData routeData)
{
ActionDescriptor = actionDescriptor;
HttpContext = httpContext;
RouteData = routeData;
}
public ActionDescriptor ActionDescriptor { get; }
public HttpContext HttpContext { get; }
public RouteData RouteData { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(HttpContext), HttpContext),
2 => new KeyValuePair<string, object>(nameof(RouteData), RouteData),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class BeforeOnAuthorization : EventData
{
public const string EventName = EventNamespace + nameof(BeforeOnAuthorization);
public BeforeOnAuthorization(ActionDescriptor actionDescriptor, AuthorizationFilterContext authorizationContext, IFilterMetadata filter)
{
ActionDescriptor = actionDescriptor;
AuthorizationContext = authorizationContext;
Filter = filter;
}
public ActionDescriptor ActionDescriptor { get; }
public AuthorizationFilterContext AuthorizationContext { get; }
public IFilterMetadata Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(AuthorizationContext), AuthorizationContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class AfterOnAuthorization : EventData
{
public const string EventName = EventNamespace + nameof(AfterOnAuthorization);
public AfterOnAuthorization(ActionDescriptor actionDescriptor, AuthorizationFilterContext authorizationContext, IFilterMetadata filter)
{
ActionDescriptor = actionDescriptor;
AuthorizationContext = authorizationContext;
Filter = filter;
}
public ActionDescriptor ActionDescriptor { get; }
public AuthorizationFilterContext AuthorizationContext { get; }
public IFilterMetadata Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(AuthorizationContext), AuthorizationContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class BeforeOnResourceExecution : EventData
{
public const string EventName = EventNamespace + nameof(BeforeOnResourceExecution);
public BeforeOnResourceExecution(ActionDescriptor actionDescriptor, ResourceExecutingContext resourceExecutingContext, IFilterMetadata filter)
{
ActionDescriptor = actionDescriptor;
ResourceExecutingContext = resourceExecutingContext;
Filter = filter;
}
public ActionDescriptor ActionDescriptor { get; }
public ResourceExecutingContext ResourceExecutingContext { get; }
public IFilterMetadata Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(ResourceExecutingContext), ResourceExecutingContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class AfterOnResourceExecution : EventData
{
public const string EventName = EventNamespace + nameof(AfterOnResourceExecution);
public AfterOnResourceExecution(ActionDescriptor actionDescriptor, ResourceExecutedContext resourceExecutedContext, IFilterMetadata filter)
{
ActionDescriptor = actionDescriptor;
ResourceExecutedContext = resourceExecutedContext;
Filter = filter;
}
public ActionDescriptor ActionDescriptor { get; }
public ResourceExecutedContext ResourceExecutedContext { get; }
public IFilterMetadata Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(ResourceExecutedContext), ResourceExecutedContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class BeforeOnResourceExecuting : EventData
{
public const string EventName = EventNamespace + nameof(BeforeOnResourceExecuting);
public BeforeOnResourceExecuting(ActionDescriptor actionDescriptor, ResourceExecutingContext resourceExecutingContext, IFilterMetadata filter)
{
ActionDescriptor = actionDescriptor;
ResourceExecutingContext = resourceExecutingContext;
Filter = filter;
}
public ActionDescriptor ActionDescriptor { get; }
public ResourceExecutingContext ResourceExecutingContext { get; }
public IFilterMetadata Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(ResourceExecutingContext), ResourceExecutingContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class AfterOnResourceExecuting : EventData
{
public const string EventName = EventNamespace + nameof(AfterOnResourceExecuting);
public AfterOnResourceExecuting(ActionDescriptor actionDescriptor, ResourceExecutingContext resourceExecutingContext, IFilterMetadata filter)
{
ActionDescriptor = actionDescriptor;
ResourceExecutingContext = resourceExecutingContext;
Filter = filter;
}
public ActionDescriptor ActionDescriptor { get; }
public ResourceExecutingContext ResourceExecutingContext { get; }
public IFilterMetadata Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(ResourceExecutingContext), ResourceExecutingContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class BeforeOnResourceExecuted : EventData
{
public const string EventName = EventNamespace + nameof(BeforeOnResourceExecuted);
public BeforeOnResourceExecuted(ActionDescriptor actionDescriptor, ResourceExecutedContext resourceExecutedContext, IFilterMetadata filter)
{
ActionDescriptor = actionDescriptor;
ResourceExecutedContext = resourceExecutedContext;
Filter = filter;
}
public ActionDescriptor ActionDescriptor { get; }
public ResourceExecutedContext ResourceExecutedContext { get; }
public IFilterMetadata Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(ResourceExecutedContext), ResourceExecutedContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class AfterOnResourceExecuted : EventData
{
public const string EventName = EventNamespace + nameof(AfterOnResourceExecuted);
public AfterOnResourceExecuted(ActionDescriptor actionDescriptor, ResourceExecutedContext resourceExecutedContext, IFilterMetadata filter)
{
ActionDescriptor = actionDescriptor;
ResourceExecutedContext = resourceExecutedContext;
Filter = filter;
}
public ActionDescriptor ActionDescriptor { get; }
public ResourceExecutedContext ResourceExecutedContext { get; }
public IFilterMetadata Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(ResourceExecutedContext), ResourceExecutedContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class BeforeOnException : EventData
{
public const string EventName = EventNamespace + nameof(BeforeOnException);
public BeforeOnException(ActionDescriptor actionDescriptor, ExceptionContext exceptionContext, IFilterMetadata filter)
{
ActionDescriptor = actionDescriptor;
ExceptionContext = exceptionContext;
Filter = filter;
}
public ActionDescriptor ActionDescriptor { get; }
public ExceptionContext ExceptionContext { get; }
public IFilterMetadata Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(ExceptionContext), ExceptionContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class AfterOnException : EventData
{
public const string EventName = EventNamespace + nameof(AfterOnException);
public AfterOnException(ActionDescriptor actionDescriptor, ExceptionContext exceptionContext, IFilterMetadata filter)
{
ActionDescriptor = actionDescriptor;
ExceptionContext = exceptionContext;
Filter = filter;
}
public ActionDescriptor ActionDescriptor { get; }
public ExceptionContext ExceptionContext { get; }
public IFilterMetadata Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(ExceptionContext), ExceptionContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class BeforeOnActionExecution : EventData
{
public const string EventName = EventNamespace + nameof(BeforeOnActionExecution);
public BeforeOnActionExecution(ActionDescriptor actionDescriptor, ActionExecutingContext actionExecutingContext, IFilterMetadata filter)
{
ActionDescriptor = actionDescriptor;
ActionExecutingContext = actionExecutingContext;
Filter = filter;
}
public ActionDescriptor ActionDescriptor { get; }
public ActionExecutingContext ActionExecutingContext { get; }
public IFilterMetadata Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(ActionExecutingContext), ActionExecutingContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class AfterOnActionExecution : EventData
{
public const string EventName = EventNamespace + nameof(AfterOnActionExecution);
public AfterOnActionExecution(ActionDescriptor actionDescriptor, ActionExecutedContext actionExecutedContext, IFilterMetadata filter)
{
ActionDescriptor = actionDescriptor;
ActionExecutedContext = actionExecutedContext;
Filter = filter;
}
public ActionDescriptor ActionDescriptor { get; }
public ActionExecutedContext ActionExecutedContext { get; }
public IFilterMetadata Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(ActionExecutedContext), ActionExecutedContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class BeforeOnActionExecuting : EventData
{
public const string EventName = EventNamespace + nameof(BeforeOnActionExecuting);
public BeforeOnActionExecuting(ActionDescriptor actionDescriptor, ActionExecutingContext actionExecutingContext, IFilterMetadata filter)
{
ActionDescriptor = actionDescriptor;
ActionExecutingContext = actionExecutingContext;
Filter = filter;
}
public ActionDescriptor ActionDescriptor { get; }
public ActionExecutingContext ActionExecutingContext { get; }
public IFilterMetadata Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(ActionExecutingContext), ActionExecutingContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class AfterOnActionExecuting : EventData
{
public const string EventName = EventNamespace + nameof(AfterOnActionExecuting);
public AfterOnActionExecuting(ActionDescriptor actionDescriptor, ActionExecutingContext actionExecutingContext, IFilterMetadata filter)
{
ActionDescriptor = actionDescriptor;
ActionExecutingContext = actionExecutingContext;
Filter = filter;
}
public ActionDescriptor ActionDescriptor { get; }
public ActionExecutingContext ActionExecutingContext { get; }
public IFilterMetadata Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(ActionExecutingContext), ActionExecutingContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class BeforeOnActionExecuted : EventData
{
public const string EventName = EventNamespace + nameof(BeforeOnActionExecuted);
public BeforeOnActionExecuted(ActionDescriptor actionDescriptor, ActionExecutedContext actionExecutedContext, IFilterMetadata filter)
{
ActionDescriptor = actionDescriptor;
ActionExecutedContext = actionExecutedContext;
Filter = filter;
}
public ActionDescriptor ActionDescriptor { get; }
public ActionExecutedContext ActionExecutedContext { get; }
public IFilterMetadata Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(ActionExecutedContext), ActionExecutedContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class AfterOnActionExecuted : EventData
{
public const string EventName = EventNamespace + nameof(AfterOnActionExecuted);
public AfterOnActionExecuted(ActionDescriptor actionDescriptor, ActionExecutedContext actionExecutedContext, IFilterMetadata filter)
{
ActionDescriptor = actionDescriptor;
ActionExecutedContext = actionExecutedContext;
Filter = filter;
}
public ActionDescriptor ActionDescriptor { get; }
public ActionExecutedContext ActionExecutedContext { get; }
public IFilterMetadata Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(ActionExecutedContext), ActionExecutedContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class BeforeActionMethod : EventData
{
public const string EventName = EventNamespace + nameof(BeforeActionMethod);
public BeforeActionMethod(ActionContext actionContext, IReadOnlyDictionary<string, object> arguments, object controller)
{
ActionContext = actionContext;
Arguments = arguments;
Controller = controller;
}
public ActionContext ActionContext { get; }
public IReadOnlyDictionary<string, object> Arguments { get; }
public object Controller { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionContext), ActionContext),
1 => new KeyValuePair<string, object>(nameof(Arguments), Arguments),
2 => new KeyValuePair<string, object>(nameof(Controller), Controller),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class AfterActionMethod : EventData
{
public const string EventName = EventNamespace + nameof(AfterActionMethod);
public AfterActionMethod(ActionContext actionContext, IReadOnlyDictionary<string, object> arguments, object controller, IActionResult result)
{
ActionContext = actionContext;
Arguments = arguments;
Controller = controller;
Result = result;
}
public ActionContext ActionContext { get; }
public IReadOnlyDictionary<string, object> Arguments { get; }
public object Controller { get; }
public IActionResult Result { get; }
protected override int Count => 4;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionContext), ActionContext),
1 => new KeyValuePair<string, object>(nameof(Controller), Controller),
2 => new KeyValuePair<string, object>(nameof(Controller), Controller),
3 => new KeyValuePair<string, object>(nameof(Result), Result),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class BeforeOnResultExecution : EventData
{
public const string EventName = EventNamespace + nameof(BeforeOnResultExecution);
public BeforeOnResultExecution(ActionDescriptor actionDescriptor, ResultExecutingContext resultExecutingContext, IFilterMetadata filter)
{
ActionDescriptor = actionDescriptor;
ResultExecutingContext = resultExecutingContext;
Filter = filter;
}
public ActionDescriptor ActionDescriptor { get; }
public ResultExecutingContext ResultExecutingContext { get; }
public IFilterMetadata Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(ResultExecutingContext), ResultExecutingContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class AfterOnResultExecution : EventData
{
public const string EventName = EventNamespace + nameof(AfterOnResultExecution);
public AfterOnResultExecution(ActionDescriptor actionDescriptor, ResultExecutedContext resultExecutedContext, IFilterMetadata filter)
{
ActionDescriptor = actionDescriptor;
ResultExecutedContext = resultExecutedContext;
Filter = filter;
}
public ActionDescriptor ActionDescriptor { get; }
public ResultExecutedContext ResultExecutedContext { get; }
public IFilterMetadata Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(ResultExecutedContext), ResultExecutedContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class BeforeOnResultExecuting : EventData
{
public const string EventName = EventNamespace + nameof(BeforeOnResultExecuting);
public BeforeOnResultExecuting(ActionDescriptor actionDescriptor, ResultExecutingContext resultExecutingContext, IFilterMetadata filter)
{
ActionDescriptor = actionDescriptor;
ResultExecutingContext = resultExecutingContext;
Filter = filter;
}
public ActionDescriptor ActionDescriptor { get; }
public ResultExecutingContext ResultExecutingContext { get; }
public IFilterMetadata Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(ResultExecutingContext), ResultExecutingContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class AfterOnResultExecuting : EventData
{
public const string EventName = EventNamespace + nameof(AfterOnResultExecuting);
public AfterOnResultExecuting(ActionDescriptor actionDescriptor, ResultExecutingContext resultExecutingContext, IFilterMetadata filter)
{
ActionDescriptor = actionDescriptor;
ResultExecutingContext = resultExecutingContext;
Filter = filter;
}
public ActionDescriptor ActionDescriptor { get; }
public ResultExecutingContext ResultExecutingContext { get; }
public IFilterMetadata Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(ResultExecutingContext), ResultExecutingContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class BeforeOnResultExecuted : EventData
{
public const string EventName = EventNamespace + nameof(BeforeOnResultExecuted);
public BeforeOnResultExecuted(ActionDescriptor actionDescriptor, ResultExecutedContext resultExecutedContext, IFilterMetadata filter)
{
ActionDescriptor = actionDescriptor;
ResultExecutedContext = resultExecutedContext;
Filter = filter;
}
public ActionDescriptor ActionDescriptor { get; }
public ResultExecutedContext ResultExecutedContext { get; }
public IFilterMetadata Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(ResultExecutedContext), ResultExecutedContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class AfterOnResultExecuted : EventData
{
public const string EventName = EventNamespace + nameof(AfterOnResultExecuted);
public AfterOnResultExecuted(ActionDescriptor actionDescriptor, ResultExecutedContext resultExecutedContext, IFilterMetadata filter)
{
ActionDescriptor = actionDescriptor;
ResultExecutedContext = resultExecutedContext;
Filter = filter;
}
public ActionDescriptor ActionDescriptor { get; }
public ResultExecutedContext ResultExecutedContext { get; }
public IFilterMetadata Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(ResultExecutedContext), ResultExecutedContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class BeforeActionResult : EventData
{
public const string EventName = EventNamespace + nameof(BeforeActionResult);
public BeforeActionResult(ActionContext actionContext, IActionResult result)
{
ActionContext = actionContext;
Result = result;
}
public ActionContext ActionContext { get; }
public IActionResult Result { get; }
protected override int Count => 2;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionContext), ActionContext),
1 => new KeyValuePair<string, object>(nameof(Result), Result),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class AfterActionResult : EventData
{
public const string EventName = EventNamespace + nameof(AfterActionResult);
public AfterActionResult(ActionContext actionContext, IActionResult result)
{
ActionContext = actionContext;
Result = result;
}
public ActionContext ActionContext { get; }
public IActionResult Result { get; }
protected override int Count => 2;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionContext), ActionContext),
1 => new KeyValuePair<string, object>(nameof(Result), Result),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
}

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Diagnostics;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Routing;
@ -13,7 +14,7 @@ namespace Microsoft.AspNetCore.Mvc
// 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.
internal static class MvcCoreDiagnosticSourceExtensions
internal static class MvcCoreDiagnosticListenerExtensions
{
public static void BeforeAction(
this DiagnosticListener diagnosticListener,
@ -35,11 +36,11 @@ namespace Microsoft.AspNetCore.Mvc
private static void BeforeActionImpl(DiagnosticListener diagnosticListener, ActionDescriptor actionDescriptor, HttpContext httpContext, RouteData routeData)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeAction"))
if (diagnosticListener.IsEnabled(Diagnostics.BeforeAction.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.BeforeAction",
new { actionDescriptor, httpContext = httpContext, routeData = routeData });
Diagnostics.BeforeAction.EventName,
new BeforeAction(actionDescriptor, httpContext, routeData));
}
}
@ -63,11 +64,11 @@ namespace Microsoft.AspNetCore.Mvc
private static void AfterActionImpl(DiagnosticListener diagnosticListener, ActionDescriptor actionDescriptor, HttpContext httpContext, RouteData routeData)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterAction"))
if (diagnosticListener.IsEnabled(Diagnostics.AfterAction.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.AfterAction",
new { actionDescriptor, httpContext = httpContext, routeData = routeData });
Diagnostics.AfterAction.EventName,
new AfterAction(actionDescriptor, httpContext, routeData));
}
}
@ -89,16 +90,15 @@ namespace Microsoft.AspNetCore.Mvc
private static void BeforeOnAuthorizationAsyncImpl(DiagnosticListener diagnosticListener, AuthorizationFilterContext authorizationContext, IAsyncAuthorizationFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnAuthorization"))
if (diagnosticListener.IsEnabled(Diagnostics.BeforeOnAuthorization.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.BeforeOnAuthorization",
new
{
actionDescriptor = authorizationContext.ActionDescriptor,
authorizationContext = authorizationContext,
filter = filter
});
Diagnostics.BeforeOnAuthorization.EventName,
new BeforeOnAuthorization(
authorizationContext.ActionDescriptor,
authorizationContext,
filter
));
}
}
@ -120,16 +120,15 @@ namespace Microsoft.AspNetCore.Mvc
private static void AfterOnAuthorizationAsyncImpl(DiagnosticListener diagnosticListener, AuthorizationFilterContext authorizationContext, IAsyncAuthorizationFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnAuthorization"))
if (diagnosticListener.IsEnabled(Diagnostics.AfterOnAuthorization.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.AfterOnAuthorization",
new
{
actionDescriptor = authorizationContext.ActionDescriptor,
authorizationContext = authorizationContext,
filter = filter
});
Diagnostics.AfterOnAuthorization.EventName,
new AfterOnAuthorization(
authorizationContext.ActionDescriptor,
authorizationContext,
filter
));
}
}
@ -151,16 +150,15 @@ namespace Microsoft.AspNetCore.Mvc
private static void BeforeOnAuthorizationImpl(DiagnosticListener diagnosticListener, AuthorizationFilterContext authorizationContext, IAuthorizationFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnAuthorization"))
if (diagnosticListener.IsEnabled(Diagnostics.BeforeOnAuthorization.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.BeforeOnAuthorization",
new
{
actionDescriptor = authorizationContext.ActionDescriptor,
authorizationContext = authorizationContext,
filter = filter
});
Diagnostics.BeforeOnAuthorization.EventName,
new BeforeOnAuthorization(
authorizationContext.ActionDescriptor,
authorizationContext,
filter
));
}
}
@ -182,16 +180,15 @@ namespace Microsoft.AspNetCore.Mvc
private static void AfterOnAuthorizationImpl(DiagnosticListener diagnosticListener, AuthorizationFilterContext authorizationContext, IAuthorizationFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnAuthorization"))
if (diagnosticListener.IsEnabled(Diagnostics.AfterOnAuthorization.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.AfterOnAuthorization",
new
{
actionDescriptor = authorizationContext.ActionDescriptor,
authorizationContext = authorizationContext,
filter = filter
});
Diagnostics.AfterOnAuthorization.EventName,
new AfterOnAuthorization(
authorizationContext.ActionDescriptor,
authorizationContext,
filter
));
}
}
@ -213,16 +210,15 @@ namespace Microsoft.AspNetCore.Mvc
private static void BeforeOnResourceExecutionImpl(DiagnosticListener diagnosticListener, ResourceExecutingContext resourceExecutingContext, IAsyncResourceFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResourceExecution"))
if (diagnosticListener.IsEnabled(Diagnostics.BeforeOnResourceExecution.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.BeforeOnResourceExecution",
new
{
actionDescriptor = resourceExecutingContext.ActionDescriptor,
resourceExecutingContext = resourceExecutingContext,
filter = filter
});
Diagnostics.BeforeOnResourceExecution.EventName,
new BeforeOnResourceExecution(
resourceExecutingContext.ActionDescriptor,
resourceExecutingContext,
filter
));
}
}
@ -244,16 +240,15 @@ namespace Microsoft.AspNetCore.Mvc
private static void AfterOnResourceExecutionImpl(DiagnosticListener diagnosticListener, ResourceExecutedContext resourceExecutedContext, IAsyncResourceFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResourceExecution"))
if (diagnosticListener.IsEnabled(Diagnostics.AfterOnResourceExecution.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.AfterOnResourceExecution",
new
{
actionDescriptor = resourceExecutedContext.ActionDescriptor,
resourceExecutedContext = resourceExecutedContext,
filter = filter
});
Diagnostics.AfterOnResourceExecution.EventName,
new AfterOnResourceExecution(
resourceExecutedContext.ActionDescriptor,
resourceExecutedContext,
filter
));
}
}
@ -275,16 +270,15 @@ namespace Microsoft.AspNetCore.Mvc
private static void BeforeOnResourceExecutingImpl(DiagnosticListener diagnosticListener, ResourceExecutingContext resourceExecutingContext, IResourceFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuting"))
if (diagnosticListener.IsEnabled(Diagnostics.BeforeOnResourceExecuting.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuting",
new
{
actionDescriptor = resourceExecutingContext.ActionDescriptor,
resourceExecutingContext = resourceExecutingContext,
filter = filter
});
Diagnostics.BeforeOnResourceExecuting.EventName,
new BeforeOnResourceExecuting(
resourceExecutingContext.ActionDescriptor,
resourceExecutingContext,
filter
));
}
}
@ -306,16 +300,15 @@ namespace Microsoft.AspNetCore.Mvc
private static void AfterOnResourceExecutingImpl(DiagnosticListener diagnosticListener, ResourceExecutingContext resourceExecutingContext, IResourceFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResourceExecuting"))
if (diagnosticListener.IsEnabled(Diagnostics.AfterOnResourceExecuting.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.AfterOnResourceExecuting",
new
{
actionDescriptor = resourceExecutingContext.ActionDescriptor,
resourceExecutingContext = resourceExecutingContext,
filter = filter
});
Diagnostics.AfterOnResourceExecuting.EventName,
new AfterOnResourceExecuting(
resourceExecutingContext.ActionDescriptor,
resourceExecutingContext,
filter
));
}
}
@ -337,16 +330,15 @@ namespace Microsoft.AspNetCore.Mvc
private static void BeforeOnResourceExecutedImpl(DiagnosticListener diagnosticListener, ResourceExecutedContext resourceExecutedContext, IResourceFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuted"))
if (diagnosticListener.IsEnabled(Diagnostics.BeforeOnResourceExecuted.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuted",
new
{
actionDescriptor = resourceExecutedContext.ActionDescriptor,
resourceExecutedContext = resourceExecutedContext,
filter = filter
});
Diagnostics.BeforeOnResourceExecuted.EventName,
new BeforeOnResourceExecuted(
resourceExecutedContext.ActionDescriptor,
resourceExecutedContext,
filter
));
}
}
@ -368,16 +360,15 @@ namespace Microsoft.AspNetCore.Mvc
private static void AfterOnResourceExecutedImpl(DiagnosticListener diagnosticListener, ResourceExecutedContext resourceExecutedContext, IResourceFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResourceExecuted"))
if (diagnosticListener.IsEnabled(Diagnostics.AfterOnResourceExecuted.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.AfterOnResourceExecuted",
new
{
actionDescriptor = resourceExecutedContext.ActionDescriptor,
resourceExecutedContext = resourceExecutedContext,
filter = filter
});
Diagnostics.AfterOnResourceExecuted.EventName,
new AfterOnResourceExecuted(
resourceExecutedContext.ActionDescriptor,
resourceExecutedContext,
filter
));
}
}
@ -399,16 +390,15 @@ namespace Microsoft.AspNetCore.Mvc
private static void BeforeOnExceptionAsyncImpl(DiagnosticListener diagnosticListener, ExceptionContext exceptionContext, IAsyncExceptionFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnException"))
if (diagnosticListener.IsEnabled(Diagnostics.BeforeOnException.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.BeforeOnException",
new
{
actionDescriptor = exceptionContext.ActionDescriptor,
exceptionContext = exceptionContext,
filter = filter
});
Diagnostics.BeforeOnException.EventName,
new BeforeOnException(
exceptionContext.ActionDescriptor,
exceptionContext,
filter
));
}
}
@ -430,16 +420,15 @@ namespace Microsoft.AspNetCore.Mvc
private static void AfterOnExceptionAsyncImpl(DiagnosticListener diagnosticListener, ExceptionContext exceptionContext, IAsyncExceptionFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnException"))
if (diagnosticListener.IsEnabled(Diagnostics.AfterOnException.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.AfterOnException",
new
{
actionDescriptor = exceptionContext.ActionDescriptor,
exceptionContext = exceptionContext,
filter = filter
});
Diagnostics.AfterOnException.EventName,
new AfterOnException(
exceptionContext.ActionDescriptor,
exceptionContext,
filter
));
}
}
@ -461,16 +450,15 @@ namespace Microsoft.AspNetCore.Mvc
private static void BeforeOnExceptionImpl(DiagnosticListener diagnosticListener, ExceptionContext exceptionContext, IExceptionFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnException"))
if (diagnosticListener.IsEnabled(Diagnostics.BeforeOnException.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.BeforeOnException",
new
{
actionDescriptor = exceptionContext.ActionDescriptor,
exceptionContext = exceptionContext,
filter = filter
});
Diagnostics.BeforeOnException.EventName,
new BeforeOnException(
exceptionContext.ActionDescriptor,
exceptionContext,
filter
));
}
}
@ -492,16 +480,15 @@ namespace Microsoft.AspNetCore.Mvc
private static void AfterOnExceptionImpl(DiagnosticListener diagnosticListener, ExceptionContext exceptionContext, IExceptionFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnException"))
if (diagnosticListener.IsEnabled(Diagnostics.AfterOnException.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.AfterOnException",
new
{
actionDescriptor = exceptionContext.ActionDescriptor,
exceptionContext = exceptionContext,
filter = filter
});
Diagnostics.AfterOnException.EventName,
new AfterOnException(
exceptionContext.ActionDescriptor,
exceptionContext,
filter
));
}
}
@ -523,16 +510,15 @@ namespace Microsoft.AspNetCore.Mvc
private static void BeforeOnActionExecutionImpl(DiagnosticListener diagnosticListener, ActionExecutingContext actionExecutingContext, IAsyncActionFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnActionExecution"))
if (diagnosticListener.IsEnabled(Diagnostics.BeforeOnActionExecution.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.BeforeOnActionExecution",
new
{
actionDescriptor = actionExecutingContext.ActionDescriptor,
actionExecutingContext = actionExecutingContext,
filter = filter
});
Diagnostics.BeforeOnActionExecution.EventName,
new BeforeOnActionExecution(
actionExecutingContext.ActionDescriptor,
actionExecutingContext,
filter
));
}
}
@ -554,16 +540,15 @@ namespace Microsoft.AspNetCore.Mvc
private static void AfterOnActionExecutionImpl(DiagnosticListener diagnosticListener, ActionExecutedContext actionExecutedContext, IAsyncActionFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnActionExecution"))
if (diagnosticListener.IsEnabled(Diagnostics.AfterOnActionExecution.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.AfterOnActionExecution",
new
{
actionDescriptor = actionExecutedContext.ActionDescriptor,
actionExecutedContext = actionExecutedContext,
filter = filter
});
Diagnostics.AfterOnActionExecution.EventName,
new AfterOnActionExecution(
actionExecutedContext.ActionDescriptor,
actionExecutedContext,
filter
));
}
}
@ -585,16 +570,15 @@ namespace Microsoft.AspNetCore.Mvc
private static void BeforeOnActionExecutingImpl(DiagnosticListener diagnosticListener, ActionExecutingContext actionExecutingContext, IActionFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnActionExecuting"))
if (diagnosticListener.IsEnabled(Diagnostics.BeforeOnActionExecuting.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.BeforeOnActionExecuting",
new
{
actionDescriptor = actionExecutingContext.ActionDescriptor,
actionExecutingContext = actionExecutingContext,
filter = filter
});
Diagnostics.BeforeOnActionExecuting.EventName,
new BeforeOnActionExecuting(
actionExecutingContext.ActionDescriptor,
actionExecutingContext,
filter
));
}
}
@ -616,16 +600,15 @@ namespace Microsoft.AspNetCore.Mvc
private static void AfterOnActionExecutingImpl(DiagnosticListener diagnosticListener, ActionExecutingContext actionExecutingContext, IActionFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnActionExecuting"))
if (diagnosticListener.IsEnabled(Diagnostics.AfterOnActionExecuting.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.AfterOnActionExecuting",
new
{
actionDescriptor = actionExecutingContext.ActionDescriptor,
actionExecutingContext = actionExecutingContext,
filter = filter
});
Diagnostics.AfterOnActionExecuting.EventName,
new AfterOnActionExecuting(
actionExecutingContext.ActionDescriptor,
actionExecutingContext,
filter
));
}
}
@ -647,16 +630,15 @@ namespace Microsoft.AspNetCore.Mvc
private static void BeforeOnActionExecutedImpl(DiagnosticListener diagnosticListener, ActionExecutedContext actionExecutedContext, IActionFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnActionExecuted"))
if (diagnosticListener.IsEnabled(Diagnostics.BeforeOnActionExecuted.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.BeforeOnActionExecuted",
new
{
actionDescriptor = actionExecutedContext.ActionDescriptor,
actionExecutedContext = actionExecutedContext,
filter = filter
});
Diagnostics.BeforeOnActionExecuted.EventName,
new BeforeOnActionExecuted(
actionExecutedContext.ActionDescriptor,
actionExecutedContext,
filter
));
}
}
@ -678,23 +660,22 @@ namespace Microsoft.AspNetCore.Mvc
private static void AfterOnActionExecutedImpl(DiagnosticListener diagnosticListener, ActionExecutedContext actionExecutedContext, IActionFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnActionExecuted"))
if (diagnosticListener.IsEnabled(Diagnostics.AfterOnActionExecuted.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.AfterOnActionExecuted",
new
{
actionDescriptor = actionExecutedContext.ActionDescriptor,
actionExecutedContext = actionExecutedContext,
filter = filter
});
Diagnostics.AfterOnActionExecuted.EventName,
new AfterOnActionExecuted(
actionExecutedContext.ActionDescriptor,
actionExecutedContext,
filter
));
}
}
public static void BeforeActionMethod(
this DiagnosticListener diagnosticListener,
ActionContext actionContext,
IDictionary<string, object> actionArguments,
IReadOnlyDictionary<string, object> actionArguments,
object controller)
{
Debug.Assert(diagnosticListener != null);
@ -709,25 +690,24 @@ namespace Microsoft.AspNetCore.Mvc
}
}
private static void BeforeActionMethodImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, IDictionary<string, object> actionArguments, object controller)
private static void BeforeActionMethodImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, IReadOnlyDictionary<string, object> actionArguments, object controller)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeActionMethod"))
if (diagnosticListener.IsEnabled(Diagnostics.BeforeActionMethod.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.BeforeActionMethod",
new
{
actionContext = actionContext,
arguments = actionArguments,
controller = controller
});
Diagnostics.BeforeActionMethod.EventName,
new BeforeActionMethod(
actionContext,
actionArguments,
controller
));
}
}
public static void AfterActionMethod(
this DiagnosticListener diagnosticListener,
ActionContext actionContext,
IDictionary<string, object> actionArguments,
IReadOnlyDictionary<string, object> actionArguments,
object controller,
IActionResult result)
{
@ -743,19 +723,18 @@ namespace Microsoft.AspNetCore.Mvc
}
}
private static void AfterActionMethodImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, IDictionary<string, object> actionArguments, object controller, IActionResult result)
private static void AfterActionMethodImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, IReadOnlyDictionary<string, object> actionArguments, object controller, IActionResult result)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterActionMethod"))
if (diagnosticListener.IsEnabled(Diagnostics.AfterActionMethod.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.AfterActionMethod",
new
{
actionContext = actionContext,
arguments = actionArguments,
controller = controller,
result = result
});
Diagnostics.AfterActionMethod.EventName,
new AfterActionMethod(
actionContext,
actionArguments,
controller,
result
));
}
}
@ -777,16 +756,15 @@ namespace Microsoft.AspNetCore.Mvc
private static void BeforeOnResultExecutionImpl(DiagnosticListener diagnosticListener, ResultExecutingContext resultExecutingContext, IAsyncResultFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResultExecution"))
if (diagnosticListener.IsEnabled(Diagnostics.BeforeOnResultExecution.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.BeforeOnResultExecution",
new
{
actionDescriptor = resultExecutingContext.ActionDescriptor,
resultExecutingContext = resultExecutingContext,
filter = filter
});
Diagnostics.BeforeOnResultExecution.EventName,
new BeforeOnResultExecution(
resultExecutingContext.ActionDescriptor,
resultExecutingContext,
filter
));
}
}
@ -808,16 +786,15 @@ namespace Microsoft.AspNetCore.Mvc
private static void AfterOnResultExecutionImpl(DiagnosticListener diagnosticListener, ResultExecutedContext resultExecutedContext, IAsyncResultFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResultExecution"))
if (diagnosticListener.IsEnabled(Diagnostics.AfterOnResultExecution.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.AfterOnResultExecution",
new
{
actionDescriptor = resultExecutedContext.ActionDescriptor,
resultExecutedContext = resultExecutedContext,
filter = filter
});
Diagnostics.AfterOnResultExecution.EventName,
new AfterOnResultExecution(
resultExecutedContext.ActionDescriptor,
resultExecutedContext,
filter
));
}
}
@ -839,16 +816,15 @@ namespace Microsoft.AspNetCore.Mvc
private static void BeforeOnResultExecutingImpl(DiagnosticListener diagnosticListener, ResultExecutingContext resultExecutingContext, IResultFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResultExecuting"))
if (diagnosticListener.IsEnabled(Diagnostics.BeforeOnResultExecuting.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.BeforeOnResultExecuting",
new
{
actionDescriptor = resultExecutingContext.ActionDescriptor,
resultExecutingContext = resultExecutingContext,
filter = filter
});
Diagnostics.BeforeOnResultExecuting.EventName,
new BeforeOnResultExecuting(
resultExecutingContext.ActionDescriptor,
resultExecutingContext,
filter
));
}
}
@ -870,16 +846,15 @@ namespace Microsoft.AspNetCore.Mvc
private static void AfterOnResultExecutingImpl(DiagnosticListener diagnosticListener, ResultExecutingContext resultExecutingContext, IResultFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResultExecuting"))
if (diagnosticListener.IsEnabled(Diagnostics.AfterOnResultExecuting.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.AfterOnResultExecuting",
new
{
actionDescriptor = resultExecutingContext.ActionDescriptor,
resultExecutingContext = resultExecutingContext,
filter = filter
});
Diagnostics.AfterOnResultExecuting.EventName,
new AfterOnResultExecuting(
resultExecutingContext.ActionDescriptor,
resultExecutingContext,
filter
));
}
}
@ -901,16 +876,15 @@ namespace Microsoft.AspNetCore.Mvc
private static void BeforeOnResultExecutedImpl(DiagnosticListener diagnosticListener, ResultExecutedContext resultExecutedContext, IResultFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResultExecuted"))
if (diagnosticListener.IsEnabled(Diagnostics.BeforeOnResultExecuted.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.BeforeOnResultExecuted",
new
{
actionDescriptor = resultExecutedContext.ActionDescriptor,
resultExecutedContext = resultExecutedContext,
filter = filter
});
Diagnostics.BeforeOnResultExecuted.EventName,
new BeforeOnResultExecuted(
resultExecutedContext.ActionDescriptor,
resultExecutedContext,
filter
));
}
}
@ -932,16 +906,15 @@ namespace Microsoft.AspNetCore.Mvc
private static void AfterOnResultExecutedImpl(DiagnosticListener diagnosticListener, ResultExecutedContext resultExecutedContext, IResultFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResultExecuted"))
if (diagnosticListener.IsEnabled(Diagnostics.AfterOnResultExecuted.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.AfterOnResultExecuted",
new
{
actionDescriptor = resultExecutedContext.ActionDescriptor,
resultExecutedContext = resultExecutedContext,
filter = filter
});
Diagnostics.AfterOnResultExecuted.EventName,
new AfterOnResultExecuted(
resultExecutedContext.ActionDescriptor,
resultExecutedContext,
filter
));
}
}
@ -963,11 +936,11 @@ namespace Microsoft.AspNetCore.Mvc
private static void BeforeActionResultImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, IActionResult result)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeActionResult"))
if (diagnosticListener.IsEnabled(Diagnostics.BeforeActionResult.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.BeforeActionResult",
new { actionContext = actionContext, result = result });
Diagnostics.BeforeActionResult.EventName,
new BeforeActionResult(actionContext, result));
}
}
@ -989,11 +962,11 @@ namespace Microsoft.AspNetCore.Mvc
private static void AfterActionResultImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, IActionResult result)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterActionResult"))
if (diagnosticListener.IsEnabled(Diagnostics.AfterActionResult.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.AfterActionResult",
new { actionContext = actionContext, result = result });
Diagnostics.AfterActionResult.EventName,
new AfterActionResult(actionContext, result));
}
}
}

View File

@ -21,6 +21,31 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationParts
System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItem> CompiledItems { get; }
}
}
namespace Microsoft.AspNetCore.Mvc.Diagnostics
{
public sealed partial class AfterViewPage : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.Razor.AfterViewPage";
public AfterViewPage(Microsoft.AspNetCore.Mvc.Razor.IRazorPage page, Microsoft.AspNetCore.Mvc.Rendering.ViewContext viewContext, Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Http.HttpContext httpContext) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Http.HttpContext HttpContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Razor.IRazorPage Page { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.Rendering.ViewContext ViewContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
public sealed partial class BeforeViewPage : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.Razor.BeforeViewPage";
public BeforeViewPage(Microsoft.AspNetCore.Mvc.Razor.IRazorPage page, Microsoft.AspNetCore.Mvc.Rendering.ViewContext viewContext, Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Http.HttpContext httpContext) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Http.HttpContext HttpContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Razor.IRazorPage Page { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.Rendering.ViewContext ViewContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
}
namespace Microsoft.AspNetCore.Mvc.Razor
{
public partial class HelperResult : Microsoft.AspNetCore.Html.IHtmlContent

View File

@ -0,0 +1,74 @@
// 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;
using System.Collections.Generic;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace Microsoft.AspNetCore.Mvc.Diagnostics
{
public sealed class BeforeViewPage : EventData
{
public const string EventName = EventNamespace +
"Razor." +
nameof(BeforeViewPage);
public BeforeViewPage(IRazorPage page, ViewContext viewContext, ActionDescriptor actionDescriptor, HttpContext httpContext)
{
Page = page;
ViewContext = viewContext;
ActionDescriptor = actionDescriptor;
HttpContext = httpContext;
}
public IRazorPage Page { get; }
public ViewContext ViewContext { get; }
public ActionDescriptor ActionDescriptor { get; }
public HttpContext HttpContext { get; }
protected override int Count => 4;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(Page), Page),
1 => new KeyValuePair<string, object>(nameof(ViewContext), ViewContext),
2 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
3 => new KeyValuePair<string, object>(nameof(HttpContext), HttpContext),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class AfterViewPage : EventData
{
public const string EventName = EventNamespace +
"Razor." +
nameof(AfterViewPage);
public AfterViewPage(IRazorPage page, ViewContext viewContext, ActionDescriptor actionDescriptor, HttpContext httpContext)
{
Page = page;
ViewContext = viewContext;
ActionDescriptor = actionDescriptor;
HttpContext = httpContext;
}
public IRazorPage Page { get; }
public ViewContext ViewContext { get; }
public ActionDescriptor ActionDescriptor { get; }
public HttpContext HttpContext { get; }
protected override int Count => 4;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(Page), Page),
1 => new KeyValuePair<string, object>(nameof(ViewContext), ViewContext),
2 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
3 => new KeyValuePair<string, object>(nameof(HttpContext), HttpContext),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
}

View File

@ -3,10 +3,12 @@
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.Diagnostics;
using Microsoft.AspNetCore.Http;
namespace Microsoft.AspNetCore.Mvc.Razor
{
internal static class MvcRazorDiagnosticSourceExtensions
internal static class MvcRazorDiagnosticListenerExtensions
{
public static void BeforeViewPage(
this DiagnosticListener diagnosticListener,
@ -25,17 +27,16 @@ namespace Microsoft.AspNetCore.Mvc.Razor
IRazorPage page,
ViewContext viewContext)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.Razor.BeforeViewPage"))
if (diagnosticListener.IsEnabled(Diagnostics.BeforeViewPage.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.Razor.BeforeViewPage",
new
{
page = page,
viewContext = viewContext,
actionDescriptor = viewContext.ActionDescriptor,
httpContext = viewContext.HttpContext,
});
Diagnostics.BeforeViewPage.EventName,
new BeforeViewPage(
page,
viewContext,
viewContext.ActionDescriptor,
viewContext.HttpContext
));
}
}
@ -56,18 +57,17 @@ namespace Microsoft.AspNetCore.Mvc.Razor
IRazorPage page,
ViewContext viewContext)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.Razor.AfterViewPage"))
if (diagnosticListener.IsEnabled(Diagnostics.AfterViewPage.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.Razor.AfterViewPage",
new
{
page = page,
viewContext = viewContext,
actionDescriptor = viewContext.ActionDescriptor,
httpContext = viewContext.HttpContext,
});
Diagnostics.AfterViewPage.EventName,
new AfterViewPage(
page,
viewContext,
viewContext.ActionDescriptor,
viewContext.HttpContext
));
}
}
}
}
}

View File

@ -276,37 +276,12 @@ namespace Microsoft.AspNetCore.Mvc.Razor
public override void BeginContext(int position, int length, bool isLiteral)
{
const string BeginContextEvent = "Microsoft.AspNetCore.Mvc.Razor.BeginInstrumentationContext";
if (DiagnosticSource?.IsEnabled(BeginContextEvent) == true)
{
DiagnosticSource.Write(
BeginContextEvent,
new
{
httpContext = Context,
path = Path,
position = position,
length = length,
isLiteral = isLiteral,
});
}
// noop
}
public override void EndContext()
{
const string EndContextEvent = "Microsoft.AspNetCore.Mvc.Razor.EndInstrumentationContext";
if (DiagnosticSource?.IsEnabled(EndContextEvent) == true)
{
DiagnosticSource.Write(
EndContextEvent,
new
{
httpContext = Context,
path = Path,
});
}
// noop
}
private void EnsureMethodCanBeInvoked(string methodName)

View File

@ -26,7 +26,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
{
public RazorPageActivatorTest()
{
DiagnosticSource = new DiagnosticListener("Microsoft.AspNetCore");
DiagnosticListener = new DiagnosticListener("Microsoft.AspNetCore");
HtmlEncoder = new HtmlTestEncoder();
JsonHelper = Mock.Of<IJsonHelper>();
MetadataProvider = new EmptyModelMetadataProvider();
@ -34,7 +34,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
UrlHelperFactory = new UrlHelperFactory();
}
private DiagnosticSource DiagnosticSource { get; }
private DiagnosticListener DiagnosticListener { get; }
private HtmlEncoder HtmlEncoder { get; }
@ -62,7 +62,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
activator.Activate(instance, viewContext);
// Assert
Assert.Same(DiagnosticSource, instance.DiagnosticSource);
Assert.Same(DiagnosticListener, instance.DiagnosticSource);
Assert.Same(HtmlEncoder, instance.HtmlEncoder);
Assert.Same(JsonHelper, instance.Json);
Assert.Same(urlHelper, instance.Url);
@ -97,7 +97,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
activator.Activate(instance, viewContext);
// Assert
Assert.Same(DiagnosticSource, instance.DiagnosticSource);
Assert.Same(DiagnosticListener, instance.DiagnosticSource);
Assert.Same(HtmlEncoder, instance.HtmlEncoder);
// When we don't have a model property, the activator will just leave ViewData alone.
@ -124,7 +124,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
activator.Activate(instance, viewContext);
// Assert
Assert.Same(DiagnosticSource, instance.DiagnosticSource);
Assert.Same(DiagnosticListener, instance.DiagnosticSource);
Assert.Same(HtmlEncoder, instance.HtmlEncoder);
Assert.Same(JsonHelper, instance.Json);
Assert.Same(urlHelper, instance.Url);
@ -229,7 +229,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
private RazorPageActivator CreateActivator()
{
return new RazorPageActivator(MetadataProvider, UrlHelperFactory, JsonHelper, DiagnosticSource, HtmlEncoder, ModelExpressionProvider);
return new RazorPageActivator(MetadataProvider, UrlHelperFactory, JsonHelper, DiagnosticListener, HtmlEncoder, ModelExpressionProvider);
}
private ViewContext CreateViewContext(ViewDataDictionary viewData = null)

View File

@ -948,216 +948,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor
Assert.Same(HtmlString.Empty, actual);
}
[Fact]
public async Task WriteAttribute_WritesBeginAndEndEvents_ToDiagnosticSource()
{
// Arrange
var path = "path-to-page";
var page = CreatePage(p =>
{
p.HtmlEncoder = new HtmlTestEncoder();
p.BeginWriteAttribute("href", "prefix", 0, "suffix", 34, 2);
p.WriteAttributeValue("prefix", 0, "attr1-value", 8, 14, true);
p.WriteAttributeValue("prefix2", 22, "attr2", 29, 5, false);
p.EndWriteAttribute();
});
page.Path = path;
var adapter = new TestDiagnosticListener();
var diagnosticListener = new DiagnosticListener("Microsoft.AspNetCore.Mvc.Razor");
diagnosticListener.SubscribeWithAdapter(adapter);
page.DiagnosticSource = diagnosticListener;
// Act
await page.ExecuteAsync();
// Assert
Func<object, TestDiagnosticListener.BeginPageInstrumentationData> assertStartEvent = data =>
{
var beginEvent = Assert.IsType<TestDiagnosticListener.BeginPageInstrumentationData>(data);
Assert.NotNull(beginEvent.HttpContext);
Assert.Equal(path, beginEvent.Path);
return beginEvent;
};
Action<object> assertEndEvent = data =>
{
var endEvent = Assert.IsType<TestDiagnosticListener.EndPageInstrumentationData>(data);
Assert.NotNull(endEvent.HttpContext);
Assert.Equal(path, endEvent.Path);
};
Assert.Collection(adapter.PageInstrumentationData,
data =>
{
var beginEvent = assertStartEvent(data);
Assert.Equal(0, beginEvent.Position);
Assert.Equal(6, beginEvent.Length);
Assert.True(beginEvent.IsLiteral);
},
assertEndEvent,
data =>
{
var beginEvent = assertStartEvent(data);
Assert.Equal(0, beginEvent.Position);
Assert.Equal(6, beginEvent.Length);
Assert.True(beginEvent.IsLiteral);
},
assertEndEvent,
data =>
{
var beginEvent = assertStartEvent(data);
Assert.Equal(8, beginEvent.Position);
Assert.Equal(14, beginEvent.Length);
Assert.True(beginEvent.IsLiteral);
},
assertEndEvent,
data =>
{
var beginEvent = assertStartEvent(data);
Assert.Equal(22, beginEvent.Position);
Assert.Equal(7, beginEvent.Length);
Assert.True(beginEvent.IsLiteral);
},
assertEndEvent,
data =>
{
var beginEvent = assertStartEvent(data);
Assert.Equal(29, beginEvent.Position);
Assert.Equal(5, beginEvent.Length);
Assert.False(beginEvent.IsLiteral);
},
assertEndEvent,
data =>
{
var beginEvent = assertStartEvent(data);
Assert.Equal(34, beginEvent.Position);
Assert.Equal(6, beginEvent.Length);
Assert.True(beginEvent.IsLiteral);
},
assertEndEvent);
}
[Fact]
public async Task WriteAttribute_WithBoolValue_WritesBeginAndEndEvents_ToDiagnosticSource()
{
// Arrange
var path = "some-path";
var page = CreatePage(p =>
{
p.HtmlEncoder = new HtmlTestEncoder();
p.BeginWriteAttribute("href", "prefix", 0, "suffix", 10, 1);
p.WriteAttributeValue("", 6, "true", 6, 4, false);
p.EndWriteAttribute();
});
page.Path = path;
var adapter = new TestDiagnosticListener();
var diagnosticListener = new DiagnosticListener("Microsoft.AspNetCore.Mvc.Razor");
diagnosticListener.SubscribeWithAdapter(adapter);
page.DiagnosticSource = diagnosticListener;
// Act
await page.ExecuteAsync();
// Assert
Func<object, TestDiagnosticListener.BeginPageInstrumentationData> assertStartEvent = data =>
{
var beginEvent = Assert.IsType<TestDiagnosticListener.BeginPageInstrumentationData>(data);
Assert.NotNull(beginEvent.HttpContext);
Assert.Equal(path, beginEvent.Path);
return beginEvent;
};
Action<object> assertEndEvent = data =>
{
var endEvent = Assert.IsType<TestDiagnosticListener.EndPageInstrumentationData>(data);
Assert.NotNull(endEvent.HttpContext);
Assert.Equal(path, endEvent.Path);
};
Assert.Collection(adapter.PageInstrumentationData,
data =>
{
var beginEvent = assertStartEvent(data);
Assert.Equal(0, beginEvent.Position);
Assert.Equal(6, beginEvent.Length);
Assert.True(beginEvent.IsLiteral);
},
assertEndEvent,
data =>
{
var beginEvent = assertStartEvent(data);
Assert.Equal(6, beginEvent.Position);
Assert.Equal(4, beginEvent.Length);
Assert.False(beginEvent.IsLiteral);
},
assertEndEvent,
data =>
{
var beginEvent = assertStartEvent(data);
Assert.Equal(10, beginEvent.Position);
Assert.Equal(6, beginEvent.Length);
Assert.True(beginEvent.IsLiteral);
},
assertEndEvent);
}
[Fact]
public async Task WriteAttribute_WritesBeginAndEndEvents_ToDiagnosticSource_OnPrefixAndSuffixValues()
{
// Arrange
var path = "some-path";
var page = CreatePage(p =>
{
p.BeginWriteAttribute("href", "prefix", 0, "tail", 7, 0);
p.EndWriteAttribute();
});
page.Path = path;
var adapter = new TestDiagnosticListener();
var diagnosticListener = new DiagnosticListener("Microsoft.AspNetCore.Mvc.Razor");
diagnosticListener.SubscribeWithAdapter(adapter);
page.DiagnosticSource = diagnosticListener;
// Act
await page.ExecuteAsync();
// Assert
Func<object, TestDiagnosticListener.BeginPageInstrumentationData> assertStartEvent = data =>
{
var beginEvent = Assert.IsType<TestDiagnosticListener.BeginPageInstrumentationData>(data);
Assert.NotNull(beginEvent.HttpContext);
Assert.Equal(path, beginEvent.Path);
return beginEvent;
};
Action<object> assertEndEvent = data =>
{
var endEvent = Assert.IsType<TestDiagnosticListener.EndPageInstrumentationData>(data);
Assert.NotNull(endEvent.HttpContext);
Assert.Equal(path, endEvent.Path);
};
Assert.Collection(adapter.PageInstrumentationData,
data =>
{
var beginEvent = assertStartEvent(data);
Assert.Equal(0, beginEvent.Position);
Assert.Equal(6, beginEvent.Length);
Assert.True(beginEvent.IsLiteral);
},
assertEndEvent,
data =>
{
var beginEvent = assertStartEvent(data);
Assert.Equal(7, beginEvent.Position);
Assert.Equal(4, beginEvent.Length);
Assert.True(beginEvent.IsLiteral);
},
assertEndEvent);
}
public static TheoryData AddHtmlAttributeValues_ValueData
{
get

View File

@ -143,6 +143,132 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
protected virtual bool ShouldApply(Microsoft.AspNetCore.Mvc.ApplicationModels.PageRouteModel action) { throw null; }
}
}
namespace Microsoft.AspNetCore.Mvc.Diagnostics
{
public sealed partial class AfterHandlerMethod : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.AfterHandlerMethod";
public AfterHandlerMethod(Microsoft.AspNetCore.Mvc.ActionContext actionContext, System.Collections.Generic.IReadOnlyDictionary<string, object> arguments, Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.HandlerMethodDescriptor handlerMethodDescriptor, object instance, Microsoft.AspNetCore.Mvc.IActionResult result) { }
public Microsoft.AspNetCore.Mvc.ActionContext ActionContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public System.Collections.Generic.IReadOnlyDictionary<string, object> Arguments { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.HandlerMethodDescriptor HandlerMethodDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public object Instance { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
public Microsoft.AspNetCore.Mvc.IActionResult Result { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
public sealed partial class AfterOnPageHandlerExecuted : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecuted";
public AfterOnPageHandlerExecuted(Microsoft.AspNetCore.Mvc.RazorPages.CompiledPageActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.PageHandlerExecutedContext handlerExecutedContext, Microsoft.AspNetCore.Mvc.Filters.IPageFilter filter) { }
public Microsoft.AspNetCore.Mvc.RazorPages.CompiledPageActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IPageFilter Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.PageHandlerExecutedContext HandlerExecutedContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
}
public sealed partial class AfterOnPageHandlerExecuting : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecuting";
public AfterOnPageHandlerExecuting(Microsoft.AspNetCore.Mvc.RazorPages.CompiledPageActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.PageHandlerExecutingContext handlerExecutingContext, Microsoft.AspNetCore.Mvc.Filters.IPageFilter filter) { }
public Microsoft.AspNetCore.Mvc.RazorPages.CompiledPageActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IPageFilter Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.PageHandlerExecutingContext HandlerExecutingContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
}
public sealed partial class AfterOnPageHandlerExecution : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecution";
public AfterOnPageHandlerExecution(Microsoft.AspNetCore.Mvc.RazorPages.CompiledPageActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.PageHandlerExecutedContext handlerExecutedContext, Microsoft.AspNetCore.Mvc.Filters.IAsyncPageFilter filter) { }
public Microsoft.AspNetCore.Mvc.RazorPages.CompiledPageActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IAsyncPageFilter Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.PageHandlerExecutedContext HandlerExecutedContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
}
public sealed partial class AfterOnPageHandlerSelected : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.AfterOnPageHandlerSelected";
public AfterOnPageHandlerSelected(Microsoft.AspNetCore.Mvc.RazorPages.CompiledPageActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.PageHandlerSelectedContext handlerSelectedContext, Microsoft.AspNetCore.Mvc.Filters.IPageFilter filter) { }
public Microsoft.AspNetCore.Mvc.RazorPages.CompiledPageActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IPageFilter Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.PageHandlerSelectedContext HandlerSelectedContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
}
public sealed partial class AfterOnPageHandlerSelection : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.AfterOnPageHandlerSelection";
public AfterOnPageHandlerSelection(Microsoft.AspNetCore.Mvc.RazorPages.CompiledPageActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.PageHandlerSelectedContext handlerSelectedContext, Microsoft.AspNetCore.Mvc.Filters.IAsyncPageFilter filter) { }
public Microsoft.AspNetCore.Mvc.RazorPages.CompiledPageActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IAsyncPageFilter Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.PageHandlerSelectedContext HandlerSelectedContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
}
public sealed partial class BeforeHandlerMethod : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.BeforeHandlerMethod";
public BeforeHandlerMethod(Microsoft.AspNetCore.Mvc.ActionContext actionContext, System.Collections.Generic.IReadOnlyDictionary<string, object> arguments, Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.HandlerMethodDescriptor handlerMethodDescriptor, object instance) { }
public Microsoft.AspNetCore.Mvc.ActionContext ActionContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public System.Collections.Generic.IReadOnlyDictionary<string, object> Arguments { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.HandlerMethodDescriptor HandlerMethodDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public object Instance { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
}
public sealed partial class BeforeOnPageHandlerExecuted : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecuted";
public BeforeOnPageHandlerExecuted(Microsoft.AspNetCore.Mvc.RazorPages.CompiledPageActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.PageHandlerExecutedContext handlerExecutedContext, Microsoft.AspNetCore.Mvc.Filters.IPageFilter filter) { }
public Microsoft.AspNetCore.Mvc.RazorPages.CompiledPageActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IPageFilter Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.PageHandlerExecutedContext HandlerExecutedContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
}
public sealed partial class BeforeOnPageHandlerExecuting : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecuting";
public BeforeOnPageHandlerExecuting(Microsoft.AspNetCore.Mvc.RazorPages.CompiledPageActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.PageHandlerExecutingContext handlerExecutingContext, Microsoft.AspNetCore.Mvc.Filters.IPageFilter filter) { }
public Microsoft.AspNetCore.Mvc.RazorPages.CompiledPageActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IPageFilter Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.PageHandlerExecutingContext HandlerExecutingContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
}
public sealed partial class BeforeOnPageHandlerExecution : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecution";
public BeforeOnPageHandlerExecution(Microsoft.AspNetCore.Mvc.RazorPages.CompiledPageActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.PageHandlerExecutingContext handlerExecutionContext, Microsoft.AspNetCore.Mvc.Filters.IAsyncPageFilter filter) { }
public Microsoft.AspNetCore.Mvc.RazorPages.CompiledPageActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IAsyncPageFilter Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.PageHandlerExecutingContext HandlerExecutionContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
}
public sealed partial class BeforeOnPageHandlerSelected : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerSelected";
public BeforeOnPageHandlerSelected(Microsoft.AspNetCore.Mvc.RazorPages.CompiledPageActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.PageHandlerSelectedContext handlerSelectedContext, Microsoft.AspNetCore.Mvc.Filters.IPageFilter filter) { }
public Microsoft.AspNetCore.Mvc.RazorPages.CompiledPageActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IPageFilter Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.PageHandlerSelectedContext HandlerSelectedContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
}
public sealed partial class BeforeOnPageHandlerSelection : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerSelection";
public BeforeOnPageHandlerSelection(Microsoft.AspNetCore.Mvc.RazorPages.CompiledPageActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.Filters.PageHandlerSelectedContext handlerSelectedContext, Microsoft.AspNetCore.Mvc.Filters.IAsyncPageFilter filter) { }
public Microsoft.AspNetCore.Mvc.RazorPages.CompiledPageActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.IAsyncPageFilter Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.Filters.PageHandlerSelectedContext HandlerSelectedContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
}
}
namespace Microsoft.AspNetCore.Mvc.Filters
{
public partial interface IAsyncPageFilter : Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata

View File

@ -0,0 +1,333 @@
// 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;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Http;
namespace Microsoft.AspNetCore.Mvc.Diagnostics
{
public sealed class BeforeHandlerMethod : EventData
{
public const string EventName = EventNamespace + nameof(BeforeHandlerMethod);
public BeforeHandlerMethod(ActionContext actionContext, IReadOnlyDictionary<string, object> arguments, HandlerMethodDescriptor handlerMethodDescriptor, object instance)
{
ActionContext = actionContext;
Arguments = arguments;
HandlerMethodDescriptor = handlerMethodDescriptor;
Instance = instance;
}
public ActionContext ActionContext { get; }
public IReadOnlyDictionary<string, object> Arguments { get; }
public HandlerMethodDescriptor HandlerMethodDescriptor { get; }
public object Instance { get; }
protected override int Count => 4;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionContext), ActionContext),
1 => new KeyValuePair<string, object>(nameof(Arguments), Arguments),
2 => new KeyValuePair<string, object>(nameof(HandlerMethodDescriptor), HandlerMethodDescriptor),
3 => new KeyValuePair<string, object>(nameof(Instance), Instance),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class AfterHandlerMethod : EventData
{
public const string EventName = EventNamespace + nameof(AfterHandlerMethod);
public AfterHandlerMethod(ActionContext actionContext, IReadOnlyDictionary<string, object> arguments, HandlerMethodDescriptor handlerMethodDescriptor, object instance, IActionResult result)
{
ActionContext = actionContext;
Arguments = arguments;
HandlerMethodDescriptor = handlerMethodDescriptor;
Instance = instance;
Result = result;
}
public ActionContext ActionContext { get; }
public IReadOnlyDictionary<string, object> Arguments { get; }
public HandlerMethodDescriptor HandlerMethodDescriptor { get; }
public object Instance { get; }
public IActionResult Result { get; }
protected override int Count => 5;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionContext), ActionContext),
1 => new KeyValuePair<string, object>(nameof(Arguments), Arguments),
2 => new KeyValuePair<string, object>(nameof(HandlerMethodDescriptor), HandlerMethodDescriptor),
3 => new KeyValuePair<string, object>(nameof(Instance), Instance),
4 => new KeyValuePair<string, object>(nameof(Result), Result),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class BeforeOnPageHandlerExecution : EventData
{
public const string EventName = EventNamespace + nameof(BeforeOnPageHandlerExecution);
public BeforeOnPageHandlerExecution(CompiledPageActionDescriptor actionDescriptor, PageHandlerExecutingContext handlerExecutionContext, IAsyncPageFilter filter)
{
ActionDescriptor = actionDescriptor;
HandlerExecutionContext = handlerExecutionContext;
Filter = filter;
}
public CompiledPageActionDescriptor ActionDescriptor { get; }
public PageHandlerExecutingContext HandlerExecutionContext { get; }
public IAsyncPageFilter Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(HandlerExecutionContext), HandlerExecutionContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class AfterOnPageHandlerExecution : EventData
{
public const string EventName = EventNamespace + nameof(AfterOnPageHandlerExecution);
public AfterOnPageHandlerExecution(CompiledPageActionDescriptor actionDescriptor, PageHandlerExecutedContext handlerExecutedContext, IAsyncPageFilter filter)
{
ActionDescriptor = actionDescriptor;
HandlerExecutedContext = handlerExecutedContext;
Filter = filter;
}
public CompiledPageActionDescriptor ActionDescriptor { get; }
public PageHandlerExecutedContext HandlerExecutedContext { get; }
public IAsyncPageFilter Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(HandlerExecutedContext), HandlerExecutedContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class BeforeOnPageHandlerExecuting : EventData
{
public const string EventName = EventNamespace + nameof(BeforeOnPageHandlerExecuting);
public BeforeOnPageHandlerExecuting(CompiledPageActionDescriptor actionDescriptor, PageHandlerExecutingContext handlerExecutingContext, IPageFilter filter)
{
ActionDescriptor = actionDescriptor;
HandlerExecutingContext = handlerExecutingContext;
Filter = filter;
}
public CompiledPageActionDescriptor ActionDescriptor { get; }
public PageHandlerExecutingContext HandlerExecutingContext { get; }
public IPageFilter Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(HandlerExecutingContext), HandlerExecutingContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class AfterOnPageHandlerExecuting : EventData
{
public const string EventName = EventNamespace + nameof(AfterOnPageHandlerExecuting);
public AfterOnPageHandlerExecuting(CompiledPageActionDescriptor actionDescriptor, PageHandlerExecutingContext handlerExecutingContext, IPageFilter filter)
{
ActionDescriptor = actionDescriptor;
HandlerExecutingContext = handlerExecutingContext;
Filter = filter;
}
public CompiledPageActionDescriptor ActionDescriptor { get; }
public PageHandlerExecutingContext HandlerExecutingContext { get; }
public IPageFilter Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(HandlerExecutingContext), HandlerExecutingContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class BeforeOnPageHandlerExecuted : EventData
{
public const string EventName = EventNamespace + nameof(BeforeOnPageHandlerExecuted);
public BeforeOnPageHandlerExecuted(CompiledPageActionDescriptor actionDescriptor, PageHandlerExecutedContext handlerExecutedContext, IPageFilter filter)
{
ActionDescriptor = actionDescriptor;
HandlerExecutedContext = handlerExecutedContext;
Filter = filter;
}
public CompiledPageActionDescriptor ActionDescriptor { get; }
public PageHandlerExecutedContext HandlerExecutedContext { get; }
public IPageFilter Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(HandlerExecutedContext), HandlerExecutedContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class AfterOnPageHandlerExecuted : EventData
{
public const string EventName = EventNamespace + nameof(AfterOnPageHandlerExecuted);
public AfterOnPageHandlerExecuted(CompiledPageActionDescriptor actionDescriptor, PageHandlerExecutedContext handlerExecutedContext, IPageFilter filter)
{
ActionDescriptor = actionDescriptor;
HandlerExecutedContext = handlerExecutedContext;
Filter = filter;
}
public CompiledPageActionDescriptor ActionDescriptor { get; }
public PageHandlerExecutedContext HandlerExecutedContext { get; }
public IPageFilter Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(HandlerExecutedContext), HandlerExecutedContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class BeforeOnPageHandlerSelection : EventData
{
public const string EventName = EventNamespace + nameof(BeforeOnPageHandlerSelection);
public BeforeOnPageHandlerSelection(CompiledPageActionDescriptor actionDescriptor, PageHandlerSelectedContext handlerSelectedContext, IAsyncPageFilter filter)
{
ActionDescriptor = actionDescriptor;
HandlerSelectedContext = handlerSelectedContext;
Filter = filter;
}
public CompiledPageActionDescriptor ActionDescriptor { get; }
public PageHandlerSelectedContext HandlerSelectedContext { get; }
public IAsyncPageFilter Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(HandlerSelectedContext), HandlerSelectedContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class AfterOnPageHandlerSelection : EventData
{
public const string EventName = EventNamespace + nameof(AfterOnPageHandlerSelection);
public AfterOnPageHandlerSelection(CompiledPageActionDescriptor actionDescriptor, PageHandlerSelectedContext handlerSelectedContext, IAsyncPageFilter filter)
{
ActionDescriptor = actionDescriptor;
HandlerSelectedContext = handlerSelectedContext;
Filter = filter;
}
public CompiledPageActionDescriptor ActionDescriptor { get; }
public PageHandlerSelectedContext HandlerSelectedContext { get; }
public IAsyncPageFilter Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(HandlerSelectedContext), HandlerSelectedContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class BeforeOnPageHandlerSelected : EventData
{
public const string EventName = EventNamespace + nameof(BeforeOnPageHandlerSelected);
public BeforeOnPageHandlerSelected(CompiledPageActionDescriptor actionDescriptor, PageHandlerSelectedContext handlerSelectedContext, IPageFilter filter)
{
ActionDescriptor = actionDescriptor;
HandlerSelectedContext = handlerSelectedContext;
Filter = filter;
}
public CompiledPageActionDescriptor ActionDescriptor { get; }
public PageHandlerSelectedContext HandlerSelectedContext { get; }
public IPageFilter Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(HandlerSelectedContext), HandlerSelectedContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class AfterOnPageHandlerSelected : EventData
{
public const string EventName = EventNamespace + nameof(AfterOnPageHandlerSelected);
public AfterOnPageHandlerSelected(CompiledPageActionDescriptor actionDescriptor, PageHandlerSelectedContext handlerSelectedContext, IPageFilter filter)
{
ActionDescriptor = actionDescriptor;
HandlerSelectedContext = handlerSelectedContext;
Filter = filter;
}
public CompiledPageActionDescriptor ActionDescriptor { get; }
public PageHandlerSelectedContext HandlerSelectedContext { get; }
public IPageFilter Filter { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(HandlerSelectedContext), HandlerSelectedContext),
2 => new KeyValuePair<string, object>(nameof(Filter), Filter),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
}

View File

@ -5,16 +5,17 @@ using System.Collections.Generic;
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure;
using Microsoft.AspNetCore.Mvc.Diagnostics;
namespace Microsoft.AspNetCore.Mvc.RazorPages
{
internal static class MvcRazorPagesDiagnosticSourceExtensions
internal static class MvcRazorPagesDiagnosticListenerExtensions
{
public static void BeforeHandlerMethod(
this DiagnosticListener diagnosticListener,
ActionContext actionContext,
HandlerMethodDescriptor handlerMethodDescriptor,
IDictionary<string, object> arguments,
IReadOnlyDictionary<string, object> arguments,
object instance)
{
Debug.Assert(diagnosticListener != null);
@ -30,19 +31,18 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
}
}
private static void BeforeHandlerMethodImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, HandlerMethodDescriptor handlerMethodDescriptor, IDictionary<string, object> arguments, object instance)
private static void BeforeHandlerMethodImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, HandlerMethodDescriptor handlerMethodDescriptor, IReadOnlyDictionary<string, object> arguments, object instance)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeHandlerMethod"))
if (diagnosticListener.IsEnabled(Diagnostics.BeforeHandlerMethod.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.BeforeHandlerMethod",
new
{
actionContext = actionContext,
arguments = arguments,
handlerMethodDescriptor = handlerMethodDescriptor,
instance = instance,
});
Diagnostics.BeforeHandlerMethod.EventName,
new BeforeHandlerMethod(
actionContext,
arguments,
handlerMethodDescriptor,
instance
));
}
}
@ -50,7 +50,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
this DiagnosticListener diagnosticListener,
ActionContext actionContext,
HandlerMethodDescriptor handlerMethodDescriptor,
IDictionary<string, object> arguments,
IReadOnlyDictionary<string, object> arguments,
object instance,
IActionResult result)
{
@ -67,20 +67,19 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
}
}
private static void AfterHandlerMethodImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, HandlerMethodDescriptor handlerMethodDescriptor, IDictionary<string, object> arguments, object instance, IActionResult result)
private static void AfterHandlerMethodImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, HandlerMethodDescriptor handlerMethodDescriptor, IReadOnlyDictionary<string, object> arguments, object instance, IActionResult result)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterHandlerMethod"))
if (diagnosticListener.IsEnabled(Diagnostics.AfterHandlerMethod.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.AfterHandlerMethod",
new
{
actionContext = actionContext,
arguments = arguments,
handlerMethodDescriptor = handlerMethodDescriptor,
instance = instance,
result = result
});
Diagnostics.AfterHandlerMethod.EventName,
new AfterHandlerMethod(
actionContext,
arguments,
handlerMethodDescriptor,
instance,
result
));
}
}
@ -102,16 +101,15 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
private static void BeforeOnPageHandlerExecutionImpl(DiagnosticListener diagnosticListener, PageHandlerExecutingContext handlerExecutionContext, IAsyncPageFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecution"))
if (diagnosticListener.IsEnabled(Diagnostics.BeforeOnPageHandlerExecution.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecution",
new
{
actionDescriptor = handlerExecutionContext.ActionDescriptor,
handlerExecutionContext = handlerExecutionContext,
filter = filter
});
Diagnostics.BeforeOnPageHandlerExecution.EventName,
new BeforeOnPageHandlerExecution(
handlerExecutionContext.ActionDescriptor,
handlerExecutionContext,
filter
));
}
}
@ -133,16 +131,15 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
private static void AfterOnPageHandlerExecutionImpl(DiagnosticListener diagnosticListener, PageHandlerExecutedContext handlerExecutedContext, IAsyncPageFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecution"))
if (diagnosticListener.IsEnabled(Diagnostics.AfterOnPageHandlerExecution.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecution",
new
{
actionDescriptor = handlerExecutedContext.ActionDescriptor,
handlerExecutedContext = handlerExecutedContext,
filter = filter
});
Diagnostics.AfterOnPageHandlerExecution.EventName,
new AfterOnPageHandlerExecution(
handlerExecutedContext.ActionDescriptor,
handlerExecutedContext,
filter
));
}
}
@ -164,16 +161,15 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
private static void BeforeOnPageHandlerExecutingImpl(DiagnosticListener diagnosticListener, PageHandlerExecutingContext handlerExecutingContext, IPageFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecuting"))
if (diagnosticListener.IsEnabled(Diagnostics.BeforeOnPageHandlerExecuting.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecuting",
new
{
actionDescriptor = handlerExecutingContext.ActionDescriptor,
handlerExecutingContext = handlerExecutingContext,
filter = filter
});
Diagnostics.BeforeOnPageHandlerExecuting.EventName,
new BeforeOnPageHandlerExecuting(
handlerExecutingContext.ActionDescriptor,
handlerExecutingContext,
filter
));
}
}
@ -195,16 +191,15 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
private static void AfterOnPageHandlerExecutingImpl(DiagnosticListener diagnosticListener, PageHandlerExecutingContext handlerExecutingContext, IPageFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecuting"))
if (diagnosticListener.IsEnabled(Diagnostics.AfterOnPageHandlerExecuting.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecuting",
new
{
actionDescriptor = handlerExecutingContext.ActionDescriptor,
handlerExecutingContext = handlerExecutingContext,
filter = filter
});
Diagnostics.AfterOnPageHandlerExecuting.EventName,
new AfterOnPageHandlerExecuting(
handlerExecutingContext.ActionDescriptor,
handlerExecutingContext,
filter
));
}
}
@ -226,16 +221,15 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
private static void BeforeOnPageHandlerExecutedImpl(DiagnosticListener diagnosticListener, PageHandlerExecutedContext handlerExecutedContext, IPageFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecuted"))
if (diagnosticListener.IsEnabled(Diagnostics.BeforeOnPageHandlerExecuted.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecuted",
new
{
actionDescriptor = handlerExecutedContext.ActionDescriptor,
handlerExecutedContext = handlerExecutedContext,
filter = filter
});
Diagnostics.BeforeOnPageHandlerExecuted.EventName,
new BeforeOnPageHandlerExecuted(
handlerExecutedContext.ActionDescriptor,
handlerExecutedContext,
filter
));
}
}
@ -257,16 +251,15 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
private static void AfterOnPageHandlerExecutedImpl(DiagnosticListener diagnosticListener, PageHandlerExecutedContext handlerExecutedContext, IPageFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecuted"))
if (diagnosticListener.IsEnabled(Diagnostics.AfterOnPageHandlerExecuted.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecuted",
new
{
actionDescriptor = handlerExecutedContext.ActionDescriptor,
handlerExecutedContext = handlerExecutedContext,
filter = filter
});
Diagnostics.AfterOnPageHandlerExecuted.EventName,
new AfterOnPageHandlerExecuted(
handlerExecutedContext.ActionDescriptor,
handlerExecutedContext,
filter
));
}
}
@ -288,16 +281,15 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
private static void BeforeOnPageHandlerSelectionImpl(DiagnosticListener diagnosticListener, PageHandlerSelectedContext handlerSelectedContext, IAsyncPageFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerSelection"))
if (diagnosticListener.IsEnabled(Diagnostics.BeforeOnPageHandlerSelection.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerSelection",
new
{
actionDescriptor = handlerSelectedContext.ActionDescriptor,
handlerSelectedContext = handlerSelectedContext,
filter = filter
});
Diagnostics.BeforeOnPageHandlerSelection.EventName,
new BeforeOnPageHandlerSelection(
handlerSelectedContext.ActionDescriptor,
handlerSelectedContext,
filter
));
}
}
@ -319,16 +311,15 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
private static void AfterOnPageHandlerSelectionImpl(DiagnosticListener diagnosticListener, PageHandlerSelectedContext handlerSelectedContext, IAsyncPageFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnPageHandlerSelection"))
if (diagnosticListener.IsEnabled(Diagnostics.AfterOnPageHandlerSelection.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.AfterOnPageHandlerSelection",
new
{
actionDescriptor = handlerSelectedContext.ActionDescriptor,
handlerSelectedContext = handlerSelectedContext,
filter = filter
});
Diagnostics.AfterOnPageHandlerSelection.EventName,
new AfterOnPageHandlerSelection(
handlerSelectedContext.ActionDescriptor,
handlerSelectedContext,
filter
));
}
}
@ -350,16 +341,15 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
private static void BeforeOnPageHandlerSelectedImpl(DiagnosticListener diagnosticListener, PageHandlerSelectedContext handlerSelectedContext, IPageFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerSelected"))
if (diagnosticListener.IsEnabled(Diagnostics.BeforeOnPageHandlerSelected.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerSelected",
new
{
actionDescriptor = handlerSelectedContext.ActionDescriptor,
handlerSelectedContext = handlerSelectedContext,
filter = filter
});
Diagnostics.BeforeOnPageHandlerSelected.EventName,
new BeforeOnPageHandlerSelected(
handlerSelectedContext.ActionDescriptor,
handlerSelectedContext,
filter
));
}
}
@ -381,16 +371,15 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
private static void AfterOnPageHandlerSelectedImpl(DiagnosticListener diagnosticListener, PageHandlerSelectedContext handlerSelectedContext, IPageFilter filter)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnPageHandlerSelected"))
if (diagnosticListener.IsEnabled(Diagnostics.AfterOnPageHandlerSelected.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.AfterOnPageHandlerSelected",
new
{
actionDescriptor = handlerSelectedContext.ActionDescriptor,
handlerSelectedContext = handlerSelectedContext,
filter = filter
});
Diagnostics.AfterOnPageHandlerSelected.EventName,
new AfterOnPageHandlerSelected(
handlerSelectedContext.ActionDescriptor,
handlerSelectedContext,
filter
));
}
}
}

View File

@ -110,38 +110,13 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
/// <inheritdoc />
public override void BeginContext(int position, int length, bool isLiteral)
{
const string BeginContextEvent = "Microsoft.AspNetCore.Mvc.Razor.BeginInstrumentationContext";
if (DiagnosticSource?.IsEnabled(BeginContextEvent) == true)
{
DiagnosticSource.Write(
BeginContextEvent,
new
{
httpContext = ViewContext,
path = Path,
position = position,
length = length,
isLiteral = isLiteral,
});
}
// noop
}
/// <inheritdoc />
public override void EndContext()
{
const string EndContextEvent = "Microsoft.AspNetCore.Mvc.Razor.EndInstrumentationContext";
if (DiagnosticSource?.IsEnabled(EndContextEvent) == true)
{
DiagnosticSource.Write(
EndContextEvent,
new
{
httpContext = ViewContext,
path = Path,
});
}
// noop
}
/// <summary>

View File

@ -213,6 +213,92 @@ namespace Microsoft.AspNetCore.Mvc
public override System.Threading.Tasks.Task ExecuteResultAsync(Microsoft.AspNetCore.Mvc.ActionContext context) { throw null; }
}
}
namespace Microsoft.AspNetCore.Mvc.Diagnostics
{
public sealed partial class AfterView : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.AfterView";
public AfterView(Microsoft.AspNetCore.Mvc.ViewEngines.IView view, Microsoft.AspNetCore.Mvc.Rendering.ViewContext viewContext) { }
protected override int Count { get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
public Microsoft.AspNetCore.Mvc.ViewEngines.IView View { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.Rendering.ViewContext ViewContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
public sealed partial class AfterViewComponent : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.AfterViewComponent";
public AfterViewComponent(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext viewComponentContext, Microsoft.AspNetCore.Mvc.IViewComponentResult viewComponentResult, object viewComponent) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
public object ViewComponent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext ViewComponentContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.IViewComponentResult ViewComponentResult { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
public sealed partial class BeforeView : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.BeforeView";
public BeforeView(Microsoft.AspNetCore.Mvc.ViewEngines.IView view, Microsoft.AspNetCore.Mvc.Rendering.ViewContext viewContext) { }
protected override int Count { get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
public Microsoft.AspNetCore.Mvc.ViewEngines.IView View { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.Rendering.ViewContext ViewContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
public sealed partial class BeforeViewComponent : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.BeforeViewComponent";
public BeforeViewComponent(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext viewComponentContext, object viewComponent) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
public object ViewComponent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext ViewComponentContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
public sealed partial class ViewComponentAfterViewExecute : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.ViewComponentAfterViewExecute";
public ViewComponentAfterViewExecute(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext viewComponentContext, Microsoft.AspNetCore.Mvc.ViewEngines.IView view) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
public Microsoft.AspNetCore.Mvc.ViewEngines.IView View { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext ViewComponentContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
public sealed partial class ViewComponentBeforeViewExecute : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.ViewComponentBeforeViewExecute";
public ViewComponentBeforeViewExecute(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext viewComponentContext, Microsoft.AspNetCore.Mvc.ViewEngines.IView view) { }
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
public Microsoft.AspNetCore.Mvc.ViewEngines.IView View { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext ViewComponentContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
public sealed partial class ViewFound : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.ViewFound";
public ViewFound(Microsoft.AspNetCore.Mvc.ActionContext actionContext, bool isMainPage, Microsoft.AspNetCore.Mvc.ActionResult result, string viewName, Microsoft.AspNetCore.Mvc.ViewEngines.IView view) { }
public Microsoft.AspNetCore.Mvc.ActionContext ActionContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public bool IsMainPage { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
public Microsoft.AspNetCore.Mvc.ActionResult Result { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Mvc.ViewEngines.IView View { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public string ViewName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
public sealed partial class ViewNotFound : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
{
public const string EventName = "Microsoft.AspNetCore.Mvc.ViewNotFound";
public ViewNotFound(Microsoft.AspNetCore.Mvc.ActionContext actionContext, bool isMainPage, Microsoft.AspNetCore.Mvc.ActionResult result, string viewName, System.Collections.Generic.IEnumerable<string> searchedLocations) { }
public Microsoft.AspNetCore.Mvc.ActionContext ActionContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override int Count { get { throw null; } }
public bool IsMainPage { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
public Microsoft.AspNetCore.Mvc.ActionResult Result { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public System.Collections.Generic.IEnumerable<string> SearchedLocations { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public string ViewName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
}
namespace Microsoft.AspNetCore.Mvc.ModelBinding
{
public static partial class ModelStateDictionaryExtensions
@ -1286,7 +1372,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
public static readonly string DefaultContentType;
protected ViewExecutor(Microsoft.AspNetCore.Mvc.Infrastructure.IHttpResponseStreamWriterFactory writerFactory, Microsoft.AspNetCore.Mvc.ViewEngines.ICompositeViewEngine viewEngine, System.Diagnostics.DiagnosticListener diagnosticListener) { }
public ViewExecutor(Microsoft.Extensions.Options.IOptions<Microsoft.AspNetCore.Mvc.MvcViewOptions> viewOptions, Microsoft.AspNetCore.Mvc.Infrastructure.IHttpResponseStreamWriterFactory writerFactory, Microsoft.AspNetCore.Mvc.ViewEngines.ICompositeViewEngine viewEngine, Microsoft.AspNetCore.Mvc.ViewFeatures.ITempDataDictionaryFactory tempDataFactory, System.Diagnostics.DiagnosticListener diagnosticListener, Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider modelMetadataProvider) { }
protected System.Diagnostics.DiagnosticListener DiagnosticSource { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected System.Diagnostics.DiagnosticListener DiagnosticListener { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider ModelMetadataProvider { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected Microsoft.AspNetCore.Mvc.ViewFeatures.ITempDataDictionaryFactory TempDataFactory { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
protected Microsoft.AspNetCore.Mvc.ViewEngines.IViewEngine ViewEngine { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }

View File

@ -0,0 +1,228 @@
// 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;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewComponents;
using Microsoft.AspNetCore.Mvc.ViewEngines;
namespace Microsoft.AspNetCore.Mvc.Diagnostics
{
public sealed class BeforeViewComponent : EventData
{
public const string EventName = EventNamespace + nameof(BeforeViewComponent);
public BeforeViewComponent(ActionDescriptor actionDescriptor, ViewComponentContext viewComponentContext, object viewComponent)
{
ActionDescriptor = actionDescriptor;
ViewComponentContext = viewComponentContext;
ViewComponent = viewComponent;
}
public ActionDescriptor ActionDescriptor { get; }
public ViewComponentContext ViewComponentContext { get; }
public object ViewComponent { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(ViewComponentContext), ViewComponentContext),
2 => new KeyValuePair<string, object>(nameof(ViewComponent), ViewComponent),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class AfterViewComponent : EventData
{
public const string EventName = EventNamespace + nameof(AfterViewComponent);
public AfterViewComponent(ActionDescriptor actionDescriptor, ViewComponentContext viewComponentContext, IViewComponentResult viewComponentResult, object viewComponent)
{
ActionDescriptor = actionDescriptor;
ViewComponentContext = viewComponentContext;
ViewComponentResult = viewComponentResult;
ViewComponent = viewComponent;
}
public ActionDescriptor ActionDescriptor { get; }
public ViewComponentContext ViewComponentContext { get; }
public IViewComponentResult ViewComponentResult { get; }
public object ViewComponent { get; }
protected override int Count => 4;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(ViewComponentContext), ViewComponentContext),
2 => new KeyValuePair<string, object>(nameof(ViewComponent), ViewComponent),
3 => new KeyValuePair<string, object>(nameof(ViewComponentResult), ViewComponentResult),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class ViewComponentBeforeViewExecute : EventData
{
public const string EventName = EventNamespace + nameof(ViewComponentBeforeViewExecute);
public ViewComponentBeforeViewExecute(ActionDescriptor actionDescriptor, ViewComponentContext viewComponentContext, IView view)
{
ActionDescriptor = actionDescriptor;
ViewComponentContext = viewComponentContext;
View = view;
}
public ActionDescriptor ActionDescriptor { get; }
public ViewComponentContext ViewComponentContext { get; }
public IView View { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(ViewComponentContext), ViewComponentContext),
2 => new KeyValuePair<string, object>(nameof(View), View),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class ViewComponentAfterViewExecute : EventData
{
public const string EventName = EventNamespace + nameof(ViewComponentAfterViewExecute);
public ViewComponentAfterViewExecute(ActionDescriptor actionDescriptor, ViewComponentContext viewComponentContext, IView view)
{
ActionDescriptor = actionDescriptor;
ViewComponentContext = viewComponentContext;
View = view;
}
public ActionDescriptor ActionDescriptor { get; }
public ViewComponentContext ViewComponentContext { get; }
public IView View { get; }
protected override int Count => 3;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
1 => new KeyValuePair<string, object>(nameof(ViewComponentContext), ViewComponentContext),
2 => new KeyValuePair<string, object>(nameof(View), View),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class BeforeView : EventData
{
public const string EventName = EventNamespace + nameof(BeforeView);
public BeforeView(IView view, ViewContext viewContext)
{
View = view;
ViewContext = viewContext;
}
public IView View { get; }
public ViewContext ViewContext { get; }
protected override int Count => 2;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(View), View),
1 => new KeyValuePair<string, object>(nameof(ViewContext), ViewContext),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class AfterView : EventData
{
public const string EventName = EventNamespace + nameof(AfterView);
public AfterView(IView view, ViewContext viewContext)
{
View = view;
ViewContext = viewContext;
}
public IView View { get; }
public ViewContext ViewContext { get; }
protected override int Count => 2;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(View), View),
1 => new KeyValuePair<string, object>(nameof(ViewContext), ViewContext),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class ViewFound : EventData
{
public const string EventName = EventNamespace + nameof(ViewFound);
public ViewFound(ActionContext actionContext, bool isMainPage, ActionResult result, string viewName, IView view)
{
ActionContext = actionContext;
IsMainPage = isMainPage;
Result = result;
ViewName = viewName;
View = view;
}
public ActionContext ActionContext { get; }
public bool IsMainPage { get; }
public ActionResult Result { get; }
public string ViewName { get; }
public IView View { get; }
protected override int Count => 5;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionContext), ActionContext),
1 => new KeyValuePair<string, object>(nameof(IsMainPage), IsMainPage),
2 => new KeyValuePair<string, object>(nameof(Result), Result),
3 => new KeyValuePair<string, object>(nameof(ViewName), ViewName),
4 => new KeyValuePair<string, object>(nameof(View), View),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
public sealed class ViewNotFound : EventData
{
public const string EventName = EventNamespace + nameof(ViewNotFound);
public ViewNotFound(ActionContext actionContext, bool isMainPage, ActionResult result, string viewName, IEnumerable<string> searchedLocations)
{
ActionContext = actionContext;
IsMainPage = isMainPage;
Result = result;
ViewName = viewName;
SearchedLocations = searchedLocations;
}
public ActionContext ActionContext { get; }
public bool IsMainPage { get; }
public ActionResult Result { get; }
public string ViewName { get; }
public IEnumerable<string> SearchedLocations { get; }
protected override int Count => 5;
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(ActionContext), ActionContext),
1 => new KeyValuePair<string, object>(nameof(IsMainPage), IsMainPage),
2 => new KeyValuePair<string, object>(nameof(Result), Result),
3 => new KeyValuePair<string, object>(nameof(ViewName), ViewName),
4 => new KeyValuePair<string, object>(nameof(SearchedLocations), SearchedLocations),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
}

View File

@ -6,10 +6,11 @@ using System.Diagnostics;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewComponents;
using Microsoft.AspNetCore.Mvc.ViewEngines;
using Microsoft.AspNetCore.Mvc.Diagnostics;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
internal static class MvcViewFeaturesDiagnosticSourceExtensions
internal static class MvcViewFeaturesDiagnosticListenerExtensions
{
public static void BeforeViewComponent(
this DiagnosticListener diagnosticListener,
@ -25,16 +26,15 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
private static void BeforeViewComponentImpl(DiagnosticListener diagnosticListener, ViewComponentContext context, object viewComponent)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeViewComponent"))
if (diagnosticListener.IsEnabled(Diagnostics.BeforeViewComponent.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.BeforeViewComponent",
new
{
actionDescriptor = context.ViewContext.ActionDescriptor,
viewComponentContext = context,
viewComponent = viewComponent
});
Diagnostics.BeforeViewComponent.EventName,
new BeforeViewComponent(
context.ViewContext.ActionDescriptor,
context,
viewComponent
));
}
}
@ -53,17 +53,16 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
private static void AfterViewComponentImpl(DiagnosticListener diagnosticListener, ViewComponentContext context, IViewComponentResult result, object viewComponent)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterViewComponent"))
if (diagnosticListener.IsEnabled(Diagnostics.AfterViewComponent.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.AfterViewComponent",
new
{
actionDescriptor = context.ViewContext.ActionDescriptor,
viewComponentContext = context,
viewComponentResult = result,
viewComponent = viewComponent
});
Diagnostics.AfterViewComponent.EventName,
new AfterViewComponent(
context.ViewContext.ActionDescriptor,
context,
result,
viewComponent
));
}
}
@ -81,16 +80,15 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
private static void ViewComponentBeforeViewExecuteImpl(DiagnosticListener diagnosticListener, ViewComponentContext context, IView view)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.ViewComponentBeforeViewExecute"))
if (diagnosticListener.IsEnabled(Diagnostics.ViewComponentBeforeViewExecute.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.ViewComponentBeforeViewExecute",
new
{
actionDescriptor = context.ViewContext.ActionDescriptor,
viewComponentContext = context,
view = view
});
Diagnostics.ViewComponentBeforeViewExecute.EventName,
new ViewComponentBeforeViewExecute(
context.ViewContext.ActionDescriptor,
context,
view
));
}
}
@ -108,16 +106,15 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
private static void ViewComponentAfterViewExecuteImpl(DiagnosticListener diagnosticListener, ViewComponentContext context, IView view)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.ViewComponentAfterViewExecute"))
if (diagnosticListener.IsEnabled(Diagnostics.ViewComponentAfterViewExecute.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.ViewComponentAfterViewExecute",
new
{
actionDescriptor = context.ViewContext.ActionDescriptor,
viewComponentContext = context,
view = view
});
Diagnostics.ViewComponentAfterViewExecute.EventName,
new ViewComponentAfterViewExecute(
context.ViewContext.ActionDescriptor,
context,
view
));
}
}
@ -135,11 +132,11 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
private static void BeforeViewImpl(DiagnosticListener diagnosticListener, IView view, ViewContext viewContext)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeView"))
if (diagnosticListener.IsEnabled(Diagnostics.BeforeView.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.BeforeView",
new { view = view, viewContext = viewContext, });
Diagnostics.BeforeView.EventName,
new BeforeView(view, viewContext));
}
}
@ -157,11 +154,11 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
private static void AfterViewImpl(DiagnosticListener diagnosticListener, IView view, ViewContext viewContext)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterView"))
if (diagnosticListener.IsEnabled(Diagnostics.AfterView.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.AfterView",
new { view = view, viewContext = viewContext, });
Diagnostics.AfterView.EventName,
new AfterView(view, viewContext));
}
}
@ -169,7 +166,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
this DiagnosticListener diagnosticListener,
ActionContext actionContext,
bool isMainPage,
PartialViewResult viewResult,
ActionResult viewResult,
string viewName,
IView view)
{
@ -180,20 +177,19 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
}
}
private static void ViewFoundImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, bool isMainPage, PartialViewResult viewResult, string viewName, IView view)
private static void ViewFoundImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, bool isMainPage, ActionResult viewResult, string viewName, IView view)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.ViewFound"))
if (diagnosticListener.IsEnabled(Diagnostics.ViewFound.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.ViewFound",
new
{
actionContext = actionContext,
isMainPage = isMainPage,
result = viewResult,
viewName = viewName,
view = view,
});
Diagnostics.ViewFound.EventName,
new ViewFound(
actionContext,
isMainPage,
viewResult,
viewName,
view
));
}
}
@ -201,7 +197,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
this DiagnosticListener diagnosticListener,
ActionContext actionContext,
bool isMainPage,
PartialViewResult viewResult,
ActionResult viewResult,
string viewName,
IEnumerable<string> searchedLocations)
{
@ -212,20 +208,19 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
}
}
private static void ViewNotFoundImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, bool isMainPage, PartialViewResult viewResult, string viewName, IEnumerable<string> searchedLocations)
private static void ViewNotFoundImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, bool isMainPage, ActionResult viewResult, string viewName, IEnumerable<string> searchedLocations)
{
if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.ViewNotFound"))
if (diagnosticListener.IsEnabled(Diagnostics.ViewNotFound.EventName))
{
diagnosticListener.Write(
"Microsoft.AspNetCore.Mvc.ViewNotFound",
new
{
actionContext = actionContext,
isMainPage = isMainPage,
result = viewResult,
viewName = viewName,
searchedLocations = searchedLocations,
});
Diagnostics.ViewNotFound.EventName,
new ViewNotFound(
actionContext,
isMainPage,
viewResult,
viewName,
searchedLocations
));
}
}
}

View File

@ -108,7 +108,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
if (result.Success)
{
DiagnosticSource.ViewFound(
DiagnosticListener.ViewFound(
actionContext,
isMainPage: false,
viewResult: viewResult,
@ -119,7 +119,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
}
else
{
DiagnosticSource.ViewNotFound(
DiagnosticListener.ViewNotFound(
actionContext,
isMainPage: false,
viewResult: viewResult,

View File

@ -32,7 +32,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
/// <param name="writerFactory">The <see cref="IHttpResponseStreamWriterFactory"/>.</param>
/// <param name="viewEngine">The <see cref="ICompositeViewEngine"/>.</param>
/// <param name="tempDataFactory">The <see cref="ITempDataDictionaryFactory"/>.</param>
/// <param name="diagnosticListener">The <see cref="DiagnosticSource"/>.</param>
/// <param name="diagnosticListener">The <see cref="DiagnosticListener"/>.</param>
/// <param name="modelMetadataProvider">The <see cref="IModelMetadataProvider" />.</param>
public ViewExecutor(
IOptions<MvcViewOptions> viewOptions,
@ -91,13 +91,13 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
WriterFactory = writerFactory;
ViewEngine = viewEngine;
DiagnosticSource = diagnosticListener;
DiagnosticListener = diagnosticListener;
}
/// <summary>
/// Gets the <see cref="DiagnosticSource"/>.
/// Gets the <see cref="DiagnosticListener"/>.
/// </summary>
protected DiagnosticListener DiagnosticSource { get; }
protected DiagnosticListener DiagnosticListener { get; }
/// <summary>
/// Gets the <see cref="ITempDataDictionaryFactory"/>.
@ -242,11 +242,11 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
viewContext.Writer = writer;
DiagnosticSource.BeforeView(view, viewContext);
DiagnosticListener.BeforeView(view, viewContext);
await view.RenderAsync(viewContext);
DiagnosticSource.AfterView(view, viewContext);
DiagnosticListener.AfterView(view, viewContext);
}
finally
{

View File

@ -107,7 +107,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
}
}
if (DiagnosticSource.IsEnabled())
if (DiagnosticListener.IsEnabled())
{
OutputDiagnostics(actionContext, viewResult, viewName, stopwatch, result);
}
@ -128,35 +128,21 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
if (result.Success)
{
if (DiagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.ViewFound"))
{
DiagnosticSource.Write(
"Microsoft.AspNetCore.Mvc.ViewFound",
new
{
actionContext,
isMainPage = true,
result = viewResult,
viewName,
view = result.View,
});
}
DiagnosticListener.ViewFound(
actionContext,
isMainPage: true,
viewResult,
viewName,
view: result.View);
}
else
{
if (DiagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.ViewNotFound"))
{
DiagnosticSource.Write(
"Microsoft.AspNetCore.Mvc.ViewNotFound",
new
{
actionContext,
isMainPage = true,
result = viewResult,
viewName,
searchedLocations = result.SearchedLocations
});
}
DiagnosticListener.ViewNotFound(
actionContext,
isMainPage: true,
viewResult,
viewName,
searchedLocations: result.SearchedLocations);
}
}

View File

@ -264,7 +264,7 @@ namespace Microsoft.AspNetCore.Mvc
}
[Fact]
public async Task ExecuteResultAsync_ExecutesViewComponent_AndWritesDiagnosticSource()
public async Task ExecuteResultAsync_ExecutesViewComponent_AndWritesDiagnosticListener()
{
// Arrange
var methodInfo = typeof(TextViewComponent).GetMethod(nameof(TextViewComponent.Invoke));

View File

@ -102,7 +102,7 @@ namespace Microsoft.AspNetCore.Mvc
}
[Fact]
public void Execute_ResolvesView_AndWritesDiagnosticSource()
public void Execute_ResolvesView_AndWritesDiagnosticListener()
{
// Arrange
var view = new Mock<IView>(MockBehavior.Strict);