From 2360c09cba101c937afbd0b3d153bb64f3a76417 Mon Sep 17 00:00:00 2001 From: Ben Adams Date: Sun, 30 Jun 2019 23:28:53 +0100 Subject: [PATCH 01/11] MVC use concrete types for DiagnosticListener --- ...pNetCore.Mvc.Abstractions.netcoreapp3.0.cs | 12 + .../src/Diagnostics/MvcDiagnostic.cs | 28 + ...osoft.AspNetCore.Mvc.Core.netcoreapp3.0.cs | 282 +++++++ .../src/Diagnostics/MvcDiagnostics.cs | 709 ++++++++++++++++++ ...=> MvcCoreDiagnosticListenerExtensions.cs} | 449 ++++++----- ...soft.AspNetCore.Mvc.Razor.netcoreapp3.0.cs | 25 + .../src/Diagnostics/MvcDiagnostics.cs | 74 ++ .../src/MvcRazorDiagnosticSourceExtensions.cs | 35 +- ...AspNetCore.Mvc.RazorPages.netcoreapp3.0.cs | 126 ++++ .../src/Diagnostics/MvcDiagnostics.cs | 332 ++++++++ ...RazorPagesDiagnosticListenerExtensions.cs} | 189 +++-- ...pNetCore.Mvc.ViewFeatures.netcoreapp3.0.cs | 88 ++- .../src/Diagnostics/MvcDiagnostics.cs | 228 ++++++ ...ewFeaturesDiagnosticListenerExtensions.cs} | 123 ++- .../src/PartialViewResultExecutor.cs | 4 +- src/Mvc/Mvc.ViewFeatures/src/ViewExecutor.cs | 12 +- .../src/ViewResultExecutor.cs | 40 +- 17 files changed, 2300 insertions(+), 456 deletions(-) create mode 100644 src/Mvc/Mvc.Abstractions/src/Diagnostics/MvcDiagnostic.cs create mode 100644 src/Mvc/Mvc.Core/src/Diagnostics/MvcDiagnostics.cs rename src/Mvc/Mvc.Core/src/{MvcCoreDiagnosticSourceExtensions.cs => MvcCoreDiagnosticListenerExtensions.cs} (68%) create mode 100644 src/Mvc/Mvc.Razor/src/Diagnostics/MvcDiagnostics.cs create mode 100644 src/Mvc/Mvc.RazorPages/src/Diagnostics/MvcDiagnostics.cs rename src/Mvc/Mvc.RazorPages/src/{MvcRazorPagesDiagnosticSourceExtensions.cs => MvcRazorPagesDiagnosticListenerExtensions.cs} (68%) create mode 100644 src/Mvc/Mvc.ViewFeatures/src/Diagnostics/MvcDiagnostics.cs rename src/Mvc/Mvc.ViewFeatures/src/{MvcViewFeaturesDiagnosticSourceExtensions.cs => MvcViewFeaturesDiagnosticListenerExtensions.cs} (62%) diff --git a/src/Mvc/Mvc.Abstractions/ref/Microsoft.AspNetCore.Mvc.Abstractions.netcoreapp3.0.cs b/src/Mvc/Mvc.Abstractions/ref/Microsoft.AspNetCore.Mvc.Abstractions.netcoreapp3.0.cs index 3dc69d93e8a8..677549967807 100644 --- a/src/Mvc/Mvc.Abstractions/ref/Microsoft.AspNetCore.Mvc.Abstractions.netcoreapp3.0.cs +++ b/src/Mvc/Mvc.Abstractions/ref/Microsoft.AspNetCore.Mvc.Abstractions.netcoreapp3.0.cs @@ -209,6 +209,18 @@ public partial interface IAllowAnonymousFilter : Microsoft.AspNetCore.Mvc.Filter { } } +namespace Microsoft.AspNetCore.Mvc.Diagnostics +{ + public abstract partial class MvcDiagnostic : System.Collections.Generic.IEnumerable>, System.Collections.Generic.IReadOnlyCollection>, System.Collections.Generic.IReadOnlyList>, System.Collections.IEnumerable + { + protected const string EventNamespace = "Microsoft.AspNetCore.Mvc."; + protected MvcDiagnostic() { } + public abstract int Count { get; } + public abstract System.Collections.Generic.KeyValuePair this[int index] { get; } + public System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } +} namespace Microsoft.AspNetCore.Mvc.Filters { public partial class ActionExecutedContext : Microsoft.AspNetCore.Mvc.Filters.FilterContext diff --git a/src/Mvc/Mvc.Abstractions/src/Diagnostics/MvcDiagnostic.cs b/src/Mvc/Mvc.Abstractions/src/Diagnostics/MvcDiagnostic.cs new file mode 100644 index 000000000000..763b5a994ceb --- /dev/null +++ b/src/Mvc/Mvc.Abstractions/src/Diagnostics/MvcDiagnostic.cs @@ -0,0 +1,28 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.AspNetCore.Mvc.Diagnostics +{ + public abstract class MvcDiagnostic : IReadOnlyList> + { + protected const string EventNamespace = "Microsoft.AspNetCore.Mvc."; + + public abstract int Count { get; } + public abstract KeyValuePair this[int index] { get; } + public IEnumerator> GetEnumerator() + { + var count = Count; + for (var i = 0; i < count; i++) + { + yield return this[i]; + } + } + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} \ No newline at end of file diff --git a/src/Mvc/Mvc.Core/ref/Microsoft.AspNetCore.Mvc.Core.netcoreapp3.0.cs b/src/Mvc/Mvc.Core/ref/Microsoft.AspNetCore.Mvc.Core.netcoreapp3.0.cs index a895709b2478..f12457d9a2a6 100644 --- a/src/Mvc/Mvc.Core/ref/Microsoft.AspNetCore.Mvc.Core.netcoreapp3.0.cs +++ b/src/Mvc/Mvc.Core/ref/Microsoft.AspNetCore.Mvc.Core.netcoreapp3.0.cs @@ -1718,6 +1718,288 @@ public partial interface IAntiforgeryValidationFailedResult : Microsoft.AspNetCo { } } +namespace Microsoft.AspNetCore.Mvc.Diagnostics +{ + public sealed partial class AfterAction : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public Microsoft.AspNetCore.Http.HttpContext HttpContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + { + public const string EventName = "Microsoft.AspNetCore.Mvc.AfterActionMethod"; + public AfterActionMethod(Microsoft.AspNetCore.Mvc.ActionContext actionContext, System.Collections.Generic.IDictionary 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.IDictionary Arguments { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public object Controller { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override int Count { get { throw null; } } + public override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + } + public sealed partial class AfterOnActionExecuting : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + } + public sealed partial class AfterOnActionExecution : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + } + public sealed partial class AfterOnAuthorization : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + } + public sealed partial class AfterOnException : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + { + 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; } } + public 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; } } + public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + } + public sealed partial class AfterOnResourceExecuted : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public Microsoft.AspNetCore.Http.HttpContext HttpContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + { + public const string EventName = "Microsoft.AspNetCore.Mvc.BeforeActionMethod"; + public BeforeActionMethod(Microsoft.AspNetCore.Mvc.ActionContext actionContext, System.Collections.Generic.IDictionary arguments, object controller) { } + public Microsoft.AspNetCore.Mvc.ActionContext ActionContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Collections.Generic.IDictionary Arguments { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public object Controller { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override int Count { get { throw null; } } + public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + } + public sealed partial class BeforeActionResult : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + } + public sealed partial class BeforeOnActionExecuting : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + } + public sealed partial class BeforeOnActionExecution : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + } + public sealed partial class BeforeOnAuthorization : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + } + public sealed partial class BeforeOnException : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + { + 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; } } + public 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; } } + public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + } + public sealed partial class BeforeOnResourceExecuted : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + public Microsoft.AspNetCore.Mvc.Filters.ResultExecutingContext ResultExecutingContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } +} namespace Microsoft.AspNetCore.Mvc.Filters { [System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=true, Inherited=true)] diff --git a/src/Mvc/Mvc.Core/src/Diagnostics/MvcDiagnostics.cs b/src/Mvc/Mvc.Core/src/Diagnostics/MvcDiagnostics.cs new file mode 100644 index 000000000000..13ec115c8012 --- /dev/null +++ b/src/Mvc/Mvc.Core/src/Diagnostics/MvcDiagnostics.cs @@ -0,0 +1,709 @@ +// 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 : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(BeforeAction); + public ActionDescriptor ActionDescriptor { get; } + public HttpContext HttpContext { get; } + public RouteData RouteData { get; } + + public override int Count => 3; + + public BeforeAction(ActionDescriptor actionDescriptor, HttpContext httpContext, RouteData routeData) + { + ActionDescriptor = actionDescriptor; + HttpContext = httpContext; + RouteData = routeData; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(HttpContext), HttpContext), + 2 => new KeyValuePair(nameof(RouteData), RouteData), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class AfterAction : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(AfterAction); + public ActionDescriptor ActionDescriptor { get; } + public HttpContext HttpContext { get; } + public RouteData RouteData { get; } + + public override int Count => 3; + + public AfterAction(ActionDescriptor actionDescriptor, HttpContext httpContext, RouteData routeData) + { + ActionDescriptor = actionDescriptor; + HttpContext = httpContext; + RouteData = routeData; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(HttpContext), HttpContext), + 2 => new KeyValuePair(nameof(RouteData), RouteData), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class BeforeOnAuthorization : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(BeforeOnAuthorization); + public ActionDescriptor ActionDescriptor { get; } + public AuthorizationFilterContext AuthorizationContext { get; } + public IFilterMetadata Filter { get; } + + public override int Count => 3; + + public BeforeOnAuthorization(ActionDescriptor actionDescriptor, AuthorizationFilterContext authorizationContext, IFilterMetadata filter) + { + ActionDescriptor = actionDescriptor; + AuthorizationContext = authorizationContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(AuthorizationContext), AuthorizationContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class AfterOnAuthorization : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(AfterOnAuthorization); + public ActionDescriptor ActionDescriptor { get; } + public AuthorizationFilterContext AuthorizationContext { get; } + public IFilterMetadata Filter { get; } + + public override int Count => 3; + + public AfterOnAuthorization(ActionDescriptor actionDescriptor, AuthorizationFilterContext authorizationContext, IFilterMetadata filter) + { + ActionDescriptor = actionDescriptor; + AuthorizationContext = authorizationContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(AuthorizationContext), AuthorizationContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class BeforeOnResourceExecution : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(BeforeOnResourceExecution); + public ActionDescriptor ActionDescriptor { get; } + public ResourceExecutingContext ResourceExecutingContext { get; } + public IFilterMetadata Filter { get; } + + public override int Count => 3; + + public BeforeOnResourceExecution(ActionDescriptor actionDescriptor, ResourceExecutingContext resourceExecutingContext, IFilterMetadata filter) + { + ActionDescriptor = actionDescriptor; + ResourceExecutingContext = resourceExecutingContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(ResourceExecutingContext), ResourceExecutingContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class AfterOnResourceExecution : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(AfterOnResourceExecution); + public ActionDescriptor ActionDescriptor { get; } + public ResourceExecutedContext ResourceExecutedContext { get; } + public IFilterMetadata Filter { get; } + + public override int Count => 3; + + public AfterOnResourceExecution(ActionDescriptor actionDescriptor, ResourceExecutedContext resourceExecutedContext, IFilterMetadata filter) + { + ActionDescriptor = actionDescriptor; + ResourceExecutedContext = resourceExecutedContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(ResourceExecutedContext), ResourceExecutedContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class BeforeOnResourceExecuting : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(BeforeOnResourceExecuting); + public ActionDescriptor ActionDescriptor { get; } + public ResourceExecutingContext ResourceExecutingContext { get; } + public IFilterMetadata Filter { get; } + + public override int Count => 3; + + public BeforeOnResourceExecuting(ActionDescriptor actionDescriptor, ResourceExecutingContext resourceExecutingContext, IFilterMetadata filter) + { + ActionDescriptor = actionDescriptor; + ResourceExecutingContext = resourceExecutingContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(ResourceExecutingContext), ResourceExecutingContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class AfterOnResourceExecuting : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(AfterOnResourceExecuting); + public ActionDescriptor ActionDescriptor { get; } + public ResourceExecutingContext ResourceExecutingContext { get; } + public IFilterMetadata Filter { get; } + + public override int Count => 3; + + public AfterOnResourceExecuting(ActionDescriptor actionDescriptor, ResourceExecutingContext resourceExecutingContext, IFilterMetadata filter) + { + ActionDescriptor = actionDescriptor; + ResourceExecutingContext = resourceExecutingContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(ResourceExecutingContext), ResourceExecutingContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class BeforeOnResourceExecuted : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(BeforeOnResourceExecuted); + public ActionDescriptor ActionDescriptor { get; } + public ResourceExecutedContext ResourceExecutedContext { get; } + public IFilterMetadata Filter { get; } + + public override int Count => 3; + + public BeforeOnResourceExecuted(ActionDescriptor actionDescriptor, ResourceExecutedContext resourceExecutedContext, IFilterMetadata filter) + { + ActionDescriptor = actionDescriptor; + ResourceExecutedContext = resourceExecutedContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(ResourceExecutedContext), ResourceExecutedContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class AfterOnResourceExecuted : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(AfterOnResourceExecuted); + public ActionDescriptor ActionDescriptor { get; } + public ResourceExecutedContext ResourceExecutedContext { get; } + public IFilterMetadata Filter { get; } + + public override int Count => 3; + + public AfterOnResourceExecuted(ActionDescriptor actionDescriptor, ResourceExecutedContext resourceExecutedContext, IFilterMetadata filter) + { + ActionDescriptor = actionDescriptor; + ResourceExecutedContext = resourceExecutedContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(ResourceExecutedContext), ResourceExecutedContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class BeforeOnException : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(BeforeOnException); + public ActionDescriptor ActionDescriptor { get; } + public ExceptionContext ExceptionContext { get; } + public IFilterMetadata Filter { get; } + + public override int Count => 3; + + public BeforeOnException(ActionDescriptor actionDescriptor, ExceptionContext exceptionContext, IFilterMetadata filter) + { + ActionDescriptor = actionDescriptor; + ExceptionContext = exceptionContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(ExceptionContext), ExceptionContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class AfterOnException : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(AfterOnException); + public ActionDescriptor ActionDescriptor { get; } + public ExceptionContext ExceptionContext { get; } + public IFilterMetadata Filter { get; } + + public override int Count => 3; + + public AfterOnException(ActionDescriptor actionDescriptor, ExceptionContext exceptionContext, IFilterMetadata filter) + { + ActionDescriptor = actionDescriptor; + ExceptionContext = exceptionContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(ExceptionContext), ExceptionContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class BeforeOnActionExecution : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(BeforeOnActionExecution); + public ActionDescriptor ActionDescriptor { get; } + public ActionExecutingContext ActionExecutingContext { get; } + public IFilterMetadata Filter { get; } + + public override int Count => 3; + + public BeforeOnActionExecution(ActionDescriptor actionDescriptor, ActionExecutingContext actionExecutingContext, IFilterMetadata filter) + { + ActionDescriptor = actionDescriptor; + ActionExecutingContext = actionExecutingContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(ActionExecutingContext), ActionExecutingContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class AfterOnActionExecution : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(AfterOnActionExecution); + public ActionDescriptor ActionDescriptor { get; } + public ActionExecutedContext ActionExecutedContext { get; } + public IFilterMetadata Filter { get; } + + public override int Count => 3; + + public AfterOnActionExecution(ActionDescriptor actionDescriptor, ActionExecutedContext actionExecutedContext, IFilterMetadata filter) + { + ActionDescriptor = actionDescriptor; + ActionExecutedContext = actionExecutedContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(ActionExecutedContext), ActionExecutedContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class BeforeOnActionExecuting : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(BeforeOnActionExecuting); + public ActionDescriptor ActionDescriptor { get; } + public ActionExecutingContext ActionExecutingContext { get; } + public IFilterMetadata Filter { get; } + + public override int Count => 3; + + public BeforeOnActionExecuting(ActionDescriptor actionDescriptor, ActionExecutingContext actionExecutingContext, IFilterMetadata filter) + { + ActionDescriptor = actionDescriptor; + ActionExecutingContext = actionExecutingContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(ActionExecutingContext), ActionExecutingContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class AfterOnActionExecuting : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(AfterOnActionExecuting); + public ActionDescriptor ActionDescriptor { get; } + public ActionExecutingContext ActionExecutingContext { get; } + public IFilterMetadata Filter { get; } + + public override int Count => 3; + + public AfterOnActionExecuting(ActionDescriptor actionDescriptor, ActionExecutingContext actionExecutingContext, IFilterMetadata filter) + { + ActionDescriptor = actionDescriptor; + ActionExecutingContext = actionExecutingContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(ActionExecutingContext), ActionExecutingContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class BeforeOnActionExecuted : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(BeforeOnActionExecuted); + public ActionDescriptor ActionDescriptor { get; } + public ActionExecutedContext ActionExecutedContext { get; } + public IFilterMetadata Filter { get; } + + public override int Count => 3; + + public BeforeOnActionExecuted(ActionDescriptor actionDescriptor, ActionExecutedContext actionExecutedContext, IFilterMetadata filter) + { + ActionDescriptor = actionDescriptor; + ActionExecutedContext = actionExecutedContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(ActionExecutedContext), ActionExecutedContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class AfterOnActionExecuted : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(AfterOnActionExecuted); + public ActionDescriptor ActionDescriptor { get; } + public ActionExecutedContext ActionExecutedContext { get; } + public IFilterMetadata Filter { get; } + + public override int Count => 3; + + public AfterOnActionExecuted(ActionDescriptor actionDescriptor, ActionExecutedContext actionExecutedContext, IFilterMetadata filter) + { + ActionDescriptor = actionDescriptor; + ActionExecutedContext = actionExecutedContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(ActionExecutedContext), ActionExecutedContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class BeforeActionMethod : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(BeforeActionMethod); + public ActionContext ActionContext { get; } + public IDictionary Arguments { get; } + public object Controller { get; } + + public override int Count => 3; + + public BeforeActionMethod(ActionContext actionContext, IDictionary arguments, object controller) + { + ActionContext = actionContext; + Arguments = arguments; + Controller = controller; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionContext), ActionContext), + 1 => new KeyValuePair(nameof(Arguments), Arguments), + 2 => new KeyValuePair(nameof(Controller), Controller), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class AfterActionMethod : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(AfterActionMethod); + public ActionContext ActionContext { get; } + public IDictionary Arguments { get; } + public object Controller { get; } + public IActionResult Result { get; } + + public override int Count => 4; + + public AfterActionMethod(ActionContext actionContext, IDictionary arguments, object controller, IActionResult result) + { + ActionContext = actionContext; + Arguments = arguments; + Controller = controller; + Result = result; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionContext), ActionContext), + 1 => new KeyValuePair(nameof(Controller), Controller), + 2 => new KeyValuePair(nameof(Controller), Controller), + 3 => new KeyValuePair(nameof(Result), Result), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class BeforeOnResultExecution : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(BeforeOnResultExecution); + public ActionDescriptor ActionDescriptor { get; } + public ResultExecutingContext ResultExecutingContext { get; } + public IFilterMetadata Filter { get; } + + public override int Count => 3; + + public BeforeOnResultExecution(ActionDescriptor actionDescriptor, ResultExecutingContext resultExecutingContext, IFilterMetadata filter) + { + ActionDescriptor = actionDescriptor; + ResultExecutingContext = resultExecutingContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(ResultExecutingContext), ResultExecutingContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class AfterOnResultExecution : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(AfterOnResultExecution); + public ActionDescriptor ActionDescriptor { get; } + public ResultExecutedContext ResultExecutedContext { get; } + public IFilterMetadata Filter { get; } + + public override int Count => 3; + + public AfterOnResultExecution(ActionDescriptor actionDescriptor, ResultExecutedContext resultExecutedContext, IFilterMetadata filter) + { + ActionDescriptor = actionDescriptor; + ResultExecutedContext = resultExecutedContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(ResultExecutedContext), ResultExecutedContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class BeforeOnResultExecuting : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(BeforeOnResultExecuting); + public ActionDescriptor ActionDescriptor { get; } + public ResultExecutingContext ResultExecutingContext { get; } + public IFilterMetadata Filter { get; } + + public override int Count => 3; + + public BeforeOnResultExecuting(ActionDescriptor actionDescriptor, ResultExecutingContext resultExecutingContext, IFilterMetadata filter) + { + ActionDescriptor = actionDescriptor; + ResultExecutingContext = resultExecutingContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(ResultExecutingContext), ResultExecutingContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class AfterOnResultExecuting : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(AfterOnResultExecuting); + public ActionDescriptor ActionDescriptor { get; } + public ResultExecutingContext ResultExecutingContext { get; } + public IFilterMetadata Filter { get; } + + public override int Count => 3; + + public AfterOnResultExecuting(ActionDescriptor actionDescriptor, ResultExecutingContext resultExecutingContext, IFilterMetadata filter) + { + ActionDescriptor = actionDescriptor; + ResultExecutingContext = resultExecutingContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(ResultExecutingContext), ResultExecutingContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class BeforeOnResultExecuted : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(BeforeOnResultExecuted); + public ActionDescriptor ActionDescriptor { get; } + public ResultExecutedContext ResultExecutedContext { get; } + public IFilterMetadata Filter { get; } + + public override int Count => 3; + + public BeforeOnResultExecuted(ActionDescriptor actionDescriptor, ResultExecutedContext resultExecutedContext, IFilterMetadata filter) + { + ActionDescriptor = actionDescriptor; + ResultExecutedContext = resultExecutedContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(ResultExecutedContext), ResultExecutedContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class AfterOnResultExecuted : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(AfterOnResultExecuted); + public ActionDescriptor ActionDescriptor { get; } + public ResultExecutedContext ResultExecutedContext { get; } + public IFilterMetadata Filter { get; } + + public override int Count => 3; + + public AfterOnResultExecuted(ActionDescriptor actionDescriptor, ResultExecutedContext resultExecutedContext, IFilterMetadata filter) + { + ActionDescriptor = actionDescriptor; + ResultExecutedContext = resultExecutedContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(ResultExecutedContext), ResultExecutedContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class BeforeActionResult : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(BeforeActionResult); + public ActionContext ActionContext { get; } + public IActionResult Result { get; } + + public override int Count => 2; + + public BeforeActionResult(ActionContext actionContext, IActionResult result) + { + ActionContext = actionContext; + Result = result; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionContext), ActionContext), + 1 => new KeyValuePair(nameof(Result), Result), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class AfterActionResult : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(AfterActionResult); + public ActionContext ActionContext { get; } + public IActionResult Result { get; } + + public override int Count => 2; + + public AfterActionResult(ActionContext actionContext, IActionResult result) + { + ActionContext = actionContext; + Result = result; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionContext), ActionContext), + 1 => new KeyValuePair(nameof(Result), Result), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } +} \ No newline at end of file diff --git a/src/Mvc/Mvc.Core/src/MvcCoreDiagnosticSourceExtensions.cs b/src/Mvc/Mvc.Core/src/MvcCoreDiagnosticListenerExtensions.cs similarity index 68% rename from src/Mvc/Mvc.Core/src/MvcCoreDiagnosticSourceExtensions.cs rename to src/Mvc/Mvc.Core/src/MvcCoreDiagnosticListenerExtensions.cs index 32085e7da866..2ecc946546a4 100644 --- a/src/Mvc/Mvc.Core/src/MvcCoreDiagnosticSourceExtensions.cs +++ b/src/Mvc/Mvc.Core/src/MvcCoreDiagnosticListenerExtensions.cs @@ -5,6 +5,7 @@ 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 @@ public static void BeforeAction( 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 @@ public static void AfterAction( 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 @@ public static void BeforeOnAuthorizationAsync( 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 @@ public static void AfterOnAuthorizationAsync( 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 @@ public static void BeforeOnAuthorization( 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 @@ public static void AfterOnAuthorization( 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 @@ public static void BeforeOnResourceExecution( 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 @@ public static void AfterOnResourceExecution( 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 @@ public static void BeforeOnResourceExecuting( 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 @@ public static void AfterOnResourceExecuting( 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 @@ public static void BeforeOnResourceExecuted( 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 @@ public static void AfterOnResourceExecuted( 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 @@ public static void BeforeOnExceptionAsync( 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 @@ public static void AfterOnExceptionAsync( 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 @@ public static void BeforeOnException( 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 @@ public static void AfterOnException( 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 @@ public static void BeforeOnActionExecution( 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 @@ public static void AfterOnActionExecution( 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 @@ public static void BeforeOnActionExecuting( 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 @@ public static void AfterOnActionExecuting( 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 @@ public static void BeforeOnActionExecuted( 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,16 +660,15 @@ public static void AfterOnActionExecuted( 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 + )); } } @@ -711,16 +692,15 @@ public static void BeforeActionMethod( private static void BeforeActionMethodImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, IDictionary 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 + )); } } @@ -745,17 +725,16 @@ public static void AfterActionMethod( private static void AfterActionMethodImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, IDictionary 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 @@ public static void BeforeOnResultExecution( 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 @@ public static void AfterOnResultExecution( 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 @@ public static void BeforeOnResultExecuting( 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 @@ public static void AfterOnResultExecuting( 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 @@ public static void BeforeOnResultExecuted( 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 @@ public static void AfterOnResultExecuted( 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 @@ public static void BeforeActionResult( 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 @@ public static void AfterActionResult( 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)); } } } diff --git a/src/Mvc/Mvc.Razor/ref/Microsoft.AspNetCore.Mvc.Razor.netcoreapp3.0.cs b/src/Mvc/Mvc.Razor/ref/Microsoft.AspNetCore.Mvc.Razor.netcoreapp3.0.cs index 576821fd5b4b..2c2250d21797 100644 --- a/src/Mvc/Mvc.Razor/ref/Microsoft.AspNetCore.Mvc.Razor.netcoreapp3.0.cs +++ b/src/Mvc/Mvc.Razor/ref/Microsoft.AspNetCore.Mvc.Razor.netcoreapp3.0.cs @@ -21,6 +21,31 @@ public partial interface IRazorCompiledItemProvider System.Collections.Generic.IEnumerable CompiledItems { get; } } } +namespace Microsoft.AspNetCore.Mvc.Diagnostics +{ + public sealed partial class AfterViewPage : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public Microsoft.AspNetCore.Http.HttpContext HttpContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public Microsoft.AspNetCore.Http.HttpContext HttpContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Collections.Generic.KeyValuePair 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 diff --git a/src/Mvc/Mvc.Razor/src/Diagnostics/MvcDiagnostics.cs b/src/Mvc/Mvc.Razor/src/Diagnostics/MvcDiagnostics.cs new file mode 100644 index 000000000000..8cb47f1b65e0 --- /dev/null +++ b/src/Mvc/Mvc.Razor/src/Diagnostics/MvcDiagnostics.cs @@ -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 : MvcDiagnostic + { + public const string EventName = EventNamespace + + "Razor." + + nameof(BeforeViewPage); + + public IRazorPage Page { get; } + public ViewContext ViewContext { get; } + public ActionDescriptor ActionDescriptor { get; } + public HttpContext HttpContext { get; } + + public override int Count => 4; + + public BeforeViewPage(IRazorPage page, ViewContext viewContext, ActionDescriptor actionDescriptor, HttpContext httpContext) + { + Page = page; + ViewContext = viewContext; + ActionDescriptor = actionDescriptor; + HttpContext = httpContext; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(Page), Page), + 1 => new KeyValuePair(nameof(ViewContext), ViewContext), + 2 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 3 => new KeyValuePair(nameof(HttpContext), HttpContext), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class AfterViewPage : MvcDiagnostic + { + public const string EventName = EventNamespace + + "Razor." + + nameof(AfterViewPage); + + public IRazorPage Page { get; } + public ViewContext ViewContext { get; } + public ActionDescriptor ActionDescriptor { get; } + public HttpContext HttpContext { get; } + + public override int Count => 4; + + public AfterViewPage(IRazorPage page, ViewContext viewContext, ActionDescriptor actionDescriptor, HttpContext httpContext) + { + Page = page; + ViewContext = viewContext; + ActionDescriptor = actionDescriptor; + HttpContext = httpContext; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(Page), Page), + 1 => new KeyValuePair(nameof(ViewContext), ViewContext), + 2 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 3 => new KeyValuePair(nameof(HttpContext), HttpContext), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } +} \ No newline at end of file diff --git a/src/Mvc/Mvc.Razor/src/MvcRazorDiagnosticSourceExtensions.cs b/src/Mvc/Mvc.Razor/src/MvcRazorDiagnosticSourceExtensions.cs index f0479ef14301..c07b6f3cf364 100644 --- a/src/Mvc/Mvc.Razor/src/MvcRazorDiagnosticSourceExtensions.cs +++ b/src/Mvc/Mvc.Razor/src/MvcRazorDiagnosticSourceExtensions.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using Microsoft.AspNetCore.Mvc.Rendering; +using Microsoft.AspNetCore.Mvc.Diagnostics; namespace Microsoft.AspNetCore.Mvc.Razor { @@ -25,17 +26,16 @@ private static void BeforeViewPageImpl( 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,17 +56,16 @@ private static void AfterViewPageImpl( 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 + )); } } } diff --git a/src/Mvc/Mvc.RazorPages/ref/Microsoft.AspNetCore.Mvc.RazorPages.netcoreapp3.0.cs b/src/Mvc/Mvc.RazorPages/ref/Microsoft.AspNetCore.Mvc.RazorPages.netcoreapp3.0.cs index 247bcbabcd23..0576893170fc 100644 --- a/src/Mvc/Mvc.RazorPages/ref/Microsoft.AspNetCore.Mvc.RazorPages.netcoreapp3.0.cs +++ b/src/Mvc/Mvc.RazorPages/ref/Microsoft.AspNetCore.Mvc.RazorPages.netcoreapp3.0.cs @@ -143,6 +143,132 @@ public void Apply(Microsoft.AspNetCore.Mvc.ApplicationModels.PageRouteModel mode 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.MvcDiagnostic + { + public const string EventName = "Microsoft.AspNetCore.Mvc.AfterHandlerMethod"; + public AfterHandlerMethod(Microsoft.AspNetCore.Mvc.ActionContext actionContext, System.Collections.Generic.IDictionary 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.IDictionary Arguments { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public 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; } } + public override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + { + 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; } } + public 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; } } + public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + } + public sealed partial class AfterOnPageHandlerExecuting : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + { + 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; } } + public 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; } } + public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + } + public sealed partial class AfterOnPageHandlerExecution : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + { + 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; } } + public 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; } } + public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + } + public sealed partial class AfterOnPageHandlerSelected : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + { + 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; } } + public 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; } } + public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + } + public sealed partial class AfterOnPageHandlerSelection : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + { + 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; } } + public 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; } } + public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + } + public sealed partial class BeforeHandlerMethod : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + { + public const string EventName = "Microsoft.AspNetCore.Mvc.BeforeHandlerMethod"; + public BeforeHandlerMethod(Microsoft.AspNetCore.Mvc.ActionContext actionContext, System.Collections.Generic.IDictionary 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.IDictionary Arguments { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public 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; } } + public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + } + public sealed partial class BeforeOnPageHandlerExecuted : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + { + 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; } } + public 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; } } + public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + } + public sealed partial class BeforeOnPageHandlerExecuting : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + { + 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; } } + public 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; } } + public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + } + public sealed partial class BeforeOnPageHandlerExecution : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + { + 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; } } + public 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; } } + public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + } + public sealed partial class BeforeOnPageHandlerSelected : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + { + 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; } } + public 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; } } + public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + } + public sealed partial class BeforeOnPageHandlerSelection : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + { + 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; } } + public 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; } } + public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + } +} namespace Microsoft.AspNetCore.Mvc.Filters { public partial interface IAsyncPageFilter : Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata diff --git a/src/Mvc/Mvc.RazorPages/src/Diagnostics/MvcDiagnostics.cs b/src/Mvc/Mvc.RazorPages/src/Diagnostics/MvcDiagnostics.cs new file mode 100644 index 000000000000..f459feb334c7 --- /dev/null +++ b/src/Mvc/Mvc.RazorPages/src/Diagnostics/MvcDiagnostics.cs @@ -0,0 +1,332 @@ +// 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; + +namespace Microsoft.AspNetCore.Mvc.Diagnostics +{ + public sealed class BeforeHandlerMethod : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(BeforeHandlerMethod); + + public ActionContext ActionContext { get; } + public IDictionary Arguments { get; } + public HandlerMethodDescriptor HandlerMethodDescriptor { get; } + public object Instance { get; } + + public override int Count => 4; + + public BeforeHandlerMethod(ActionContext actionContext, IDictionary arguments, HandlerMethodDescriptor handlerMethodDescriptor, object instance) + { + ActionContext = actionContext; + Arguments = arguments; + HandlerMethodDescriptor = handlerMethodDescriptor; + Instance = instance; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionContext), ActionContext), + 1 => new KeyValuePair(nameof(Arguments), Arguments), + 2 => new KeyValuePair(nameof(HandlerMethodDescriptor), HandlerMethodDescriptor), + 3 => new KeyValuePair(nameof(Instance), Instance), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class AfterHandlerMethod : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(AfterHandlerMethod); + + public ActionContext ActionContext { get; } + public IDictionary Arguments { get; } + public HandlerMethodDescriptor HandlerMethodDescriptor { get; } + public object Instance { get; } + public IActionResult Result { get; } + + public override int Count => 5; + + public AfterHandlerMethod(ActionContext actionContext, IDictionary arguments, HandlerMethodDescriptor handlerMethodDescriptor, object instance, IActionResult result) + { + ActionContext = actionContext; + Arguments = arguments; + HandlerMethodDescriptor = handlerMethodDescriptor; + Instance = instance; + Result = result; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionContext), ActionContext), + 1 => new KeyValuePair(nameof(Arguments), Arguments), + 2 => new KeyValuePair(nameof(HandlerMethodDescriptor), HandlerMethodDescriptor), + 3 => new KeyValuePair(nameof(Instance), Instance), + 4 => new KeyValuePair(nameof(Result), Result), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class BeforeOnPageHandlerExecution : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(BeforeOnPageHandlerExecution); + + public CompiledPageActionDescriptor ActionDescriptor { get; } + public PageHandlerExecutingContext HandlerExecutionContext { get; } + public IAsyncPageFilter Filter { get; } + + public override int Count => 3; + + public BeforeOnPageHandlerExecution(CompiledPageActionDescriptor actionDescriptor, PageHandlerExecutingContext handlerExecutionContext, IAsyncPageFilter filter) + { + ActionDescriptor = actionDescriptor; + HandlerExecutionContext = handlerExecutionContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(HandlerExecutionContext), HandlerExecutionContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class AfterOnPageHandlerExecution : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(AfterOnPageHandlerExecution); + + public CompiledPageActionDescriptor ActionDescriptor { get; } + public PageHandlerExecutedContext HandlerExecutedContext { get; } + public IAsyncPageFilter Filter { get; } + + public override int Count => 3; + + public AfterOnPageHandlerExecution(CompiledPageActionDescriptor actionDescriptor, PageHandlerExecutedContext handlerExecutedContext, IAsyncPageFilter filter) + { + ActionDescriptor = actionDescriptor; + HandlerExecutedContext = handlerExecutedContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(HandlerExecutedContext), HandlerExecutedContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class BeforeOnPageHandlerExecuting : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(BeforeOnPageHandlerExecuting); + + public CompiledPageActionDescriptor ActionDescriptor { get; } + public PageHandlerExecutingContext HandlerExecutingContext { get; } + public IPageFilter Filter { get; } + + public override int Count => 3; + + public BeforeOnPageHandlerExecuting(CompiledPageActionDescriptor actionDescriptor, PageHandlerExecutingContext handlerExecutingContext, IPageFilter filter) + { + ActionDescriptor = actionDescriptor; + HandlerExecutingContext = handlerExecutingContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(HandlerExecutingContext), HandlerExecutingContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class AfterOnPageHandlerExecuting : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(AfterOnPageHandlerExecuting); + + public CompiledPageActionDescriptor ActionDescriptor { get; } + public PageHandlerExecutingContext HandlerExecutingContext { get; } + public IPageFilter Filter { get; } + + public override int Count => 3; + + public AfterOnPageHandlerExecuting(CompiledPageActionDescriptor actionDescriptor, PageHandlerExecutingContext handlerExecutingContext, IPageFilter filter) + { + ActionDescriptor = actionDescriptor; + HandlerExecutingContext = handlerExecutingContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(HandlerExecutingContext), HandlerExecutingContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class BeforeOnPageHandlerExecuted : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(BeforeOnPageHandlerExecuted); + + public CompiledPageActionDescriptor ActionDescriptor { get; } + public PageHandlerExecutedContext HandlerExecutedContext { get; } + public IPageFilter Filter { get; } + + public override int Count => 3; + + public BeforeOnPageHandlerExecuted(CompiledPageActionDescriptor actionDescriptor, PageHandlerExecutedContext handlerExecutedContext, IPageFilter filter) + { + ActionDescriptor = actionDescriptor; + HandlerExecutedContext = handlerExecutedContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(HandlerExecutedContext), HandlerExecutedContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class AfterOnPageHandlerExecuted : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(AfterOnPageHandlerExecuted); + + public CompiledPageActionDescriptor ActionDescriptor { get; } + public PageHandlerExecutedContext HandlerExecutedContext { get; } + public IPageFilter Filter { get; } + + public override int Count => 3; + + public AfterOnPageHandlerExecuted(CompiledPageActionDescriptor actionDescriptor, PageHandlerExecutedContext handlerExecutedContext, IPageFilter filter) + { + ActionDescriptor = actionDescriptor; + HandlerExecutedContext = handlerExecutedContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(HandlerExecutedContext), HandlerExecutedContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class BeforeOnPageHandlerSelection : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(BeforeOnPageHandlerSelection); + + public CompiledPageActionDescriptor ActionDescriptor { get; } + public PageHandlerSelectedContext HandlerSelectedContext { get; } + public IAsyncPageFilter Filter { get; } + + public override int Count => 3; + + public BeforeOnPageHandlerSelection(CompiledPageActionDescriptor actionDescriptor, PageHandlerSelectedContext handlerSelectedContext, IAsyncPageFilter filter) + { + ActionDescriptor = actionDescriptor; + HandlerSelectedContext = handlerSelectedContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(HandlerSelectedContext), HandlerSelectedContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class AfterOnPageHandlerSelection : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(AfterOnPageHandlerSelection); + + public CompiledPageActionDescriptor ActionDescriptor { get; } + public PageHandlerSelectedContext HandlerSelectedContext { get; } + public IAsyncPageFilter Filter { get; } + + public override int Count => 3; + + public AfterOnPageHandlerSelection(CompiledPageActionDescriptor actionDescriptor, PageHandlerSelectedContext handlerSelectedContext, IAsyncPageFilter filter) + { + ActionDescriptor = actionDescriptor; + HandlerSelectedContext = handlerSelectedContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(HandlerSelectedContext), HandlerSelectedContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class BeforeOnPageHandlerSelected : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(BeforeOnPageHandlerSelected); + + public CompiledPageActionDescriptor ActionDescriptor { get; } + public PageHandlerSelectedContext HandlerSelectedContext { get; } + public IPageFilter Filter { get; } + + public override int Count => 3; + + public BeforeOnPageHandlerSelected(CompiledPageActionDescriptor actionDescriptor, PageHandlerSelectedContext handlerSelectedContext, IPageFilter filter) + { + ActionDescriptor = actionDescriptor; + HandlerSelectedContext = handlerSelectedContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(HandlerSelectedContext), HandlerSelectedContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class AfterOnPageHandlerSelected : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(AfterOnPageHandlerSelected); + + public CompiledPageActionDescriptor ActionDescriptor { get; } + public PageHandlerSelectedContext HandlerSelectedContext { get; } + public IPageFilter Filter { get; } + + public override int Count => 3; + + public AfterOnPageHandlerSelected(CompiledPageActionDescriptor actionDescriptor, PageHandlerSelectedContext handlerSelectedContext, IPageFilter filter) + { + ActionDescriptor = actionDescriptor; + HandlerSelectedContext = handlerSelectedContext; + Filter = filter; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(HandlerSelectedContext), HandlerSelectedContext), + 2 => new KeyValuePair(nameof(Filter), Filter), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } +} \ No newline at end of file diff --git a/src/Mvc/Mvc.RazorPages/src/MvcRazorPagesDiagnosticSourceExtensions.cs b/src/Mvc/Mvc.RazorPages/src/MvcRazorPagesDiagnosticListenerExtensions.cs similarity index 68% rename from src/Mvc/Mvc.RazorPages/src/MvcRazorPagesDiagnosticSourceExtensions.cs rename to src/Mvc/Mvc.RazorPages/src/MvcRazorPagesDiagnosticListenerExtensions.cs index 5747c9828fb4..54be39b1b411 100644 --- a/src/Mvc/Mvc.RazorPages/src/MvcRazorPagesDiagnosticSourceExtensions.cs +++ b/src/Mvc/Mvc.RazorPages/src/MvcRazorPagesDiagnosticListenerExtensions.cs @@ -5,10 +5,11 @@ 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, @@ -32,17 +33,16 @@ public static void BeforeHandlerMethod( private static void BeforeHandlerMethodImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, HandlerMethodDescriptor handlerMethodDescriptor, IDictionary 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 + )); } } @@ -69,18 +69,17 @@ public static void AfterHandlerMethod( private static void AfterHandlerMethodImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, HandlerMethodDescriptor handlerMethodDescriptor, IDictionary 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 @@ public static void BeforeOnPageHandlerExecution( 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 @@ public static void AfterOnPageHandlerExecution( 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 @@ public static void BeforeOnPageHandlerExecuting( 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 @@ public static void AfterOnPageHandlerExecuting( 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 @@ public static void BeforeOnPageHandlerExecuted( 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 @@ public static void AfterOnPageHandlerExecuted( 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 @@ public static void BeforeOnPageHandlerSelection( 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 @@ public static void AfterOnPageHandlerSelection( 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 @@ public static void BeforeOnPageHandlerSelected( 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 @@ public static void AfterOnPageHandlerSelected( 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 + )); } } } diff --git a/src/Mvc/Mvc.ViewFeatures/ref/Microsoft.AspNetCore.Mvc.ViewFeatures.netcoreapp3.0.cs b/src/Mvc/Mvc.ViewFeatures/ref/Microsoft.AspNetCore.Mvc.ViewFeatures.netcoreapp3.0.cs index ad98c18e9ace..de46d66d35b8 100644 --- a/src/Mvc/Mvc.ViewFeatures/ref/Microsoft.AspNetCore.Mvc.ViewFeatures.netcoreapp3.0.cs +++ b/src/Mvc/Mvc.ViewFeatures/ref/Microsoft.AspNetCore.Mvc.ViewFeatures.netcoreapp3.0.cs @@ -213,6 +213,92 @@ public ViewResult() { } 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.MvcDiagnostic + { + public const string EventName = "Microsoft.AspNetCore.Mvc.AfterView"; + public AfterView(Microsoft.AspNetCore.Mvc.ViewEngines.IView view, Microsoft.AspNetCore.Mvc.Rendering.ViewContext viewContext) { } + public override int Count { get { throw null; } } + public override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + { + public const string EventName = "Microsoft.AspNetCore.Mvc.BeforeView"; + public BeforeView(Microsoft.AspNetCore.Mvc.ViewEngines.IView view, Microsoft.AspNetCore.Mvc.Rendering.ViewContext viewContext) { } + public override int Count { get { throw null; } } + public override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + { + 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; } } + public override int Count { get { throw null; } } + public bool IsMainPage { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + { + 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 searchedLocations) { } + public Microsoft.AspNetCore.Mvc.ActionContext ActionContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override int Count { get { throw null; } } + public bool IsMainPage { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + public Microsoft.AspNetCore.Mvc.ActionResult Result { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Collections.Generic.IEnumerable 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 @@ public partial class ViewExecutor 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 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; } } diff --git a/src/Mvc/Mvc.ViewFeatures/src/Diagnostics/MvcDiagnostics.cs b/src/Mvc/Mvc.ViewFeatures/src/Diagnostics/MvcDiagnostics.cs new file mode 100644 index 000000000000..05807ebb88b9 --- /dev/null +++ b/src/Mvc/Mvc.ViewFeatures/src/Diagnostics/MvcDiagnostics.cs @@ -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 : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(BeforeViewComponent); + + public ActionDescriptor ActionDescriptor { get; } + public ViewComponentContext ViewComponentContext { get; } + public object ViewComponent { get; } + + public override int Count => 3; + + public BeforeViewComponent(ActionDescriptor actionDescriptor, ViewComponentContext viewComponentContext, object viewComponent) + { + ActionDescriptor = actionDescriptor; + ViewComponentContext = viewComponentContext; + ViewComponent = viewComponent; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(ViewComponentContext), ViewComponentContext), + 2 => new KeyValuePair(nameof(ViewComponent), ViewComponent), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class AfterViewComponent : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(AfterViewComponent); + + public ActionDescriptor ActionDescriptor { get; } + public ViewComponentContext ViewComponentContext { get; } + public IViewComponentResult ViewComponentResult { get; } + public object ViewComponent { get; } + + public override int Count => 4; + + public AfterViewComponent(ActionDescriptor actionDescriptor, ViewComponentContext viewComponentContext, IViewComponentResult viewComponentResult, object viewComponent) + { + ActionDescriptor = actionDescriptor; + ViewComponentContext = viewComponentContext; + ViewComponentResult = viewComponentResult; + ViewComponent = viewComponent; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(ViewComponentContext), ViewComponentContext), + 2 => new KeyValuePair(nameof(ViewComponent), ViewComponent), + 3 => new KeyValuePair(nameof(ViewComponentResult), ViewComponentResult), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class ViewComponentBeforeViewExecute : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(ViewComponentBeforeViewExecute); + public ActionDescriptor ActionDescriptor { get; } + public ViewComponentContext ViewComponentContext { get; } + public IView View { get; } + + public override int Count => 3; + + public ViewComponentBeforeViewExecute(ActionDescriptor actionDescriptor, ViewComponentContext viewComponentContext, IView view) + { + ActionDescriptor = actionDescriptor; + ViewComponentContext = viewComponentContext; + View = view; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(ViewComponentContext), ViewComponentContext), + 2 => new KeyValuePair(nameof(View), View), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class ViewComponentAfterViewExecute : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(ViewComponentAfterViewExecute); + + public ActionDescriptor ActionDescriptor { get; } + public ViewComponentContext ViewComponentContext { get; } + public IView View { get; } + + public override int Count => 3; + + public ViewComponentAfterViewExecute(ActionDescriptor actionDescriptor, ViewComponentContext viewComponentContext, IView view) + { + ActionDescriptor = actionDescriptor; + ViewComponentContext = viewComponentContext; + View = view; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), + 1 => new KeyValuePair(nameof(ViewComponentContext), ViewComponentContext), + 2 => new KeyValuePair(nameof(View), View), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class BeforeView : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(BeforeView); + + public IView View { get; } + public ViewContext ViewContext { get; } + + public override int Count => 2; + + public BeforeView(IView view, ViewContext viewContext) + { + View = view; + ViewContext = viewContext; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(View), View), + 1 => new KeyValuePair(nameof(ViewContext), ViewContext), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class AfterView : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(AfterView); + + public IView View { get; } + public ViewContext ViewContext { get; } + + public override int Count => 2; + + public AfterView(IView view, ViewContext viewContext) + { + View = view; + ViewContext = viewContext; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(View), View), + 1 => new KeyValuePair(nameof(ViewContext), ViewContext), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class ViewFound : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(ViewFound); + + public ActionContext ActionContext { get; } + public bool IsMainPage { get; } + public ActionResult Result { get; } + public string ViewName { get; } + public IView View { get; } + + public override int Count => 5; + + public ViewFound(ActionContext actionContext, bool isMainPage, ActionResult result, string viewName, IView view) + { + ActionContext = actionContext; + IsMainPage = isMainPage; + Result = result; + ViewName = viewName; + View = view; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionContext), ActionContext), + 1 => new KeyValuePair(nameof(IsMainPage), IsMainPage), + 2 => new KeyValuePair(nameof(Result), Result), + 3 => new KeyValuePair(nameof(ViewName), ViewName), + 4 => new KeyValuePair(nameof(View), View), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class ViewNotFound : MvcDiagnostic + { + public const string EventName = EventNamespace + nameof(ViewNotFound); + + public ActionContext ActionContext { get; } + public bool IsMainPage { get; } + public ActionResult Result { get; } + public string ViewName { get; } + public IEnumerable SearchedLocations { get; } + + public override int Count => 5; + + public ViewNotFound(ActionContext actionContext, bool isMainPage, ActionResult result, string viewName, IEnumerable searchedLocations) + { + ActionContext = actionContext; + IsMainPage = isMainPage; + Result = result; + ViewName = viewName; + SearchedLocations = searchedLocations; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(ActionContext), ActionContext), + 1 => new KeyValuePair(nameof(IsMainPage), IsMainPage), + 2 => new KeyValuePair(nameof(Result), Result), + 3 => new KeyValuePair(nameof(ViewName), ViewName), + 4 => new KeyValuePair(nameof(SearchedLocations), SearchedLocations), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } +} \ No newline at end of file diff --git a/src/Mvc/Mvc.ViewFeatures/src/MvcViewFeaturesDiagnosticSourceExtensions.cs b/src/Mvc/Mvc.ViewFeatures/src/MvcViewFeaturesDiagnosticListenerExtensions.cs similarity index 62% rename from src/Mvc/Mvc.ViewFeatures/src/MvcViewFeaturesDiagnosticSourceExtensions.cs rename to src/Mvc/Mvc.ViewFeatures/src/MvcViewFeaturesDiagnosticListenerExtensions.cs index fa237a7d5dc6..efd7cc8c6c7d 100644 --- a/src/Mvc/Mvc.ViewFeatures/src/MvcViewFeaturesDiagnosticSourceExtensions.cs +++ b/src/Mvc/Mvc.ViewFeatures/src/MvcViewFeaturesDiagnosticListenerExtensions.cs @@ -6,10 +6,11 @@ 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 @@ public static void BeforeViewComponent( 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 @@ public static void AfterViewComponent( 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 @@ public static void ViewComponentBeforeViewExecute( 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 @@ public static void ViewComponentAfterViewExecute( 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 @@ public static void BeforeView( 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 @@ public static void AfterView( 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 @@ public static void ViewFound( this DiagnosticListener diagnosticListener, ActionContext actionContext, bool isMainPage, - PartialViewResult viewResult, + ActionResult viewResult, string viewName, IView view) { @@ -180,20 +177,19 @@ public static void ViewFound( } } - 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 @@ public static void ViewNotFound( this DiagnosticListener diagnosticListener, ActionContext actionContext, bool isMainPage, - PartialViewResult viewResult, + ActionResult viewResult, string viewName, IEnumerable searchedLocations) { @@ -212,20 +208,19 @@ public static void ViewNotFound( } } - private static void ViewNotFoundImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, bool isMainPage, PartialViewResult viewResult, string viewName, IEnumerable searchedLocations) + private static void ViewNotFoundImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, bool isMainPage, ActionResult viewResult, string viewName, IEnumerable 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 + )); } } } diff --git a/src/Mvc/Mvc.ViewFeatures/src/PartialViewResultExecutor.cs b/src/Mvc/Mvc.ViewFeatures/src/PartialViewResultExecutor.cs index 18476d70086b..95b68df50660 100644 --- a/src/Mvc/Mvc.ViewFeatures/src/PartialViewResultExecutor.cs +++ b/src/Mvc/Mvc.ViewFeatures/src/PartialViewResultExecutor.cs @@ -108,7 +108,7 @@ public virtual ViewEngineResult FindView(ActionContext actionContext, PartialVie if (result.Success) { - DiagnosticSource.ViewFound( + DiagnosticListener.ViewFound( actionContext, isMainPage: false, viewResult: viewResult, @@ -119,7 +119,7 @@ public virtual ViewEngineResult FindView(ActionContext actionContext, PartialVie } else { - DiagnosticSource.ViewNotFound( + DiagnosticListener.ViewNotFound( actionContext, isMainPage: false, viewResult: viewResult, diff --git a/src/Mvc/Mvc.ViewFeatures/src/ViewExecutor.cs b/src/Mvc/Mvc.ViewFeatures/src/ViewExecutor.cs index 5ac1031f5607..24ca974c2eee 100644 --- a/src/Mvc/Mvc.ViewFeatures/src/ViewExecutor.cs +++ b/src/Mvc/Mvc.ViewFeatures/src/ViewExecutor.cs @@ -32,7 +32,7 @@ public class ViewExecutor /// The . /// The . /// The . - /// The . + /// The . /// The . public ViewExecutor( IOptions viewOptions, @@ -91,13 +91,13 @@ protected ViewExecutor( WriterFactory = writerFactory; ViewEngine = viewEngine; - DiagnosticSource = diagnosticListener; + DiagnosticListener = diagnosticListener; } /// - /// Gets the . + /// Gets the . /// - protected DiagnosticListener DiagnosticSource { get; } + protected DiagnosticListener DiagnosticListener { get; } /// /// Gets the . @@ -242,11 +242,11 @@ protected async Task ExecuteAsync( { viewContext.Writer = writer; - DiagnosticSource.BeforeView(view, viewContext); + DiagnosticListener.BeforeView(view, viewContext); await view.RenderAsync(viewContext); - DiagnosticSource.AfterView(view, viewContext); + DiagnosticListener.AfterView(view, viewContext); } finally { diff --git a/src/Mvc/Mvc.ViewFeatures/src/ViewResultExecutor.cs b/src/Mvc/Mvc.ViewFeatures/src/ViewResultExecutor.cs index 8cc09aac3c7b..69b8750e2fd6 100644 --- a/src/Mvc/Mvc.ViewFeatures/src/ViewResultExecutor.cs +++ b/src/Mvc/Mvc.ViewFeatures/src/ViewResultExecutor.cs @@ -107,7 +107,7 @@ public virtual ViewEngineResult FindView(ActionContext actionContext, ViewResult } } - if (DiagnosticSource.IsEnabled()) + if (DiagnosticListener.IsEnabled()) { OutputDiagnostics(actionContext, viewResult, viewName, stopwatch, result); } @@ -128,35 +128,21 @@ private void OutputDiagnostics(ActionContext actionContext, ViewResult viewResul { 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); } } From 5d79e9c766ffaf95a1aaf40e517a6b1af3039a81 Mon Sep 17 00:00:00 2001 From: Ben Adams Date: Mon, 1 Jul 2019 12:42:03 +0100 Subject: [PATCH 02/11] Use DiagnosticListener not DiagnosticSource --- .../Hosting/test/HostingApplicationTests.cs | 74 ++++----- src/Http/Http/src/DefaultHttpContext.cs | 2 +- ...ft.AspNetCore.Diagnostics.netcoreapp3.0.cs | 2 +- .../DeveloperExceptionPageMiddleware.cs | 12 +- ...etCore.MiddlewareAnalysis.netcoreapp3.0.cs | 2 +- .../src/AnalysisMiddleware.cs | 12 +- ...soft.AspNetCore.Mvc.Razor.netcoreapp3.0.cs | 25 ++- .../src/Diagnostics/MvcDiagnostics.cs | 66 ++++++++ .../MvcRazorDiagnosticListenerExtensions.cs | 146 ++++++++++++++++++ .../src/MvcRazorDiagnosticSourceExtensions.cs | 72 --------- src/Mvc/Mvc.Razor/src/RazorPage.cs | 35 +---- src/Mvc/Mvc.Razor/src/RazorPageActivator.cs | 4 +- src/Mvc/Mvc.Razor/src/RazorPageBase.cs | 4 +- .../src/RazorPagePropertyActivator.cs | 6 +- .../Mvc.Razor/test/RazorPageActivatorTest.cs | 12 +- src/Mvc/Mvc.Razor/test/RazorPageTest.cs | 12 +- .../src/Diagnostics/MvcDiagnostics.cs | 1 + .../DefaultPageFactoryProvider.cs | 2 +- src/Mvc/Mvc.RazorPages/src/PageBase.cs | 8 +- .../DefaultPageFactoryProviderTest.cs | 8 +- .../test/ViewComponentResultTest.cs | 2 +- .../ViewViewComponentResultTest.cs | 2 +- 22 files changed, 321 insertions(+), 188 deletions(-) create mode 100644 src/Mvc/Mvc.Razor/src/MvcRazorDiagnosticListenerExtensions.cs delete mode 100644 src/Mvc/Mvc.Razor/src/MvcRazorDiagnosticSourceExtensions.cs diff --git a/src/Hosting/Hosting/test/HostingApplicationTests.cs b/src/Hosting/Hosting/test/HostingApplicationTests.cs index fd8680100de8..64d832eb0c5a 100644 --- a/src/Hosting/Hosting/test/HostingApplicationTests.cs +++ b/src/Hosting/Hosting/test/HostingApplicationTests.cs @@ -88,13 +88,13 @@ public void CreateContextWithEnabledLoggerAndRequestIdCreatesActivityAndSetsActi 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 @@ public void ActivityStopDoesNotFireIfNoListenerAttachedForStart() [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 @@ public void ActivityIsNotCreatedWhenIsEnabledForActivityIsFalse() [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 @@ public void ActivityIsCreatedButNotLoggedWhenIsEnabledForActivityStartIsFalse() [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 @@ public void ActivityIsCreatedAndLogged() [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 @@ public void ActivityIsStoppedDuringStopCall() [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 @@ public void ActivityIsStoppedDuringUnhandledExceptionCall() [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 @@ public void ActivityIsAvailableDuringUnhandledExceptionCall() [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 @@ public void ActivityIsAvailibleDuringRequest() [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 @@ public void ActivityParentIdAndBaggeReadFromHeaders() [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 @@ public void ActivityTraceParentAndTraceStateFromHeaders() [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 @@ private static void AssertProperty(object o, string name) } private static HostingApplication CreateApplication(out FeatureCollection features, - DiagnosticListener diagnosticSource = null, ILogger logger = null, Action configure = null) + DiagnosticListener diagnosticListener = null, ILogger logger = null, Action configure = null) { var httpContextFactory = new Mock(); @@ -436,7 +436,7 @@ private static HostingApplication CreateApplication(out FeatureCollection featur var hostingApplication = new HostingApplication( ctx => Task.CompletedTask, logger ?? new NullScopeLogger(), - diagnosticSource ?? new NoopDiagnosticSource(), + diagnosticListener ?? new NoopDiagnosticListener(), httpContextFactory.Object); return hostingApplication; @@ -490,11 +490,11 @@ public void Dispose() } } - 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; } diff --git a/src/Http/Http/src/DefaultHttpContext.cs b/src/Http/Http/src/DefaultHttpContext.cs index cbc24490585f..60e0a185a601 100644 --- a/src/Http/Http/src/DefaultHttpContext.cs +++ b/src/Http/Http/src/DefaultHttpContext.cs @@ -159,7 +159,7 @@ public override ISession Session // 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; diff --git a/src/Middleware/Diagnostics/ref/Microsoft.AspNetCore.Diagnostics.netcoreapp3.0.cs b/src/Middleware/Diagnostics/ref/Microsoft.AspNetCore.Diagnostics.netcoreapp3.0.cs index daf4d6edebf0..6fcf8a75c307 100644 --- a/src/Middleware/Diagnostics/ref/Microsoft.AspNetCore.Diagnostics.netcoreapp3.0.cs +++ b/src/Middleware/Diagnostics/ref/Microsoft.AspNetCore.Diagnostics.netcoreapp3.0.cs @@ -59,7 +59,7 @@ namespace Microsoft.AspNetCore.Diagnostics { public partial class DeveloperExceptionPageMiddleware { - public DeveloperExceptionPageMiddleware(Microsoft.AspNetCore.Http.RequestDelegate next, Microsoft.Extensions.Options.IOptions options, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, Microsoft.AspNetCore.Hosting.IWebHostEnvironment hostingEnvironment, System.Diagnostics.DiagnosticSource diagnosticSource, System.Collections.Generic.IEnumerable filters) { } + public DeveloperExceptionPageMiddleware(Microsoft.AspNetCore.Http.RequestDelegate next, Microsoft.Extensions.Options.IOptions options, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, Microsoft.AspNetCore.Hosting.IWebHostEnvironment hostingEnvironment, System.Diagnostics.DiagnosticListener diagnosticListener, System.Collections.Generic.IEnumerable filters) { } [System.Diagnostics.DebuggerStepThroughAttribute] public System.Threading.Tasks.Task Invoke(Microsoft.AspNetCore.Http.HttpContext context) { throw null; } } diff --git a/src/Middleware/Diagnostics/src/DeveloperExceptionPage/DeveloperExceptionPageMiddleware.cs b/src/Middleware/Diagnostics/src/DeveloperExceptionPage/DeveloperExceptionPageMiddleware.cs index c503194d6c46..e959cd3236ef 100644 --- a/src/Middleware/Diagnostics/src/DeveloperExceptionPage/DeveloperExceptionPageMiddleware.cs +++ b/src/Middleware/Diagnostics/src/DeveloperExceptionPage/DeveloperExceptionPageMiddleware.cs @@ -30,7 +30,7 @@ public class DeveloperExceptionPageMiddleware private readonly DeveloperExceptionPageOptions _options; private readonly ILogger _logger; private readonly IFileProvider _fileProvider; - private readonly DiagnosticSource _diagnosticSource; + private readonly DiagnosticListener _diagnosticListerner; private readonly ExceptionDetailsProvider _exceptionDetailsProvider; private readonly Func _exceptionHandler; private static readonly MediaTypeHeaderValue _textHtmlMediaType = new MediaTypeHeaderValue("text/html"); @@ -42,14 +42,14 @@ public class DeveloperExceptionPageMiddleware /// /// /// - /// + /// /// public DeveloperExceptionPageMiddleware( RequestDelegate next, IOptions options, ILoggerFactory loggerFactory, IWebHostEnvironment hostingEnvironment, - DiagnosticSource diagnosticSource, + DiagnosticListener diagnosticListener, IEnumerable filters) { if (next == null) @@ -71,7 +71,7 @@ public DeveloperExceptionPageMiddleware( _options = options.Value; _logger = loggerFactory.CreateLogger(); _fileProvider = _options.FileProvider ?? hostingEnvironment.ContentRootFileProvider; - _diagnosticSource = diagnosticSource; + _diagnosticListerner = diagnosticListener; _exceptionDetailsProvider = new ExceptionDetailsProvider(_fileProvider, _options.SourceCodeLineCount); _exceptionHandler = DisplayException; @@ -110,9 +110,9 @@ public async Task Invoke(HttpContext context) await _exceptionHandler(new ErrorContext(context, ex)); - if (_diagnosticSource.IsEnabled("Microsoft.AspNetCore.Diagnostics.UnhandledException")) + if (_diagnosticListerner.IsEnabled() && _diagnosticListerner.IsEnabled("Microsoft.AspNetCore.Diagnostics.UnhandledException")) { - _diagnosticSource.Write("Microsoft.AspNetCore.Diagnostics.UnhandledException", new { httpContext = context, exception = ex }); + _diagnosticListerner.Write("Microsoft.AspNetCore.Diagnostics.UnhandledException", new { httpContext = context, exception = ex }); } return; diff --git a/src/Middleware/MiddlewareAnalysis/ref/Microsoft.AspNetCore.MiddlewareAnalysis.netcoreapp3.0.cs b/src/Middleware/MiddlewareAnalysis/ref/Microsoft.AspNetCore.MiddlewareAnalysis.netcoreapp3.0.cs index 34360758588f..766d1c17638f 100644 --- a/src/Middleware/MiddlewareAnalysis/ref/Microsoft.AspNetCore.MiddlewareAnalysis.netcoreapp3.0.cs +++ b/src/Middleware/MiddlewareAnalysis/ref/Microsoft.AspNetCore.MiddlewareAnalysis.netcoreapp3.0.cs @@ -15,7 +15,7 @@ public AnalysisBuilder(Microsoft.AspNetCore.Builder.IApplicationBuilder inner) { } public partial class AnalysisMiddleware { - public AnalysisMiddleware(Microsoft.AspNetCore.Http.RequestDelegate next, System.Diagnostics.DiagnosticSource diagnosticSource, string middlewareName) { } + public AnalysisMiddleware(Microsoft.AspNetCore.Http.RequestDelegate next, System.Diagnostics.DiagnosticListener diagnosticListener, string middlewareName) { } [System.Diagnostics.DebuggerStepThroughAttribute] public System.Threading.Tasks.Task Invoke(Microsoft.AspNetCore.Http.HttpContext httpContext) { throw null; } } diff --git a/src/Middleware/MiddlewareAnalysis/src/AnalysisMiddleware.cs b/src/Middleware/MiddlewareAnalysis/src/AnalysisMiddleware.cs index 081f64f0ceae..3fa9d3e0156d 100644 --- a/src/Middleware/MiddlewareAnalysis/src/AnalysisMiddleware.cs +++ b/src/Middleware/MiddlewareAnalysis/src/AnalysisMiddleware.cs @@ -12,13 +12,13 @@ public class AnalysisMiddleware { private readonly Guid _instanceId = Guid.NewGuid(); private readonly RequestDelegate _next; - private readonly DiagnosticSource _diagnostics; + private readonly DiagnosticListener _diagnostics; private readonly string _middlewareName; - public AnalysisMiddleware(RequestDelegate next, DiagnosticSource diagnosticSource, string middlewareName) + public AnalysisMiddleware(RequestDelegate next, DiagnosticListener diagnosticListener, string middlewareName) { _next = next; - _diagnostics = diagnosticSource; + _diagnostics = diagnosticListener; if (string.IsNullOrEmpty(middlewareName)) { middlewareName = next.Target.GetType().FullName; @@ -29,7 +29,7 @@ public AnalysisMiddleware(RequestDelegate next, DiagnosticSource diagnosticSourc public async Task Invoke(HttpContext httpContext) { var startTimestamp = Stopwatch.GetTimestamp(); - if (_diagnostics.IsEnabled("Microsoft.AspNetCore.MiddlewareAnalysis.MiddlewareStarting")) + if (_diagnostics.IsEnabled() && _diagnostics.IsEnabled("Microsoft.AspNetCore.MiddlewareAnalysis.MiddlewareStarting")) { _diagnostics.Write( "Microsoft.AspNetCore.MiddlewareAnalysis.MiddlewareStarting", @@ -46,7 +46,7 @@ public async Task Invoke(HttpContext httpContext) { await _next(httpContext); - if (_diagnostics.IsEnabled("Microsoft.AspNetCore.MiddlewareAnalysis.MiddlewareFinished")) + if (_diagnostics.IsEnabled() && _diagnostics.IsEnabled("Microsoft.AspNetCore.MiddlewareAnalysis.MiddlewareFinished")) { var currentTimestamp = Stopwatch.GetTimestamp(); _diagnostics.Write( @@ -63,7 +63,7 @@ public async Task Invoke(HttpContext httpContext) } catch (Exception ex) { - if (_diagnostics.IsEnabled("Microsoft.AspNetCore.MiddlewareAnalysis.MiddlewareException")) + if (_diagnostics.IsEnabled() && _diagnostics.IsEnabled("Microsoft.AspNetCore.MiddlewareAnalysis.MiddlewareException")) { var currentTimestamp = Stopwatch.GetTimestamp(); _diagnostics.Write( diff --git a/src/Mvc/Mvc.Razor/ref/Microsoft.AspNetCore.Mvc.Razor.netcoreapp3.0.cs b/src/Mvc/Mvc.Razor/ref/Microsoft.AspNetCore.Mvc.Razor.netcoreapp3.0.cs index 2c2250d21797..7caa416dab76 100644 --- a/src/Mvc/Mvc.Razor/ref/Microsoft.AspNetCore.Mvc.Razor.netcoreapp3.0.cs +++ b/src/Mvc/Mvc.Razor/ref/Microsoft.AspNetCore.Mvc.Razor.netcoreapp3.0.cs @@ -45,6 +45,27 @@ public BeforeViewPage(Microsoft.AspNetCore.Mvc.Razor.IRazorPage page, Microsoft. 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 BeginInstrumentationContext : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + { + public const string EventName = "Microsoft.AspNetCore.Mvc.Razor.BeginInstrumentationContext"; + public BeginInstrumentationContext(Microsoft.AspNetCore.Http.HttpContext httpContext, string path, int position, int length, bool isLiteral) { } + public override int Count { get { throw null; } } + public Microsoft.AspNetCore.Http.HttpContext HttpContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public bool IsLiteral { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + public int Length { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string Path { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public int Position { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } + public sealed partial class EndInstrumentationContext : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + { + public const string EventName = "Microsoft.AspNetCore.Mvc.Razor.EndInstrumentationContext"; + public EndInstrumentationContext(Microsoft.AspNetCore.Http.HttpContext httpContext, string path) { } + public override int Count { get { throw null; } } + public Microsoft.AspNetCore.Http.HttpContext HttpContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + public string Path { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } } namespace Microsoft.AspNetCore.Mvc.Razor { @@ -128,7 +149,7 @@ public void IgnoreSection(string sectionName) { } } public partial class RazorPageActivator : Microsoft.AspNetCore.Mvc.Razor.IRazorPageActivator { - public RazorPageActivator(Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider metadataProvider, Microsoft.AspNetCore.Mvc.Routing.IUrlHelperFactory urlHelperFactory, Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper jsonHelper, System.Diagnostics.DiagnosticSource diagnosticSource, System.Text.Encodings.Web.HtmlEncoder htmlEncoder, Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider modelExpressionProvider) { } + public RazorPageActivator(Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider metadataProvider, Microsoft.AspNetCore.Mvc.Routing.IUrlHelperFactory urlHelperFactory, Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper jsonHelper, System.Diagnostics.DiagnosticListener diagnosticListener, System.Text.Encodings.Web.HtmlEncoder htmlEncoder, Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider modelExpressionProvider) { } public void Activate(Microsoft.AspNetCore.Mvc.Razor.IRazorPage page, Microsoft.AspNetCore.Mvc.Rendering.ViewContext context) { } } public abstract partial class RazorPageBase : Microsoft.AspNetCore.Mvc.Razor.IRazorPage @@ -136,7 +157,7 @@ public abstract partial class RazorPageBase : Microsoft.AspNetCore.Mvc.Razor.IRa protected RazorPageBase() { } public Microsoft.AspNetCore.Html.IHtmlContent BodyContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } [Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] - public System.Diagnostics.DiagnosticSource DiagnosticSource { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Diagnostics.DiagnosticListener DiagnosticListener { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } [Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public System.Text.Encodings.Web.HtmlEncoder HtmlEncoder { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public bool IsLayoutBeingRendered { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } diff --git a/src/Mvc/Mvc.Razor/src/Diagnostics/MvcDiagnostics.cs b/src/Mvc/Mvc.Razor/src/Diagnostics/MvcDiagnostics.cs index 8cb47f1b65e0..bd6506edfeb3 100644 --- a/src/Mvc/Mvc.Razor/src/Diagnostics/MvcDiagnostics.cs +++ b/src/Mvc/Mvc.Razor/src/Diagnostics/MvcDiagnostics.cs @@ -71,4 +71,70 @@ public AfterViewPage(IRazorPage page, ViewContext viewContext, ActionDescriptor _ => throw new IndexOutOfRangeException(nameof(index)) }; } + + public sealed class BeginInstrumentationContext : MvcDiagnostic + { + public const string EventName = EventNamespace + + "Razor." + + nameof(BeginInstrumentationContext); + + public HttpContext HttpContext { get; } + public string Path { get; } + public int Position { get; } + public int Length { get; } + public bool IsLiteral { get; } + + public override int Count => 5; + + public BeginInstrumentationContext( + HttpContext httpContext, + string path, + int position, + int length, + bool isLiteral) + { + HttpContext = httpContext; + Path = path; + Position = position; + Length = length; + IsLiteral = isLiteral; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(HttpContext), HttpContext), + 1 => new KeyValuePair(nameof(Path), Path), + 2 => new KeyValuePair(nameof(Position), Position), + 3 => new KeyValuePair(nameof(Length), Length), + 4 => new KeyValuePair(nameof(IsLiteral), IsLiteral), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } + + public sealed class EndInstrumentationContext : MvcDiagnostic + { + public const string EventName = EventNamespace + + "Razor." + + nameof(EndInstrumentationContext); + + public HttpContext HttpContext { get; } + public string Path { get; } + + public override int Count => 2; + + public EndInstrumentationContext( + HttpContext httpContext, + string path) + { + HttpContext = httpContext; + Path = path; + } + + public override KeyValuePair this[int index] => index switch + { + 0 => new KeyValuePair(nameof(HttpContext), HttpContext), + 1 => new KeyValuePair(nameof(Path), Path), + _ => throw new IndexOutOfRangeException(nameof(index)) + }; + } } \ No newline at end of file diff --git a/src/Mvc/Mvc.Razor/src/MvcRazorDiagnosticListenerExtensions.cs b/src/Mvc/Mvc.Razor/src/MvcRazorDiagnosticListenerExtensions.cs new file mode 100644 index 000000000000..e0e74a6ef76a --- /dev/null +++ b/src/Mvc/Mvc.Razor/src/MvcRazorDiagnosticListenerExtensions.cs @@ -0,0 +1,146 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Diagnostics; +using Microsoft.AspNetCore.Mvc.Rendering; +using Microsoft.AspNetCore.Mvc.Diagnostics; +using Microsoft.AspNetCore.Http; + +namespace Microsoft.AspNetCore.Mvc.Razor +{ + internal static class MvcRazorDiagnosticListenerExtensions + { + public static void BeforeViewPage( + this DiagnosticListener diagnosticListener, + IRazorPage page, + ViewContext viewContext) + { + // Inlinable fast-path check if Diagnositcs is enabled + if (diagnosticListener.IsEnabled()) + { + BeforeViewPageImpl(diagnosticListener, page, viewContext); + } + } + + private static void BeforeViewPageImpl( + this DiagnosticListener diagnosticListener, + IRazorPage page, + ViewContext viewContext) + { + if (diagnosticListener.IsEnabled(Diagnostics.BeforeViewPage.EventName)) + { + diagnosticListener.Write( + Diagnostics.BeforeViewPage.EventName, + new BeforeViewPage( + page, + viewContext, + viewContext.ActionDescriptor, + viewContext.HttpContext + )); + } + } + + public static void AfterViewPage( + this DiagnosticListener diagnosticListener, + IRazorPage page, + ViewContext viewContext) + { + // Inlinable fast-path check if Diagnositcs is enabled + if (diagnosticListener.IsEnabled()) + { + AfterViewPageImpl(diagnosticListener, page, viewContext); + } + } + + private static void AfterViewPageImpl( + this DiagnosticListener diagnosticListener, + IRazorPage page, + ViewContext viewContext) + { + if (diagnosticListener.IsEnabled(Diagnostics.AfterViewPage.EventName)) + { + diagnosticListener.Write( + Diagnostics.AfterViewPage.EventName, + new AfterViewPage( + page, + viewContext, + viewContext.ActionDescriptor, + viewContext.HttpContext + )); + } + } + + public static void BeginInstrumentationContext( + this DiagnosticListener diagnosticListener, + HttpContext httpContext, + string path, + int position, + int length, + bool isLiteral) + { + Debug.Assert(httpContext != null); + Debug.Assert(path != null); + + // Inlinable fast-path check if Diagnositcs is enabled + if (diagnosticListener?.IsEnabled() ?? false) + { + BeginInstrumentationContextImpl(diagnosticListener, httpContext, path, position, length, isLiteral); + } + } + + private static void BeginInstrumentationContextImpl(DiagnosticListener diagnosticListener, + HttpContext httpContext, + string path, + int position, + int length, + bool isLiteral) + { + Debug.Assert(diagnosticListener != null); + + if (diagnosticListener.IsEnabled(Diagnostics.BeginInstrumentationContext.EventName)) + { + diagnosticListener.Write( + Diagnostics.BeginInstrumentationContext.EventName, + new BeginInstrumentationContext( + httpContext, + path, + position, + length, + isLiteral + )); + } + } + + public static void EndInstrumentationContext( + this DiagnosticListener diagnosticListener, + HttpContext httpContext, + string path) + { + Debug.Assert(httpContext != null); + Debug.Assert(path != null); + + // Inlinable fast-path check if Diagnositcs is enabled + if (diagnosticListener?.IsEnabled() ?? false) + { + EndInstrumentationContextImpl(diagnosticListener, httpContext, path); + } + } + + private static void EndInstrumentationContextImpl(DiagnosticListener diagnosticListener, + HttpContext httpContext, + string path) + { + Debug.Assert(diagnosticListener != null); + + if (diagnosticListener.IsEnabled(Diagnostics.EndInstrumentationContext.EventName)) + { + diagnosticListener.Write( + Diagnostics.EndInstrumentationContext.EventName, + new EndInstrumentationContext( + httpContext, + path + )); + } + } + } +} \ No newline at end of file diff --git a/src/Mvc/Mvc.Razor/src/MvcRazorDiagnosticSourceExtensions.cs b/src/Mvc/Mvc.Razor/src/MvcRazorDiagnosticSourceExtensions.cs deleted file mode 100644 index c07b6f3cf364..000000000000 --- a/src/Mvc/Mvc.Razor/src/MvcRazorDiagnosticSourceExtensions.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Diagnostics; -using Microsoft.AspNetCore.Mvc.Rendering; -using Microsoft.AspNetCore.Mvc.Diagnostics; - -namespace Microsoft.AspNetCore.Mvc.Razor -{ - internal static class MvcRazorDiagnosticSourceExtensions - { - public static void BeforeViewPage( - this DiagnosticListener diagnosticListener, - IRazorPage page, - ViewContext viewContext) - { - // Inlinable fast-path check if Diagnositcs is enabled - if (diagnosticListener.IsEnabled()) - { - BeforeViewPageImpl(diagnosticListener, page, viewContext); - } - } - - private static void BeforeViewPageImpl( - this DiagnosticListener diagnosticListener, - IRazorPage page, - ViewContext viewContext) - { - if (diagnosticListener.IsEnabled(Diagnostics.BeforeViewPage.EventName)) - { - diagnosticListener.Write( - Diagnostics.BeforeViewPage.EventName, - new BeforeViewPage( - page, - viewContext, - viewContext.ActionDescriptor, - viewContext.HttpContext - )); - } - } - - public static void AfterViewPage( - this DiagnosticListener diagnosticListener, - IRazorPage page, - ViewContext viewContext) - { - // Inlinable fast-path check if Diagnositcs is enabled - if (diagnosticListener.IsEnabled()) - { - AfterViewPageImpl(diagnosticListener, page, viewContext); - } - } - - private static void AfterViewPageImpl( - this DiagnosticListener diagnosticListener, - IRazorPage page, - ViewContext viewContext) - { - if (diagnosticListener.IsEnabled(Diagnostics.AfterViewPage.EventName)) - { - diagnosticListener.Write( - Diagnostics.AfterViewPage.EventName, - new AfterViewPage( - page, - viewContext, - viewContext.ActionDescriptor, - viewContext.HttpContext - )); - } - } - } -} diff --git a/src/Mvc/Mvc.Razor/src/RazorPage.cs b/src/Mvc/Mvc.Razor/src/RazorPage.cs index 53fd192c241d..c3c57e2dd758 100644 --- a/src/Mvc/Mvc.Razor/src/RazorPage.cs +++ b/src/Mvc/Mvc.Razor/src/RazorPage.cs @@ -274,40 +274,11 @@ public override void EnsureRenderedBodyOrSections() } } - 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, - }); - } - } + public override void BeginContext(int position, int length, bool isLiteral) + => DiagnosticListener.BeginInstrumentationContext(Context, Path, position, length, isLiteral); 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, - }); - } - } + => DiagnosticListener.EndInstrumentationContext(Context, Path); private void EnsureMethodCanBeInvoked(string methodName) { diff --git a/src/Mvc/Mvc.Razor/src/RazorPageActivator.cs b/src/Mvc/Mvc.Razor/src/RazorPageActivator.cs index 9acc858e5a6e..0788d1525453 100644 --- a/src/Mvc/Mvc.Razor/src/RazorPageActivator.cs +++ b/src/Mvc/Mvc.Razor/src/RazorPageActivator.cs @@ -32,7 +32,7 @@ public RazorPageActivator( IModelMetadataProvider metadataProvider, IUrlHelperFactory urlHelperFactory, IJsonHelper jsonHelper, - DiagnosticSource diagnosticSource, + DiagnosticListener diagnosticListener, HtmlEncoder htmlEncoder, IModelExpressionProvider modelExpressionProvider) { @@ -43,7 +43,7 @@ public RazorPageActivator( { UrlHelperAccessor = context => urlHelperFactory.GetUrlHelper(context), JsonHelperAccessor = context => jsonHelper, - DiagnosticSourceAccessor = context => diagnosticSource, + DiagnosticListenerAccessor = context => diagnosticListener, HtmlEncoderAccessor = context => htmlEncoder, ModelExpressionProviderAccessor = context => modelExpressionProvider, }; diff --git a/src/Mvc/Mvc.Razor/src/RazorPageBase.cs b/src/Mvc/Mvc.Razor/src/RazorPageBase.cs index c8af0141b96e..d0fc154fb878 100644 --- a/src/Mvc/Mvc.Razor/src/RazorPageBase.cs +++ b/src/Mvc/Mvc.Razor/src/RazorPageBase.cs @@ -83,10 +83,10 @@ public virtual TextWriter Output public IDictionary PreviousSectionWriters { get; set; } /// - /// Gets or sets a instance used to instrument the page execution. + /// Gets or sets a instance used to instrument the page execution. /// [RazorInject] - public DiagnosticSource DiagnosticSource { get; set; } + public DiagnosticListener DiagnosticListener { get; set; } /// /// Gets the to use when this diff --git a/src/Mvc/Mvc.Razor/src/RazorPagePropertyActivator.cs b/src/Mvc/Mvc.Razor/src/RazorPagePropertyActivator.cs index 5bcba01b62c3..81ff939f71ce 100644 --- a/src/Mvc/Mvc.Razor/src/RazorPagePropertyActivator.cs +++ b/src/Mvc/Mvc.Razor/src/RazorPagePropertyActivator.cs @@ -108,9 +108,9 @@ private static PropertyActivator CreateActivateInfo( { valueAccessor = valueAccessors.JsonHelperAccessor; } - else if (property.PropertyType == typeof(DiagnosticSource)) + else if (property.PropertyType == typeof(DiagnosticListener)) { - valueAccessor = valueAccessors.DiagnosticSourceAccessor; + valueAccessor = valueAccessors.DiagnosticListenerAccessor; } else if (property.PropertyType == typeof(HtmlEncoder)) { @@ -141,7 +141,7 @@ public class PropertyValueAccessors public Func JsonHelperAccessor { get; set; } - public Func DiagnosticSourceAccessor { get; set; } + public Func DiagnosticListenerAccessor { get; set; } public Func HtmlEncoderAccessor { get; set; } diff --git a/src/Mvc/Mvc.Razor/test/RazorPageActivatorTest.cs b/src/Mvc/Mvc.Razor/test/RazorPageActivatorTest.cs index f4e3a8d97ad8..ebf87154ba78 100644 --- a/src/Mvc/Mvc.Razor/test/RazorPageActivatorTest.cs +++ b/src/Mvc/Mvc.Razor/test/RazorPageActivatorTest.cs @@ -26,7 +26,7 @@ public class RazorPageActivatorTest { public RazorPageActivatorTest() { - DiagnosticSource = new DiagnosticListener("Microsoft.AspNetCore"); + DiagnosticListener = new DiagnosticListener("Microsoft.AspNetCore"); HtmlEncoder = new HtmlTestEncoder(); JsonHelper = Mock.Of(); MetadataProvider = new EmptyModelMetadataProvider(); @@ -34,7 +34,7 @@ public RazorPageActivatorTest() UrlHelperFactory = new UrlHelperFactory(); } - private DiagnosticSource DiagnosticSource { get; } + private DiagnosticListener DiagnosticListener { get; } private HtmlEncoder HtmlEncoder { get; } @@ -62,7 +62,7 @@ public void Activate_ContextualizesServices_AndSetsProperties_OnPage() activator.Activate(instance, viewContext); // Assert - Assert.Same(DiagnosticSource, instance.DiagnosticSource); + Assert.Same(DiagnosticListener, instance.DiagnosticListener); Assert.Same(HtmlEncoder, instance.HtmlEncoder); Assert.Same(JsonHelper, instance.Json); Assert.Same(urlHelper, instance.Url); @@ -97,7 +97,7 @@ public void Activate_ContextualizesServices_AndSetsProperties_OnPageWithoutModel activator.Activate(instance, viewContext); // Assert - Assert.Same(DiagnosticSource, instance.DiagnosticSource); + Assert.Same(DiagnosticListener, instance.DiagnosticListener); Assert.Same(HtmlEncoder, instance.HtmlEncoder); // When we don't have a model property, the activator will just leave ViewData alone. @@ -124,7 +124,7 @@ public void Activate_InstantiatesNewViewDataDictionaryType_IfTheTypeDoesNotMatch activator.Activate(instance, viewContext); // Assert - Assert.Same(DiagnosticSource, instance.DiagnosticSource); + Assert.Same(DiagnosticListener, instance.DiagnosticListener); Assert.Same(HtmlEncoder, instance.HtmlEncoder); Assert.Same(JsonHelper, instance.Json); Assert.Same(urlHelper, instance.Url); @@ -229,7 +229,7 @@ public void GetOrAddCacheEntry_VariesByModelType_IfPageIsModelTypeProvider() 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) diff --git a/src/Mvc/Mvc.Razor/test/RazorPageTest.cs b/src/Mvc/Mvc.Razor/test/RazorPageTest.cs index 8475c8a2fcdc..0c843f655636 100644 --- a/src/Mvc/Mvc.Razor/test/RazorPageTest.cs +++ b/src/Mvc/Mvc.Razor/test/RazorPageTest.cs @@ -949,7 +949,7 @@ public async Task FlushAsync_ReturnsEmptyHtmlString() } [Fact] - public async Task WriteAttribute_WritesBeginAndEndEvents_ToDiagnosticSource() + public async Task WriteAttribute_WritesBeginAndEndEvents_ToDiagnosticListener() { // Arrange var path = "path-to-page"; @@ -965,7 +965,7 @@ public async Task WriteAttribute_WritesBeginAndEndEvents_ToDiagnosticSource() var adapter = new TestDiagnosticListener(); var diagnosticListener = new DiagnosticListener("Microsoft.AspNetCore.Mvc.Razor"); diagnosticListener.SubscribeWithAdapter(adapter); - page.DiagnosticSource = diagnosticListener; + page.DiagnosticListener = diagnosticListener; // Act await page.ExecuteAsync(); @@ -1039,7 +1039,7 @@ public async Task WriteAttribute_WritesBeginAndEndEvents_ToDiagnosticSource() } [Fact] - public async Task WriteAttribute_WithBoolValue_WritesBeginAndEndEvents_ToDiagnosticSource() + public async Task WriteAttribute_WithBoolValue_WritesBeginAndEndEvents_ToDiagnosticListener() { // Arrange var path = "some-path"; @@ -1054,7 +1054,7 @@ public async Task WriteAttribute_WithBoolValue_WritesBeginAndEndEvents_ToDiagnos var adapter = new TestDiagnosticListener(); var diagnosticListener = new DiagnosticListener("Microsoft.AspNetCore.Mvc.Razor"); diagnosticListener.SubscribeWithAdapter(adapter); - page.DiagnosticSource = diagnosticListener; + page.DiagnosticListener = diagnosticListener; // Act await page.ExecuteAsync(); @@ -1104,7 +1104,7 @@ public async Task WriteAttribute_WithBoolValue_WritesBeginAndEndEvents_ToDiagnos } [Fact] - public async Task WriteAttribute_WritesBeginAndEndEvents_ToDiagnosticSource_OnPrefixAndSuffixValues() + public async Task WriteAttribute_WritesBeginAndEndEvents_ToDiagnosticListener_OnPrefixAndSuffixValues() { // Arrange var path = "some-path"; @@ -1117,7 +1117,7 @@ public async Task WriteAttribute_WritesBeginAndEndEvents_ToDiagnosticSource_OnPr var adapter = new TestDiagnosticListener(); var diagnosticListener = new DiagnosticListener("Microsoft.AspNetCore.Mvc.Razor"); diagnosticListener.SubscribeWithAdapter(adapter); - page.DiagnosticSource = diagnosticListener; + page.DiagnosticListener = diagnosticListener; // Act await page.ExecuteAsync(); diff --git a/src/Mvc/Mvc.RazorPages/src/Diagnostics/MvcDiagnostics.cs b/src/Mvc/Mvc.RazorPages/src/Diagnostics/MvcDiagnostics.cs index f459feb334c7..0ca659cec45b 100644 --- a/src/Mvc/Mvc.RazorPages/src/Diagnostics/MvcDiagnostics.cs +++ b/src/Mvc/Mvc.RazorPages/src/Diagnostics/MvcDiagnostics.cs @@ -6,6 +6,7 @@ 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 { diff --git a/src/Mvc/Mvc.RazorPages/src/Infrastructure/DefaultPageFactoryProvider.cs b/src/Mvc/Mvc.RazorPages/src/Infrastructure/DefaultPageFactoryProvider.cs index 607586c7ccc1..4a9a0483377d 100644 --- a/src/Mvc/Mvc.RazorPages/src/Infrastructure/DefaultPageFactoryProvider.cs +++ b/src/Mvc/Mvc.RazorPages/src/Infrastructure/DefaultPageFactoryProvider.cs @@ -34,7 +34,7 @@ public DefaultPageFactoryProvider( { UrlHelperAccessor = context => urlHelperFactory.GetUrlHelper(context), JsonHelperAccessor = context => jsonHelper, - DiagnosticSourceAccessor = context => diagnosticListener, + DiagnosticListenerAccessor = context => diagnosticListener, HtmlEncoderAccessor = context => htmlEncoder, ModelExpressionProviderAccessor = context => modelExpressionProvider, }; diff --git a/src/Mvc/Mvc.RazorPages/src/PageBase.cs b/src/Mvc/Mvc.RazorPages/src/PageBase.cs index 1d43071cf740..d7eaa1849543 100644 --- a/src/Mvc/Mvc.RazorPages/src/PageBase.cs +++ b/src/Mvc/Mvc.RazorPages/src/PageBase.cs @@ -112,9 +112,9 @@ public override void BeginContext(int position, int length, bool isLiteral) { const string BeginContextEvent = "Microsoft.AspNetCore.Mvc.Razor.BeginInstrumentationContext"; - if (DiagnosticSource?.IsEnabled(BeginContextEvent) == true) + if ((DiagnosticListener?.IsEnabled() ?? false) && DiagnosticListener?.IsEnabled(BeginContextEvent) == true) { - DiagnosticSource.Write( + DiagnosticListener.Write( BeginContextEvent, new { @@ -132,9 +132,9 @@ public override void EndContext() { const string EndContextEvent = "Microsoft.AspNetCore.Mvc.Razor.EndInstrumentationContext"; - if (DiagnosticSource?.IsEnabled(EndContextEvent) == true) + if ((DiagnosticListener?.IsEnabled() ?? false) && DiagnosticListener?.IsEnabled(EndContextEvent) == true) { - DiagnosticSource.Write( + DiagnosticListener.Write( EndContextEvent, new { diff --git a/src/Mvc/Mvc.RazorPages/test/Infrastructure/DefaultPageFactoryProviderTest.cs b/src/Mvc/Mvc.RazorPages/test/Infrastructure/DefaultPageFactoryProviderTest.cs index 9e2871d62aca..ae9033096263 100644 --- a/src/Mvc/Mvc.RazorPages/test/Infrastructure/DefaultPageFactoryProviderTest.cs +++ b/src/Mvc/Mvc.RazorPages/test/Infrastructure/DefaultPageFactoryProviderTest.cs @@ -279,8 +279,8 @@ public void PageFactoryDoesNotBindPropertiesWithNoRazorInjectAttribute() // Assert var testPage = Assert.IsType(instance); - Assert.Null(testPage.DiagnosticSourceWithoutInject); - Assert.NotNull(testPage.DiagnosticSourceWithInject); + Assert.Null(testPage.DiagnosticListenerWithoutInject); + Assert.NotNull(testPage.DiagnosticListenerWithInject); Assert.Null(testPage.LoggerWithoutInject); Assert.NotNull(testPage.LoggerWithInject); @@ -375,10 +375,10 @@ private class PropertiesWithoutRazorInject : Page [RazorInject] public IModelExpressionProvider ModelExpressionProviderWithInject { get; set; } - public DiagnosticSource DiagnosticSourceWithoutInject { get; set; } + public DiagnosticListener DiagnosticListenerWithoutInject { get; set; } [RazorInject] - public DiagnosticSource DiagnosticSourceWithInject { get; set; } + public DiagnosticListener DiagnosticListenerWithInject { get; set; } public ILogger LoggerWithoutInject { get; set; } diff --git a/src/Mvc/Mvc.ViewFeatures/test/ViewComponentResultTest.cs b/src/Mvc/Mvc.ViewFeatures/test/ViewComponentResultTest.cs index 0eff0f4df05b..4dbf5e20d75d 100644 --- a/src/Mvc/Mvc.ViewFeatures/test/ViewComponentResultTest.cs +++ b/src/Mvc/Mvc.ViewFeatures/test/ViewComponentResultTest.cs @@ -264,7 +264,7 @@ public async Task ExecuteResultAsync_ExecutesAsyncViewComponent() } [Fact] - public async Task ExecuteResultAsync_ExecutesViewComponent_AndWritesDiagnosticSource() + public async Task ExecuteResultAsync_ExecutesViewComponent_AndWritesDiagnosticListener() { // Arrange var methodInfo = typeof(TextViewComponent).GetMethod(nameof(TextViewComponent.Invoke)); diff --git a/src/Mvc/Mvc.ViewFeatures/test/ViewComponents/ViewViewComponentResultTest.cs b/src/Mvc/Mvc.ViewFeatures/test/ViewComponents/ViewViewComponentResultTest.cs index 1f0255c7e81d..dc0f10ed0251 100644 --- a/src/Mvc/Mvc.ViewFeatures/test/ViewComponents/ViewViewComponentResultTest.cs +++ b/src/Mvc/Mvc.ViewFeatures/test/ViewComponents/ViewViewComponentResultTest.cs @@ -102,7 +102,7 @@ public void Execute_ResolvesView_WithDefaultAsViewName() } [Fact] - public void Execute_ResolvesView_AndWritesDiagnosticSource() + public void Execute_ResolvesView_AndWritesDiagnosticListener() { // Arrange var view = new Mock(MockBehavior.Strict); From a85a81964b946f8fc60121706df8caa258205fe3 Mon Sep 17 00:00:00 2001 From: Ben Adams Date: Mon, 1 Jul 2019 13:53:50 +0100 Subject: [PATCH 03/11] Implement interface explicitly --- .../src/Diagnostics/MvcDiagnostic.cs | 20 ++-- .../src/Diagnostics/MvcDiagnostics.cs | 112 +++++++++--------- .../src/Diagnostics/MvcDiagnostics.cs | 16 +-- .../src/Diagnostics/MvcDiagnostics.cs | 48 ++++---- .../src/Diagnostics/MvcDiagnostics.cs | 32 ++--- 5 files changed, 117 insertions(+), 111 deletions(-) diff --git a/src/Mvc/Mvc.Abstractions/src/Diagnostics/MvcDiagnostic.cs b/src/Mvc/Mvc.Abstractions/src/Diagnostics/MvcDiagnostic.cs index 763b5a994ceb..390c575bf7a6 100644 --- a/src/Mvc/Mvc.Abstractions/src/Diagnostics/MvcDiagnostic.cs +++ b/src/Mvc/Mvc.Abstractions/src/Diagnostics/MvcDiagnostic.cs @@ -10,9 +10,19 @@ public abstract class MvcDiagnostic : IReadOnlyList { protected const string EventNamespace = "Microsoft.AspNetCore.Mvc."; - public abstract int Count { get; } - public abstract KeyValuePair this[int index] { get; } - public IEnumerator> GetEnumerator() + protected abstract int Count { get; } + protected abstract KeyValuePair this[int index] { get; } + + int IReadOnlyCollection>.Count => Count; + KeyValuePair IReadOnlyList>.this[int index] => this[index]; + + IEnumerator> IEnumerable>.GetEnumerator() + => GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() + => GetEnumerator(); + + private IEnumerator> GetEnumerator() { var count = Count; for (var i = 0; i < count; i++) @@ -20,9 +30,5 @@ public IEnumerator> GetEnumerator() yield return this[i]; } } - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } } } \ No newline at end of file diff --git a/src/Mvc/Mvc.Core/src/Diagnostics/MvcDiagnostics.cs b/src/Mvc/Mvc.Core/src/Diagnostics/MvcDiagnostics.cs index 13ec115c8012..583dd1a913c7 100644 --- a/src/Mvc/Mvc.Core/src/Diagnostics/MvcDiagnostics.cs +++ b/src/Mvc/Mvc.Core/src/Diagnostics/MvcDiagnostics.cs @@ -17,7 +17,7 @@ public sealed class BeforeAction : MvcDiagnostic public HttpContext HttpContext { get; } public RouteData RouteData { get; } - public override int Count => 3; + protected override int Count => 3; public BeforeAction(ActionDescriptor actionDescriptor, HttpContext httpContext, RouteData routeData) { @@ -26,7 +26,7 @@ public BeforeAction(ActionDescriptor actionDescriptor, HttpContext httpContext, RouteData = routeData; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(HttpContext), HttpContext), @@ -42,7 +42,7 @@ public sealed class AfterAction : MvcDiagnostic public HttpContext HttpContext { get; } public RouteData RouteData { get; } - public override int Count => 3; + protected override int Count => 3; public AfterAction(ActionDescriptor actionDescriptor, HttpContext httpContext, RouteData routeData) { @@ -51,7 +51,7 @@ public AfterAction(ActionDescriptor actionDescriptor, HttpContext httpContext, R RouteData = routeData; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(HttpContext), HttpContext), @@ -67,7 +67,7 @@ public sealed class BeforeOnAuthorization : MvcDiagnostic public AuthorizationFilterContext AuthorizationContext { get; } public IFilterMetadata Filter { get; } - public override int Count => 3; + protected override int Count => 3; public BeforeOnAuthorization(ActionDescriptor actionDescriptor, AuthorizationFilterContext authorizationContext, IFilterMetadata filter) { @@ -76,7 +76,7 @@ public BeforeOnAuthorization(ActionDescriptor actionDescriptor, AuthorizationFil Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(AuthorizationContext), AuthorizationContext), @@ -92,7 +92,7 @@ public sealed class AfterOnAuthorization : MvcDiagnostic public AuthorizationFilterContext AuthorizationContext { get; } public IFilterMetadata Filter { get; } - public override int Count => 3; + protected override int Count => 3; public AfterOnAuthorization(ActionDescriptor actionDescriptor, AuthorizationFilterContext authorizationContext, IFilterMetadata filter) { @@ -101,7 +101,7 @@ public AfterOnAuthorization(ActionDescriptor actionDescriptor, AuthorizationFilt Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(AuthorizationContext), AuthorizationContext), @@ -117,7 +117,7 @@ public sealed class BeforeOnResourceExecution : MvcDiagnostic public ResourceExecutingContext ResourceExecutingContext { get; } public IFilterMetadata Filter { get; } - public override int Count => 3; + protected override int Count => 3; public BeforeOnResourceExecution(ActionDescriptor actionDescriptor, ResourceExecutingContext resourceExecutingContext, IFilterMetadata filter) { @@ -126,7 +126,7 @@ public BeforeOnResourceExecution(ActionDescriptor actionDescriptor, ResourceExec Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(ResourceExecutingContext), ResourceExecutingContext), @@ -142,7 +142,7 @@ public sealed class AfterOnResourceExecution : MvcDiagnostic public ResourceExecutedContext ResourceExecutedContext { get; } public IFilterMetadata Filter { get; } - public override int Count => 3; + protected override int Count => 3; public AfterOnResourceExecution(ActionDescriptor actionDescriptor, ResourceExecutedContext resourceExecutedContext, IFilterMetadata filter) { @@ -151,7 +151,7 @@ public AfterOnResourceExecution(ActionDescriptor actionDescriptor, ResourceExecu Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(ResourceExecutedContext), ResourceExecutedContext), @@ -167,7 +167,7 @@ public sealed class BeforeOnResourceExecuting : MvcDiagnostic public ResourceExecutingContext ResourceExecutingContext { get; } public IFilterMetadata Filter { get; } - public override int Count => 3; + protected override int Count => 3; public BeforeOnResourceExecuting(ActionDescriptor actionDescriptor, ResourceExecutingContext resourceExecutingContext, IFilterMetadata filter) { @@ -176,7 +176,7 @@ public BeforeOnResourceExecuting(ActionDescriptor actionDescriptor, ResourceExec Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(ResourceExecutingContext), ResourceExecutingContext), @@ -192,7 +192,7 @@ public sealed class AfterOnResourceExecuting : MvcDiagnostic public ResourceExecutingContext ResourceExecutingContext { get; } public IFilterMetadata Filter { get; } - public override int Count => 3; + protected override int Count => 3; public AfterOnResourceExecuting(ActionDescriptor actionDescriptor, ResourceExecutingContext resourceExecutingContext, IFilterMetadata filter) { @@ -201,7 +201,7 @@ public AfterOnResourceExecuting(ActionDescriptor actionDescriptor, ResourceExecu Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(ResourceExecutingContext), ResourceExecutingContext), @@ -217,7 +217,7 @@ public sealed class BeforeOnResourceExecuted : MvcDiagnostic public ResourceExecutedContext ResourceExecutedContext { get; } public IFilterMetadata Filter { get; } - public override int Count => 3; + protected override int Count => 3; public BeforeOnResourceExecuted(ActionDescriptor actionDescriptor, ResourceExecutedContext resourceExecutedContext, IFilterMetadata filter) { @@ -226,7 +226,7 @@ public BeforeOnResourceExecuted(ActionDescriptor actionDescriptor, ResourceExecu Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(ResourceExecutedContext), ResourceExecutedContext), @@ -242,7 +242,7 @@ public sealed class AfterOnResourceExecuted : MvcDiagnostic public ResourceExecutedContext ResourceExecutedContext { get; } public IFilterMetadata Filter { get; } - public override int Count => 3; + protected override int Count => 3; public AfterOnResourceExecuted(ActionDescriptor actionDescriptor, ResourceExecutedContext resourceExecutedContext, IFilterMetadata filter) { @@ -251,7 +251,7 @@ public AfterOnResourceExecuted(ActionDescriptor actionDescriptor, ResourceExecut Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(ResourceExecutedContext), ResourceExecutedContext), @@ -267,7 +267,7 @@ public sealed class BeforeOnException : MvcDiagnostic public ExceptionContext ExceptionContext { get; } public IFilterMetadata Filter { get; } - public override int Count => 3; + protected override int Count => 3; public BeforeOnException(ActionDescriptor actionDescriptor, ExceptionContext exceptionContext, IFilterMetadata filter) { @@ -276,7 +276,7 @@ public BeforeOnException(ActionDescriptor actionDescriptor, ExceptionContext exc Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(ExceptionContext), ExceptionContext), @@ -292,7 +292,7 @@ public sealed class AfterOnException : MvcDiagnostic public ExceptionContext ExceptionContext { get; } public IFilterMetadata Filter { get; } - public override int Count => 3; + protected override int Count => 3; public AfterOnException(ActionDescriptor actionDescriptor, ExceptionContext exceptionContext, IFilterMetadata filter) { @@ -301,7 +301,7 @@ public AfterOnException(ActionDescriptor actionDescriptor, ExceptionContext exce Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(ExceptionContext), ExceptionContext), @@ -317,7 +317,7 @@ public sealed class BeforeOnActionExecution : MvcDiagnostic public ActionExecutingContext ActionExecutingContext { get; } public IFilterMetadata Filter { get; } - public override int Count => 3; + protected override int Count => 3; public BeforeOnActionExecution(ActionDescriptor actionDescriptor, ActionExecutingContext actionExecutingContext, IFilterMetadata filter) { @@ -326,7 +326,7 @@ public BeforeOnActionExecution(ActionDescriptor actionDescriptor, ActionExecutin Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(ActionExecutingContext), ActionExecutingContext), @@ -342,7 +342,7 @@ public sealed class AfterOnActionExecution : MvcDiagnostic public ActionExecutedContext ActionExecutedContext { get; } public IFilterMetadata Filter { get; } - public override int Count => 3; + protected override int Count => 3; public AfterOnActionExecution(ActionDescriptor actionDescriptor, ActionExecutedContext actionExecutedContext, IFilterMetadata filter) { @@ -351,7 +351,7 @@ public AfterOnActionExecution(ActionDescriptor actionDescriptor, ActionExecutedC Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(ActionExecutedContext), ActionExecutedContext), @@ -367,7 +367,7 @@ public sealed class BeforeOnActionExecuting : MvcDiagnostic public ActionExecutingContext ActionExecutingContext { get; } public IFilterMetadata Filter { get; } - public override int Count => 3; + protected override int Count => 3; public BeforeOnActionExecuting(ActionDescriptor actionDescriptor, ActionExecutingContext actionExecutingContext, IFilterMetadata filter) { @@ -376,7 +376,7 @@ public BeforeOnActionExecuting(ActionDescriptor actionDescriptor, ActionExecutin Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(ActionExecutingContext), ActionExecutingContext), @@ -392,7 +392,7 @@ public sealed class AfterOnActionExecuting : MvcDiagnostic public ActionExecutingContext ActionExecutingContext { get; } public IFilterMetadata Filter { get; } - public override int Count => 3; + protected override int Count => 3; public AfterOnActionExecuting(ActionDescriptor actionDescriptor, ActionExecutingContext actionExecutingContext, IFilterMetadata filter) { @@ -401,7 +401,7 @@ public AfterOnActionExecuting(ActionDescriptor actionDescriptor, ActionExecuting Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(ActionExecutingContext), ActionExecutingContext), @@ -417,7 +417,7 @@ public sealed class BeforeOnActionExecuted : MvcDiagnostic public ActionExecutedContext ActionExecutedContext { get; } public IFilterMetadata Filter { get; } - public override int Count => 3; + protected override int Count => 3; public BeforeOnActionExecuted(ActionDescriptor actionDescriptor, ActionExecutedContext actionExecutedContext, IFilterMetadata filter) { @@ -426,7 +426,7 @@ public BeforeOnActionExecuted(ActionDescriptor actionDescriptor, ActionExecutedC Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(ActionExecutedContext), ActionExecutedContext), @@ -442,7 +442,7 @@ public sealed class AfterOnActionExecuted : MvcDiagnostic public ActionExecutedContext ActionExecutedContext { get; } public IFilterMetadata Filter { get; } - public override int Count => 3; + protected override int Count => 3; public AfterOnActionExecuted(ActionDescriptor actionDescriptor, ActionExecutedContext actionExecutedContext, IFilterMetadata filter) { @@ -451,7 +451,7 @@ public AfterOnActionExecuted(ActionDescriptor actionDescriptor, ActionExecutedCo Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(ActionExecutedContext), ActionExecutedContext), @@ -467,7 +467,7 @@ public sealed class BeforeActionMethod : MvcDiagnostic public IDictionary Arguments { get; } public object Controller { get; } - public override int Count => 3; + protected override int Count => 3; public BeforeActionMethod(ActionContext actionContext, IDictionary arguments, object controller) { @@ -476,7 +476,7 @@ public BeforeActionMethod(ActionContext actionContext, IDictionary this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionContext), ActionContext), 1 => new KeyValuePair(nameof(Arguments), Arguments), @@ -493,7 +493,7 @@ public sealed class AfterActionMethod : MvcDiagnostic public object Controller { get; } public IActionResult Result { get; } - public override int Count => 4; + protected override int Count => 4; public AfterActionMethod(ActionContext actionContext, IDictionary arguments, object controller, IActionResult result) { @@ -503,7 +503,7 @@ public AfterActionMethod(ActionContext actionContext, IDictionary this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionContext), ActionContext), 1 => new KeyValuePair(nameof(Controller), Controller), @@ -520,7 +520,7 @@ public sealed class BeforeOnResultExecution : MvcDiagnostic public ResultExecutingContext ResultExecutingContext { get; } public IFilterMetadata Filter { get; } - public override int Count => 3; + protected override int Count => 3; public BeforeOnResultExecution(ActionDescriptor actionDescriptor, ResultExecutingContext resultExecutingContext, IFilterMetadata filter) { @@ -529,7 +529,7 @@ public BeforeOnResultExecution(ActionDescriptor actionDescriptor, ResultExecutin Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(ResultExecutingContext), ResultExecutingContext), @@ -545,7 +545,7 @@ public sealed class AfterOnResultExecution : MvcDiagnostic public ResultExecutedContext ResultExecutedContext { get; } public IFilterMetadata Filter { get; } - public override int Count => 3; + protected override int Count => 3; public AfterOnResultExecution(ActionDescriptor actionDescriptor, ResultExecutedContext resultExecutedContext, IFilterMetadata filter) { @@ -554,7 +554,7 @@ public AfterOnResultExecution(ActionDescriptor actionDescriptor, ResultExecutedC Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(ResultExecutedContext), ResultExecutedContext), @@ -570,7 +570,7 @@ public sealed class BeforeOnResultExecuting : MvcDiagnostic public ResultExecutingContext ResultExecutingContext { get; } public IFilterMetadata Filter { get; } - public override int Count => 3; + protected override int Count => 3; public BeforeOnResultExecuting(ActionDescriptor actionDescriptor, ResultExecutingContext resultExecutingContext, IFilterMetadata filter) { @@ -579,7 +579,7 @@ public BeforeOnResultExecuting(ActionDescriptor actionDescriptor, ResultExecutin Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(ResultExecutingContext), ResultExecutingContext), @@ -595,7 +595,7 @@ public sealed class AfterOnResultExecuting : MvcDiagnostic public ResultExecutingContext ResultExecutingContext { get; } public IFilterMetadata Filter { get; } - public override int Count => 3; + protected override int Count => 3; public AfterOnResultExecuting(ActionDescriptor actionDescriptor, ResultExecutingContext resultExecutingContext, IFilterMetadata filter) { @@ -604,7 +604,7 @@ public AfterOnResultExecuting(ActionDescriptor actionDescriptor, ResultExecuting Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(ResultExecutingContext), ResultExecutingContext), @@ -620,7 +620,7 @@ public sealed class BeforeOnResultExecuted : MvcDiagnostic public ResultExecutedContext ResultExecutedContext { get; } public IFilterMetadata Filter { get; } - public override int Count => 3; + protected override int Count => 3; public BeforeOnResultExecuted(ActionDescriptor actionDescriptor, ResultExecutedContext resultExecutedContext, IFilterMetadata filter) { @@ -629,7 +629,7 @@ public BeforeOnResultExecuted(ActionDescriptor actionDescriptor, ResultExecutedC Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(ResultExecutedContext), ResultExecutedContext), @@ -645,7 +645,7 @@ public sealed class AfterOnResultExecuted : MvcDiagnostic public ResultExecutedContext ResultExecutedContext { get; } public IFilterMetadata Filter { get; } - public override int Count => 3; + protected override int Count => 3; public AfterOnResultExecuted(ActionDescriptor actionDescriptor, ResultExecutedContext resultExecutedContext, IFilterMetadata filter) { @@ -654,7 +654,7 @@ public AfterOnResultExecuted(ActionDescriptor actionDescriptor, ResultExecutedCo Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(ResultExecutedContext), ResultExecutedContext), @@ -669,7 +669,7 @@ public sealed class BeforeActionResult : MvcDiagnostic public ActionContext ActionContext { get; } public IActionResult Result { get; } - public override int Count => 2; + protected override int Count => 2; public BeforeActionResult(ActionContext actionContext, IActionResult result) { @@ -677,7 +677,7 @@ public BeforeActionResult(ActionContext actionContext, IActionResult result) Result = result; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionContext), ActionContext), 1 => new KeyValuePair(nameof(Result), Result), @@ -691,7 +691,7 @@ public sealed class AfterActionResult : MvcDiagnostic public ActionContext ActionContext { get; } public IActionResult Result { get; } - public override int Count => 2; + protected override int Count => 2; public AfterActionResult(ActionContext actionContext, IActionResult result) { @@ -699,7 +699,7 @@ public AfterActionResult(ActionContext actionContext, IActionResult result) Result = result; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionContext), ActionContext), 1 => new KeyValuePair(nameof(Result), Result), diff --git a/src/Mvc/Mvc.Razor/src/Diagnostics/MvcDiagnostics.cs b/src/Mvc/Mvc.Razor/src/Diagnostics/MvcDiagnostics.cs index bd6506edfeb3..39f83f26fe6a 100644 --- a/src/Mvc/Mvc.Razor/src/Diagnostics/MvcDiagnostics.cs +++ b/src/Mvc/Mvc.Razor/src/Diagnostics/MvcDiagnostics.cs @@ -21,7 +21,7 @@ public sealed class BeforeViewPage : MvcDiagnostic public ActionDescriptor ActionDescriptor { get; } public HttpContext HttpContext { get; } - public override int Count => 4; + protected override int Count => 4; public BeforeViewPage(IRazorPage page, ViewContext viewContext, ActionDescriptor actionDescriptor, HttpContext httpContext) { @@ -31,7 +31,7 @@ public BeforeViewPage(IRazorPage page, ViewContext viewContext, ActionDescriptor HttpContext = httpContext; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(Page), Page), 1 => new KeyValuePair(nameof(ViewContext), ViewContext), @@ -52,7 +52,7 @@ public sealed class AfterViewPage : MvcDiagnostic public ActionDescriptor ActionDescriptor { get; } public HttpContext HttpContext { get; } - public override int Count => 4; + protected override int Count => 4; public AfterViewPage(IRazorPage page, ViewContext viewContext, ActionDescriptor actionDescriptor, HttpContext httpContext) { @@ -62,7 +62,7 @@ public AfterViewPage(IRazorPage page, ViewContext viewContext, ActionDescriptor HttpContext = httpContext; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(Page), Page), 1 => new KeyValuePair(nameof(ViewContext), ViewContext), @@ -84,7 +84,7 @@ public sealed class BeginInstrumentationContext : MvcDiagnostic public int Length { get; } public bool IsLiteral { get; } - public override int Count => 5; + protected override int Count => 5; public BeginInstrumentationContext( HttpContext httpContext, @@ -100,7 +100,7 @@ public BeginInstrumentationContext( IsLiteral = isLiteral; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(HttpContext), HttpContext), 1 => new KeyValuePair(nameof(Path), Path), @@ -120,7 +120,7 @@ public sealed class EndInstrumentationContext : MvcDiagnostic public HttpContext HttpContext { get; } public string Path { get; } - public override int Count => 2; + protected override int Count => 2; public EndInstrumentationContext( HttpContext httpContext, @@ -130,7 +130,7 @@ public EndInstrumentationContext( Path = path; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(HttpContext), HttpContext), 1 => new KeyValuePair(nameof(Path), Path), diff --git a/src/Mvc/Mvc.RazorPages/src/Diagnostics/MvcDiagnostics.cs b/src/Mvc/Mvc.RazorPages/src/Diagnostics/MvcDiagnostics.cs index 0ca659cec45b..6c0cd4b6db68 100644 --- a/src/Mvc/Mvc.RazorPages/src/Diagnostics/MvcDiagnostics.cs +++ b/src/Mvc/Mvc.RazorPages/src/Diagnostics/MvcDiagnostics.cs @@ -19,7 +19,7 @@ public sealed class BeforeHandlerMethod : MvcDiagnostic public HandlerMethodDescriptor HandlerMethodDescriptor { get; } public object Instance { get; } - public override int Count => 4; + protected override int Count => 4; public BeforeHandlerMethod(ActionContext actionContext, IDictionary arguments, HandlerMethodDescriptor handlerMethodDescriptor, object instance) { @@ -29,7 +29,7 @@ public BeforeHandlerMethod(ActionContext actionContext, IDictionary this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionContext), ActionContext), 1 => new KeyValuePair(nameof(Arguments), Arguments), @@ -49,7 +49,7 @@ public sealed class AfterHandlerMethod : MvcDiagnostic public object Instance { get; } public IActionResult Result { get; } - public override int Count => 5; + protected override int Count => 5; public AfterHandlerMethod(ActionContext actionContext, IDictionary arguments, HandlerMethodDescriptor handlerMethodDescriptor, object instance, IActionResult result) { @@ -60,7 +60,7 @@ public AfterHandlerMethod(ActionContext actionContext, IDictionary this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionContext), ActionContext), 1 => new KeyValuePair(nameof(Arguments), Arguments), @@ -79,7 +79,7 @@ public sealed class BeforeOnPageHandlerExecution : MvcDiagnostic public PageHandlerExecutingContext HandlerExecutionContext { get; } public IAsyncPageFilter Filter { get; } - public override int Count => 3; + protected override int Count => 3; public BeforeOnPageHandlerExecution(CompiledPageActionDescriptor actionDescriptor, PageHandlerExecutingContext handlerExecutionContext, IAsyncPageFilter filter) { @@ -88,7 +88,7 @@ public BeforeOnPageHandlerExecution(CompiledPageActionDescriptor actionDescripto Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(HandlerExecutionContext), HandlerExecutionContext), @@ -105,7 +105,7 @@ public sealed class AfterOnPageHandlerExecution : MvcDiagnostic public PageHandlerExecutedContext HandlerExecutedContext { get; } public IAsyncPageFilter Filter { get; } - public override int Count => 3; + protected override int Count => 3; public AfterOnPageHandlerExecution(CompiledPageActionDescriptor actionDescriptor, PageHandlerExecutedContext handlerExecutedContext, IAsyncPageFilter filter) { @@ -114,7 +114,7 @@ public AfterOnPageHandlerExecution(CompiledPageActionDescriptor actionDescriptor Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(HandlerExecutedContext), HandlerExecutedContext), @@ -131,7 +131,7 @@ public sealed class BeforeOnPageHandlerExecuting : MvcDiagnostic public PageHandlerExecutingContext HandlerExecutingContext { get; } public IPageFilter Filter { get; } - public override int Count => 3; + protected override int Count => 3; public BeforeOnPageHandlerExecuting(CompiledPageActionDescriptor actionDescriptor, PageHandlerExecutingContext handlerExecutingContext, IPageFilter filter) { @@ -140,7 +140,7 @@ public BeforeOnPageHandlerExecuting(CompiledPageActionDescriptor actionDescripto Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(HandlerExecutingContext), HandlerExecutingContext), @@ -157,7 +157,7 @@ public sealed class AfterOnPageHandlerExecuting : MvcDiagnostic public PageHandlerExecutingContext HandlerExecutingContext { get; } public IPageFilter Filter { get; } - public override int Count => 3; + protected override int Count => 3; public AfterOnPageHandlerExecuting(CompiledPageActionDescriptor actionDescriptor, PageHandlerExecutingContext handlerExecutingContext, IPageFilter filter) { @@ -166,7 +166,7 @@ public AfterOnPageHandlerExecuting(CompiledPageActionDescriptor actionDescriptor Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(HandlerExecutingContext), HandlerExecutingContext), @@ -183,7 +183,7 @@ public sealed class BeforeOnPageHandlerExecuted : MvcDiagnostic public PageHandlerExecutedContext HandlerExecutedContext { get; } public IPageFilter Filter { get; } - public override int Count => 3; + protected override int Count => 3; public BeforeOnPageHandlerExecuted(CompiledPageActionDescriptor actionDescriptor, PageHandlerExecutedContext handlerExecutedContext, IPageFilter filter) { @@ -192,7 +192,7 @@ public BeforeOnPageHandlerExecuted(CompiledPageActionDescriptor actionDescriptor Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(HandlerExecutedContext), HandlerExecutedContext), @@ -209,7 +209,7 @@ public sealed class AfterOnPageHandlerExecuted : MvcDiagnostic public PageHandlerExecutedContext HandlerExecutedContext { get; } public IPageFilter Filter { get; } - public override int Count => 3; + protected override int Count => 3; public AfterOnPageHandlerExecuted(CompiledPageActionDescriptor actionDescriptor, PageHandlerExecutedContext handlerExecutedContext, IPageFilter filter) { @@ -218,7 +218,7 @@ public AfterOnPageHandlerExecuted(CompiledPageActionDescriptor actionDescriptor, Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(HandlerExecutedContext), HandlerExecutedContext), @@ -235,7 +235,7 @@ public sealed class BeforeOnPageHandlerSelection : MvcDiagnostic public PageHandlerSelectedContext HandlerSelectedContext { get; } public IAsyncPageFilter Filter { get; } - public override int Count => 3; + protected override int Count => 3; public BeforeOnPageHandlerSelection(CompiledPageActionDescriptor actionDescriptor, PageHandlerSelectedContext handlerSelectedContext, IAsyncPageFilter filter) { @@ -244,7 +244,7 @@ public BeforeOnPageHandlerSelection(CompiledPageActionDescriptor actionDescripto Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(HandlerSelectedContext), HandlerSelectedContext), @@ -261,7 +261,7 @@ public sealed class AfterOnPageHandlerSelection : MvcDiagnostic public PageHandlerSelectedContext HandlerSelectedContext { get; } public IAsyncPageFilter Filter { get; } - public override int Count => 3; + protected override int Count => 3; public AfterOnPageHandlerSelection(CompiledPageActionDescriptor actionDescriptor, PageHandlerSelectedContext handlerSelectedContext, IAsyncPageFilter filter) { @@ -270,7 +270,7 @@ public AfterOnPageHandlerSelection(CompiledPageActionDescriptor actionDescriptor Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(HandlerSelectedContext), HandlerSelectedContext), @@ -287,7 +287,7 @@ public sealed class BeforeOnPageHandlerSelected : MvcDiagnostic public PageHandlerSelectedContext HandlerSelectedContext { get; } public IPageFilter Filter { get; } - public override int Count => 3; + protected override int Count => 3; public BeforeOnPageHandlerSelected(CompiledPageActionDescriptor actionDescriptor, PageHandlerSelectedContext handlerSelectedContext, IPageFilter filter) { @@ -296,7 +296,7 @@ public BeforeOnPageHandlerSelected(CompiledPageActionDescriptor actionDescriptor Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(HandlerSelectedContext), HandlerSelectedContext), @@ -313,7 +313,7 @@ public sealed class AfterOnPageHandlerSelected : MvcDiagnostic public PageHandlerSelectedContext HandlerSelectedContext { get; } public IPageFilter Filter { get; } - public override int Count => 3; + protected override int Count => 3; public AfterOnPageHandlerSelected(CompiledPageActionDescriptor actionDescriptor, PageHandlerSelectedContext handlerSelectedContext, IPageFilter filter) { @@ -322,7 +322,7 @@ public AfterOnPageHandlerSelected(CompiledPageActionDescriptor actionDescriptor, Filter = filter; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(HandlerSelectedContext), HandlerSelectedContext), diff --git a/src/Mvc/Mvc.ViewFeatures/src/Diagnostics/MvcDiagnostics.cs b/src/Mvc/Mvc.ViewFeatures/src/Diagnostics/MvcDiagnostics.cs index 05807ebb88b9..f39ed463b995 100644 --- a/src/Mvc/Mvc.ViewFeatures/src/Diagnostics/MvcDiagnostics.cs +++ b/src/Mvc/Mvc.ViewFeatures/src/Diagnostics/MvcDiagnostics.cs @@ -18,7 +18,7 @@ public sealed class BeforeViewComponent : MvcDiagnostic public ViewComponentContext ViewComponentContext { get; } public object ViewComponent { get; } - public override int Count => 3; + protected override int Count => 3; public BeforeViewComponent(ActionDescriptor actionDescriptor, ViewComponentContext viewComponentContext, object viewComponent) { @@ -27,7 +27,7 @@ public BeforeViewComponent(ActionDescriptor actionDescriptor, ViewComponentConte ViewComponent = viewComponent; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(ViewComponentContext), ViewComponentContext), @@ -45,7 +45,7 @@ public sealed class AfterViewComponent : MvcDiagnostic public IViewComponentResult ViewComponentResult { get; } public object ViewComponent { get; } - public override int Count => 4; + protected override int Count => 4; public AfterViewComponent(ActionDescriptor actionDescriptor, ViewComponentContext viewComponentContext, IViewComponentResult viewComponentResult, object viewComponent) { @@ -55,7 +55,7 @@ public AfterViewComponent(ActionDescriptor actionDescriptor, ViewComponentContex ViewComponent = viewComponent; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(ViewComponentContext), ViewComponentContext), @@ -72,7 +72,7 @@ public sealed class ViewComponentBeforeViewExecute : MvcDiagnostic public ViewComponentContext ViewComponentContext { get; } public IView View { get; } - public override int Count => 3; + protected override int Count => 3; public ViewComponentBeforeViewExecute(ActionDescriptor actionDescriptor, ViewComponentContext viewComponentContext, IView view) { @@ -81,7 +81,7 @@ public ViewComponentBeforeViewExecute(ActionDescriptor actionDescriptor, ViewCom View = view; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(ViewComponentContext), ViewComponentContext), @@ -98,7 +98,7 @@ public sealed class ViewComponentAfterViewExecute : MvcDiagnostic public ViewComponentContext ViewComponentContext { get; } public IView View { get; } - public override int Count => 3; + protected override int Count => 3; public ViewComponentAfterViewExecute(ActionDescriptor actionDescriptor, ViewComponentContext viewComponentContext, IView view) { @@ -107,7 +107,7 @@ public ViewComponentAfterViewExecute(ActionDescriptor actionDescriptor, ViewComp View = view; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), 1 => new KeyValuePair(nameof(ViewComponentContext), ViewComponentContext), @@ -123,7 +123,7 @@ public sealed class BeforeView : MvcDiagnostic public IView View { get; } public ViewContext ViewContext { get; } - public override int Count => 2; + protected override int Count => 2; public BeforeView(IView view, ViewContext viewContext) { @@ -131,7 +131,7 @@ public BeforeView(IView view, ViewContext viewContext) ViewContext = viewContext; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(View), View), 1 => new KeyValuePair(nameof(ViewContext), ViewContext), @@ -146,7 +146,7 @@ public sealed class AfterView : MvcDiagnostic public IView View { get; } public ViewContext ViewContext { get; } - public override int Count => 2; + protected override int Count => 2; public AfterView(IView view, ViewContext viewContext) { @@ -154,7 +154,7 @@ public AfterView(IView view, ViewContext viewContext) ViewContext = viewContext; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(View), View), 1 => new KeyValuePair(nameof(ViewContext), ViewContext), @@ -172,7 +172,7 @@ public sealed class ViewFound : MvcDiagnostic public string ViewName { get; } public IView View { get; } - public override int Count => 5; + protected override int Count => 5; public ViewFound(ActionContext actionContext, bool isMainPage, ActionResult result, string viewName, IView view) { @@ -183,7 +183,7 @@ public ViewFound(ActionContext actionContext, bool isMainPage, ActionResult resu View = view; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionContext), ActionContext), 1 => new KeyValuePair(nameof(IsMainPage), IsMainPage), @@ -204,7 +204,7 @@ public sealed class ViewNotFound : MvcDiagnostic public string ViewName { get; } public IEnumerable SearchedLocations { get; } - public override int Count => 5; + protected override int Count => 5; public ViewNotFound(ActionContext actionContext, bool isMainPage, ActionResult result, string viewName, IEnumerable searchedLocations) { @@ -215,7 +215,7 @@ public ViewNotFound(ActionContext actionContext, bool isMainPage, ActionResult r SearchedLocations = searchedLocations; } - public override KeyValuePair this[int index] => index switch + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionContext), ActionContext), 1 => new KeyValuePair(nameof(IsMainPage), IsMainPage), From 4d4ed864479084213100c61eee243f82e92f21b3 Mon Sep 17 00:00:00 2001 From: Ben Adams Date: Mon, 1 Jul 2019 14:37:18 +0100 Subject: [PATCH 04/11] Code check --- ...pNetCore.Mvc.Abstractions.netcoreapp3.0.cs | 8 +- ...osoft.AspNetCore.Mvc.Core.netcoreapp3.0.cs | 112 +++++++++--------- ...soft.AspNetCore.Mvc.Razor.netcoreapp3.0.cs | 16 +-- ...AspNetCore.Mvc.RazorPages.netcoreapp3.0.cs | 48 ++++---- ...pNetCore.Mvc.ViewFeatures.netcoreapp3.0.cs | 32 ++--- 5 files changed, 109 insertions(+), 107 deletions(-) diff --git a/src/Mvc/Mvc.Abstractions/ref/Microsoft.AspNetCore.Mvc.Abstractions.netcoreapp3.0.cs b/src/Mvc/Mvc.Abstractions/ref/Microsoft.AspNetCore.Mvc.Abstractions.netcoreapp3.0.cs index 677549967807..e6fae54e55e4 100644 --- a/src/Mvc/Mvc.Abstractions/ref/Microsoft.AspNetCore.Mvc.Abstractions.netcoreapp3.0.cs +++ b/src/Mvc/Mvc.Abstractions/ref/Microsoft.AspNetCore.Mvc.Abstractions.netcoreapp3.0.cs @@ -215,9 +215,11 @@ public abstract partial class MvcDiagnostic : System.Collections.Generic.IEnumer { protected const string EventNamespace = "Microsoft.AspNetCore.Mvc."; protected MvcDiagnostic() { } - public abstract int Count { get; } - public abstract System.Collections.Generic.KeyValuePair this[int index] { get; } - public System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } + protected abstract int Count { get; } + protected abstract System.Collections.Generic.KeyValuePair this[int index] { get; } + int System.Collections.Generic.IReadOnlyCollection>.Count { get { throw null; } } + System.Collections.Generic.KeyValuePair System.Collections.Generic.IReadOnlyList>.this[int index] { get { throw null; } } + System.Collections.Generic.IEnumerator> System.Collections.Generic.IEnumerable>.GetEnumerator() { throw null; } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } } } diff --git a/src/Mvc/Mvc.Core/ref/Microsoft.AspNetCore.Mvc.Core.netcoreapp3.0.cs b/src/Mvc/Mvc.Core/ref/Microsoft.AspNetCore.Mvc.Core.netcoreapp3.0.cs index f12457d9a2a6..d08fc7d9b8c7 100644 --- a/src/Mvc/Mvc.Core/ref/Microsoft.AspNetCore.Mvc.Core.netcoreapp3.0.cs +++ b/src/Mvc/Mvc.Core/ref/Microsoft.AspNetCore.Mvc.Core.netcoreapp3.0.cs @@ -1725,9 +1725,9 @@ public sealed partial class AfterAction : Microsoft.AspNetCore.Mvc.Diagnostics.M 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; } } - public override int Count { get { throw null; } } + protected override int Count { get { throw null; } } public Microsoft.AspNetCore.Http.HttpContext HttpContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic @@ -1737,8 +1737,8 @@ public AfterActionMethod(Microsoft.AspNetCore.Mvc.ActionContext actionContext, S public Microsoft.AspNetCore.Mvc.ActionContext ActionContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public System.Collections.Generic.IDictionary Arguments { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public object Controller { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override int Count { get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override int Count { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic @@ -1746,8 +1746,8 @@ public sealed partial class AfterActionResult : Microsoft.AspNetCore.Mvc.Diagnos 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; } } - public override int Count { get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override int Count { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic @@ -1756,9 +1756,9 @@ public sealed partial class AfterOnActionExecuted : Microsoft.AspNetCore.Mvc.Dia 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; } } - public override int Count { get { throw null; } } + protected override int Count { get { throw null; } } public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } public sealed partial class AfterOnActionExecuting : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic { @@ -1766,9 +1766,9 @@ public sealed partial class AfterOnActionExecuting : Microsoft.AspNetCore.Mvc.Di 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; } } - public override int Count { get { throw null; } } + protected override int Count { get { throw null; } } public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } public sealed partial class AfterOnActionExecution : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic { @@ -1776,9 +1776,9 @@ public sealed partial class AfterOnActionExecution : Microsoft.AspNetCore.Mvc.Di 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; } } - public override int Count { get { throw null; } } + protected override int Count { get { throw null; } } public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } public sealed partial class AfterOnAuthorization : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic { @@ -1786,28 +1786,28 @@ public sealed partial class AfterOnAuthorization : Microsoft.AspNetCore.Mvc.Diag 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; } } - public override int Count { get { throw null; } } + protected override int Count { get { throw null; } } public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } public sealed partial class AfterOnException : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic { 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; } } - public override int Count { 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; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } public sealed partial class AfterOnResourceExecuted : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic { 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; } } - public override int Count { get { throw null; } } + protected override int Count { get { throw null; } } public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic @@ -1815,9 +1815,9 @@ public sealed partial class AfterOnResourceExecuting : Microsoft.AspNetCore.Mvc. 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; } } - public override int Count { get { throw null; } } + protected override int Count { get { throw null; } } public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic @@ -1825,9 +1825,9 @@ public sealed partial class AfterOnResourceExecution : Microsoft.AspNetCore.Mvc. 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; } } - public override int Count { get { throw null; } } + protected override int Count { get { throw null; } } public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic @@ -1835,9 +1835,9 @@ public sealed partial class AfterOnResultExecuted : Microsoft.AspNetCore.Mvc.Dia 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; } } - public override int Count { get { throw null; } } + protected override int Count { get { throw null; } } public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic @@ -1845,9 +1845,9 @@ public sealed partial class AfterOnResultExecuting : Microsoft.AspNetCore.Mvc.Di 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; } } - public override int Count { get { throw null; } } + protected override int Count { get { throw null; } } public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic @@ -1855,9 +1855,9 @@ public sealed partial class AfterOnResultExecution : Microsoft.AspNetCore.Mvc.Di 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; } } - public override int Count { get { throw null; } } + protected override int Count { get { throw null; } } public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic @@ -1865,9 +1865,9 @@ public sealed partial class BeforeAction : Microsoft.AspNetCore.Mvc.Diagnostics. 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; } } - public override int Count { get { throw null; } } + protected override int Count { get { throw null; } } public Microsoft.AspNetCore.Http.HttpContext HttpContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic @@ -1877,16 +1877,16 @@ public BeforeActionMethod(Microsoft.AspNetCore.Mvc.ActionContext actionContext, public Microsoft.AspNetCore.Mvc.ActionContext ActionContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public System.Collections.Generic.IDictionary Arguments { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public object Controller { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override int Count { get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override int Count { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } public sealed partial class BeforeActionResult : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic { 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; } } - public override int Count { get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override int Count { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic @@ -1895,9 +1895,9 @@ public sealed partial class BeforeOnActionExecuted : Microsoft.AspNetCore.Mvc.Di 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; } } - public override int Count { get { throw null; } } + protected override int Count { get { throw null; } } public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } public sealed partial class BeforeOnActionExecuting : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic { @@ -1905,9 +1905,9 @@ public sealed partial class BeforeOnActionExecuting : Microsoft.AspNetCore.Mvc.D 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; } } - public override int Count { get { throw null; } } + protected override int Count { get { throw null; } } public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } public sealed partial class BeforeOnActionExecution : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic { @@ -1915,9 +1915,9 @@ public sealed partial class BeforeOnActionExecution : Microsoft.AspNetCore.Mvc.D 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; } } - public override int Count { get { throw null; } } + protected override int Count { get { throw null; } } public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } public sealed partial class BeforeOnAuthorization : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic { @@ -1925,28 +1925,28 @@ public sealed partial class BeforeOnAuthorization : Microsoft.AspNetCore.Mvc.Dia 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; } } - public override int Count { get { throw null; } } + protected override int Count { get { throw null; } } public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } public sealed partial class BeforeOnException : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic { 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; } } - public override int Count { 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; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } public sealed partial class BeforeOnResourceExecuted : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic { 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; } } - public override int Count { get { throw null; } } + protected override int Count { get { throw null; } } public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic @@ -1954,9 +1954,9 @@ public sealed partial class BeforeOnResourceExecuting : Microsoft.AspNetCore.Mvc 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; } } - public override int Count { get { throw null; } } + protected override int Count { get { throw null; } } public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic @@ -1964,9 +1964,9 @@ public sealed partial class BeforeOnResourceExecution : Microsoft.AspNetCore.Mvc 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; } } - public override int Count { get { throw null; } } + protected override int Count { get { throw null; } } public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic @@ -1974,9 +1974,9 @@ public sealed partial class BeforeOnResultExecuted : Microsoft.AspNetCore.Mvc.Di 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; } } - public override int Count { get { throw null; } } + protected override int Count { get { throw null; } } public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic @@ -1984,9 +1984,9 @@ public sealed partial class BeforeOnResultExecuting : Microsoft.AspNetCore.Mvc.D 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; } } - public override int Count { get { throw null; } } + protected override int Count { get { throw null; } } public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic @@ -1994,9 +1994,9 @@ public sealed partial class BeforeOnResultExecution : Microsoft.AspNetCore.Mvc.D 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; } } - public override int Count { get { throw null; } } + protected override int Count { get { throw null; } } public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } public Microsoft.AspNetCore.Mvc.Filters.ResultExecutingContext ResultExecutingContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } } } diff --git a/src/Mvc/Mvc.Razor/ref/Microsoft.AspNetCore.Mvc.Razor.netcoreapp3.0.cs b/src/Mvc/Mvc.Razor/ref/Microsoft.AspNetCore.Mvc.Razor.netcoreapp3.0.cs index 7caa416dab76..9ae0ae106cf6 100644 --- a/src/Mvc/Mvc.Razor/ref/Microsoft.AspNetCore.Mvc.Razor.netcoreapp3.0.cs +++ b/src/Mvc/Mvc.Razor/ref/Microsoft.AspNetCore.Mvc.Razor.netcoreapp3.0.cs @@ -28,9 +28,9 @@ public sealed partial class AfterViewPage : Microsoft.AspNetCore.Mvc.Diagnostics 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; } } - public override int Count { get { throw null; } } + protected override int Count { get { throw null; } } public Microsoft.AspNetCore.Http.HttpContext HttpContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair 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; } } } @@ -39,9 +39,9 @@ public sealed partial class BeforeViewPage : Microsoft.AspNetCore.Mvc.Diagnostic 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; } } - public override int Count { get { throw null; } } + protected override int Count { get { throw null; } } public Microsoft.AspNetCore.Http.HttpContext HttpContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair 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; } } } @@ -49,10 +49,10 @@ public sealed partial class BeginInstrumentationContext : Microsoft.AspNetCore.M { public const string EventName = "Microsoft.AspNetCore.Mvc.Razor.BeginInstrumentationContext"; public BeginInstrumentationContext(Microsoft.AspNetCore.Http.HttpContext httpContext, string path, int position, int length, bool isLiteral) { } - public override int Count { get { throw null; } } + protected override int Count { get { throw null; } } public Microsoft.AspNetCore.Http.HttpContext HttpContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public bool IsLiteral { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } public int Length { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public string Path { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public int Position { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } @@ -61,9 +61,9 @@ public sealed partial class EndInstrumentationContext : Microsoft.AspNetCore.Mvc { public const string EventName = "Microsoft.AspNetCore.Mvc.Razor.EndInstrumentationContext"; public EndInstrumentationContext(Microsoft.AspNetCore.Http.HttpContext httpContext, string path) { } - public override int Count { get { throw null; } } + protected override int Count { get { throw null; } } public Microsoft.AspNetCore.Http.HttpContext HttpContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } public string Path { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } } } diff --git a/src/Mvc/Mvc.RazorPages/ref/Microsoft.AspNetCore.Mvc.RazorPages.netcoreapp3.0.cs b/src/Mvc/Mvc.RazorPages/ref/Microsoft.AspNetCore.Mvc.RazorPages.netcoreapp3.0.cs index 0576893170fc..7573d5732f15 100644 --- a/src/Mvc/Mvc.RazorPages/ref/Microsoft.AspNetCore.Mvc.RazorPages.netcoreapp3.0.cs +++ b/src/Mvc/Mvc.RazorPages/ref/Microsoft.AspNetCore.Mvc.RazorPages.netcoreapp3.0.cs @@ -151,10 +151,10 @@ public sealed partial class AfterHandlerMethod : Microsoft.AspNetCore.Mvc.Diagno public AfterHandlerMethod(Microsoft.AspNetCore.Mvc.ActionContext actionContext, System.Collections.Generic.IDictionary 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.IDictionary Arguments { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override int Count { 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; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic @@ -162,50 +162,50 @@ public sealed partial class AfterOnPageHandlerExecuted : Microsoft.AspNetCore.Mv 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; } } - public override int Count { 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; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } public sealed partial class AfterOnPageHandlerExecuting : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic { 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; } } - public override int Count { 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; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } public sealed partial class AfterOnPageHandlerExecution : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic { 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; } } - public override int Count { 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; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } public sealed partial class AfterOnPageHandlerSelected : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic { 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; } } - public override int Count { 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; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } public sealed partial class AfterOnPageHandlerSelection : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic { 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; } } - public override int Count { 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; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } public sealed partial class BeforeHandlerMethod : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic { @@ -213,60 +213,60 @@ public sealed partial class BeforeHandlerMethod : Microsoft.AspNetCore.Mvc.Diagn public BeforeHandlerMethod(Microsoft.AspNetCore.Mvc.ActionContext actionContext, System.Collections.Generic.IDictionary 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.IDictionary Arguments { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override int Count { 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; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } public sealed partial class BeforeOnPageHandlerExecuted : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic { 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; } } - public override int Count { 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; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } public sealed partial class BeforeOnPageHandlerExecuting : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic { 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; } } - public override int Count { 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; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } public sealed partial class BeforeOnPageHandlerExecution : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic { 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; } } - public override int Count { 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; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } public sealed partial class BeforeOnPageHandlerSelected : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic { 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; } } - public override int Count { 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; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } public sealed partial class BeforeOnPageHandlerSelection : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic { 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; } } - public override int Count { 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; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } } namespace Microsoft.AspNetCore.Mvc.Filters diff --git a/src/Mvc/Mvc.ViewFeatures/ref/Microsoft.AspNetCore.Mvc.ViewFeatures.netcoreapp3.0.cs b/src/Mvc/Mvc.ViewFeatures/ref/Microsoft.AspNetCore.Mvc.ViewFeatures.netcoreapp3.0.cs index de46d66d35b8..8bd949c12e3d 100644 --- a/src/Mvc/Mvc.ViewFeatures/ref/Microsoft.AspNetCore.Mvc.ViewFeatures.netcoreapp3.0.cs +++ b/src/Mvc/Mvc.ViewFeatures/ref/Microsoft.AspNetCore.Mvc.ViewFeatures.netcoreapp3.0.cs @@ -219,8 +219,8 @@ public sealed partial class AfterView : Microsoft.AspNetCore.Mvc.Diagnostics.Mvc { public const string EventName = "Microsoft.AspNetCore.Mvc.AfterView"; public AfterView(Microsoft.AspNetCore.Mvc.ViewEngines.IView view, Microsoft.AspNetCore.Mvc.Rendering.ViewContext viewContext) { } - public override int Count { get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override int Count { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair 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; } } } @@ -229,8 +229,8 @@ public sealed partial class AfterViewComponent : Microsoft.AspNetCore.Mvc.Diagno 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; } } - public override int Count { get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override int Count { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair 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; } } @@ -239,8 +239,8 @@ public sealed partial class BeforeView : Microsoft.AspNetCore.Mvc.Diagnostics.Mv { public const string EventName = "Microsoft.AspNetCore.Mvc.BeforeView"; public BeforeView(Microsoft.AspNetCore.Mvc.ViewEngines.IView view, Microsoft.AspNetCore.Mvc.Rendering.ViewContext viewContext) { } - public override int Count { get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override int Count { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair 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; } } } @@ -249,8 +249,8 @@ public sealed partial class BeforeViewComponent : Microsoft.AspNetCore.Mvc.Diagn 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; } } - public override int Count { get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override int Count { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair 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; } } } @@ -259,8 +259,8 @@ public sealed partial class ViewComponentAfterViewExecute : Microsoft.AspNetCore 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; } } - public override int Count { get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override int Count { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair 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; } } } @@ -269,8 +269,8 @@ public sealed partial class ViewComponentBeforeViewExecute : Microsoft.AspNetCor 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; } } - public override int Count { get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override int Count { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair 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; } } } @@ -279,9 +279,9 @@ public sealed partial class ViewFound : Microsoft.AspNetCore.Mvc.Diagnostics.Mvc 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; } } - public override int Count { get { throw null; } } + protected override int Count { get { throw null; } } public bool IsMainPage { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair 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; } } @@ -291,9 +291,9 @@ public sealed partial class ViewNotFound : Microsoft.AspNetCore.Mvc.Diagnostics. 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 searchedLocations) { } public Microsoft.AspNetCore.Mvc.ActionContext ActionContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override int Count { get { throw null; } } + protected override int Count { get { throw null; } } public bool IsMainPage { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } public Microsoft.AspNetCore.Mvc.ActionResult Result { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public System.Collections.Generic.IEnumerable SearchedLocations { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public string ViewName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } From b617f426cf4820d7d3fdfc63c1673fd2b4aefe7a Mon Sep 17 00:00:00 2001 From: Ben Adams Date: Mon, 1 Jul 2019 14:44:38 +0100 Subject: [PATCH 05/11] Feedback --- src/Mvc/Mvc.Razor/src/RazorPageActivator.cs | 1 + src/Mvc/Mvc.Razor/src/RazorPagePropertyActivator.cs | 6 ++++++ .../src/Infrastructure/DefaultPageFactoryProvider.cs | 1 + 3 files changed, 8 insertions(+) diff --git a/src/Mvc/Mvc.Razor/src/RazorPageActivator.cs b/src/Mvc/Mvc.Razor/src/RazorPageActivator.cs index 0788d1525453..436d6598bf90 100644 --- a/src/Mvc/Mvc.Razor/src/RazorPageActivator.cs +++ b/src/Mvc/Mvc.Razor/src/RazorPageActivator.cs @@ -44,6 +44,7 @@ public RazorPageActivator( UrlHelperAccessor = context => urlHelperFactory.GetUrlHelper(context), JsonHelperAccessor = context => jsonHelper, DiagnosticListenerAccessor = context => diagnosticListener, + DiagnosticSourceAccessor = context => diagnosticListener, HtmlEncoderAccessor = context => htmlEncoder, ModelExpressionProviderAccessor = context => modelExpressionProvider, }; diff --git a/src/Mvc/Mvc.Razor/src/RazorPagePropertyActivator.cs b/src/Mvc/Mvc.Razor/src/RazorPagePropertyActivator.cs index 81ff939f71ce..e0cf62d65833 100644 --- a/src/Mvc/Mvc.Razor/src/RazorPagePropertyActivator.cs +++ b/src/Mvc/Mvc.Razor/src/RazorPagePropertyActivator.cs @@ -112,6 +112,10 @@ private static PropertyActivator CreateActivateInfo( { valueAccessor = valueAccessors.DiagnosticListenerAccessor; } + else if (property.PropertyType == typeof(DiagnosticSource)) + { + valueAccessor = valueAccessors.DiagnosticSourceAccessor; + } else if (property.PropertyType == typeof(HtmlEncoder)) { valueAccessor = valueAccessors.HtmlEncoderAccessor; @@ -143,6 +147,8 @@ public class PropertyValueAccessors public Func DiagnosticListenerAccessor { get; set; } + public Func DiagnosticSourceAccessor { get; set; } + public Func HtmlEncoderAccessor { get; set; } public Func ModelExpressionProviderAccessor { get; set; } diff --git a/src/Mvc/Mvc.RazorPages/src/Infrastructure/DefaultPageFactoryProvider.cs b/src/Mvc/Mvc.RazorPages/src/Infrastructure/DefaultPageFactoryProvider.cs index 4a9a0483377d..6cc3c5715061 100644 --- a/src/Mvc/Mvc.RazorPages/src/Infrastructure/DefaultPageFactoryProvider.cs +++ b/src/Mvc/Mvc.RazorPages/src/Infrastructure/DefaultPageFactoryProvider.cs @@ -35,6 +35,7 @@ public DefaultPageFactoryProvider( UrlHelperAccessor = context => urlHelperFactory.GetUrlHelper(context), JsonHelperAccessor = context => jsonHelper, DiagnosticListenerAccessor = context => diagnosticListener, + DiagnosticSourceAccessor = context => diagnosticListener, HtmlEncoderAccessor = context => htmlEncoder, ModelExpressionProviderAccessor = context => modelExpressionProvider, }; From 7da97de4f8479a996aa7b786f9dbabbdb98c0f9d Mon Sep 17 00:00:00 2001 From: Ben Adams Date: Fri, 12 Jul 2019 03:01:10 +0100 Subject: [PATCH 06/11] Feedback --- ...ft.AspNetCore.Diagnostics.netcoreapp3.0.cs | 2 +- .../DeveloperExceptionPageMiddleware.cs | 12 +- ...pNetCore.Mvc.Abstractions.netcoreapp3.0.cs | 14 - .../src/Diagnostics/MvcDiagnostic.cs | 34 -- ...osoft.AspNetCore.Mvc.Core.netcoreapp3.0.cs | 75 ++-- src/Mvc/Mvc.Core/src/Diagnostics/EventData.cs | 64 +++ .../src/Diagnostics/MvcDiagnostics.cs | 367 ++++++++++-------- ...soft.AspNetCore.Mvc.Razor.netcoreapp3.0.cs | 8 +- .../src/Diagnostics/MvcDiagnostics.cs | 62 +-- ...AspNetCore.Mvc.RazorPages.netcoreapp3.0.cs | 32 +- .../src/Diagnostics/MvcDiagnostics.cs | 178 ++++----- ...pNetCore.Mvc.ViewFeatures.netcoreapp3.0.cs | 16 +- .../src/Diagnostics/MvcDiagnostics.cs | 116 +++--- 13 files changed, 517 insertions(+), 463 deletions(-) delete mode 100644 src/Mvc/Mvc.Abstractions/src/Diagnostics/MvcDiagnostic.cs create mode 100644 src/Mvc/Mvc.Core/src/Diagnostics/EventData.cs diff --git a/src/Middleware/Diagnostics/ref/Microsoft.AspNetCore.Diagnostics.netcoreapp3.0.cs b/src/Middleware/Diagnostics/ref/Microsoft.AspNetCore.Diagnostics.netcoreapp3.0.cs index 6fcf8a75c307..daf4d6edebf0 100644 --- a/src/Middleware/Diagnostics/ref/Microsoft.AspNetCore.Diagnostics.netcoreapp3.0.cs +++ b/src/Middleware/Diagnostics/ref/Microsoft.AspNetCore.Diagnostics.netcoreapp3.0.cs @@ -59,7 +59,7 @@ namespace Microsoft.AspNetCore.Diagnostics { public partial class DeveloperExceptionPageMiddleware { - public DeveloperExceptionPageMiddleware(Microsoft.AspNetCore.Http.RequestDelegate next, Microsoft.Extensions.Options.IOptions options, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, Microsoft.AspNetCore.Hosting.IWebHostEnvironment hostingEnvironment, System.Diagnostics.DiagnosticListener diagnosticListener, System.Collections.Generic.IEnumerable filters) { } + public DeveloperExceptionPageMiddleware(Microsoft.AspNetCore.Http.RequestDelegate next, Microsoft.Extensions.Options.IOptions options, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, Microsoft.AspNetCore.Hosting.IWebHostEnvironment hostingEnvironment, System.Diagnostics.DiagnosticSource diagnosticSource, System.Collections.Generic.IEnumerable filters) { } [System.Diagnostics.DebuggerStepThroughAttribute] public System.Threading.Tasks.Task Invoke(Microsoft.AspNetCore.Http.HttpContext context) { throw null; } } diff --git a/src/Middleware/Diagnostics/src/DeveloperExceptionPage/DeveloperExceptionPageMiddleware.cs b/src/Middleware/Diagnostics/src/DeveloperExceptionPage/DeveloperExceptionPageMiddleware.cs index e959cd3236ef..c503194d6c46 100644 --- a/src/Middleware/Diagnostics/src/DeveloperExceptionPage/DeveloperExceptionPageMiddleware.cs +++ b/src/Middleware/Diagnostics/src/DeveloperExceptionPage/DeveloperExceptionPageMiddleware.cs @@ -30,7 +30,7 @@ public class DeveloperExceptionPageMiddleware private readonly DeveloperExceptionPageOptions _options; private readonly ILogger _logger; private readonly IFileProvider _fileProvider; - private readonly DiagnosticListener _diagnosticListerner; + private readonly DiagnosticSource _diagnosticSource; private readonly ExceptionDetailsProvider _exceptionDetailsProvider; private readonly Func _exceptionHandler; private static readonly MediaTypeHeaderValue _textHtmlMediaType = new MediaTypeHeaderValue("text/html"); @@ -42,14 +42,14 @@ public class DeveloperExceptionPageMiddleware /// /// /// - /// + /// /// public DeveloperExceptionPageMiddleware( RequestDelegate next, IOptions options, ILoggerFactory loggerFactory, IWebHostEnvironment hostingEnvironment, - DiagnosticListener diagnosticListener, + DiagnosticSource diagnosticSource, IEnumerable filters) { if (next == null) @@ -71,7 +71,7 @@ public DeveloperExceptionPageMiddleware( _options = options.Value; _logger = loggerFactory.CreateLogger(); _fileProvider = _options.FileProvider ?? hostingEnvironment.ContentRootFileProvider; - _diagnosticListerner = diagnosticListener; + _diagnosticSource = diagnosticSource; _exceptionDetailsProvider = new ExceptionDetailsProvider(_fileProvider, _options.SourceCodeLineCount); _exceptionHandler = DisplayException; @@ -110,9 +110,9 @@ public async Task Invoke(HttpContext context) await _exceptionHandler(new ErrorContext(context, ex)); - if (_diagnosticListerner.IsEnabled() && _diagnosticListerner.IsEnabled("Microsoft.AspNetCore.Diagnostics.UnhandledException")) + if (_diagnosticSource.IsEnabled("Microsoft.AspNetCore.Diagnostics.UnhandledException")) { - _diagnosticListerner.Write("Microsoft.AspNetCore.Diagnostics.UnhandledException", new { httpContext = context, exception = ex }); + _diagnosticSource.Write("Microsoft.AspNetCore.Diagnostics.UnhandledException", new { httpContext = context, exception = ex }); } return; diff --git a/src/Mvc/Mvc.Abstractions/ref/Microsoft.AspNetCore.Mvc.Abstractions.netcoreapp3.0.cs b/src/Mvc/Mvc.Abstractions/ref/Microsoft.AspNetCore.Mvc.Abstractions.netcoreapp3.0.cs index e6fae54e55e4..3dc69d93e8a8 100644 --- a/src/Mvc/Mvc.Abstractions/ref/Microsoft.AspNetCore.Mvc.Abstractions.netcoreapp3.0.cs +++ b/src/Mvc/Mvc.Abstractions/ref/Microsoft.AspNetCore.Mvc.Abstractions.netcoreapp3.0.cs @@ -209,20 +209,6 @@ public partial interface IAllowAnonymousFilter : Microsoft.AspNetCore.Mvc.Filter { } } -namespace Microsoft.AspNetCore.Mvc.Diagnostics -{ - public abstract partial class MvcDiagnostic : System.Collections.Generic.IEnumerable>, System.Collections.Generic.IReadOnlyCollection>, System.Collections.Generic.IReadOnlyList>, System.Collections.IEnumerable - { - protected const string EventNamespace = "Microsoft.AspNetCore.Mvc."; - protected MvcDiagnostic() { } - protected abstract int Count { get; } - protected abstract System.Collections.Generic.KeyValuePair this[int index] { get; } - int System.Collections.Generic.IReadOnlyCollection>.Count { get { throw null; } } - System.Collections.Generic.KeyValuePair System.Collections.Generic.IReadOnlyList>.this[int index] { get { throw null; } } - System.Collections.Generic.IEnumerator> System.Collections.Generic.IEnumerable>.GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } -} namespace Microsoft.AspNetCore.Mvc.Filters { public partial class ActionExecutedContext : Microsoft.AspNetCore.Mvc.Filters.FilterContext diff --git a/src/Mvc/Mvc.Abstractions/src/Diagnostics/MvcDiagnostic.cs b/src/Mvc/Mvc.Abstractions/src/Diagnostics/MvcDiagnostic.cs deleted file mode 100644 index 390c575bf7a6..000000000000 --- a/src/Mvc/Mvc.Abstractions/src/Diagnostics/MvcDiagnostic.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections; -using System.Collections.Generic; - -namespace Microsoft.AspNetCore.Mvc.Diagnostics -{ - public abstract class MvcDiagnostic : IReadOnlyList> - { - protected const string EventNamespace = "Microsoft.AspNetCore.Mvc."; - - protected abstract int Count { get; } - protected abstract KeyValuePair this[int index] { get; } - - int IReadOnlyCollection>.Count => Count; - KeyValuePair IReadOnlyList>.this[int index] => this[index]; - - IEnumerator> IEnumerable>.GetEnumerator() - => GetEnumerator(); - - IEnumerator IEnumerable.GetEnumerator() - => GetEnumerator(); - - private IEnumerator> GetEnumerator() - { - var count = Count; - for (var i = 0; i < count; i++) - { - yield return this[i]; - } - } - } -} \ No newline at end of file diff --git a/src/Mvc/Mvc.Core/ref/Microsoft.AspNetCore.Mvc.Core.netcoreapp3.0.cs b/src/Mvc/Mvc.Core/ref/Microsoft.AspNetCore.Mvc.Core.netcoreapp3.0.cs index d08fc7d9b8c7..64a9277e17fb 100644 --- a/src/Mvc/Mvc.Core/ref/Microsoft.AspNetCore.Mvc.Core.netcoreapp3.0.cs +++ b/src/Mvc/Mvc.Core/ref/Microsoft.AspNetCore.Mvc.Core.netcoreapp3.0.cs @@ -1720,7 +1720,18 @@ public partial interface IAntiforgeryValidationFailedResult : Microsoft.AspNetCo } namespace Microsoft.AspNetCore.Mvc.Diagnostics { - public sealed partial class AfterAction : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + public abstract partial class EventData : System.Collections.Generic.IEnumerable>, System.Collections.Generic.IReadOnlyCollection>, System.Collections.Generic.IReadOnlyList>, System.Collections.IEnumerable + { + protected const string EventNamespace = "Microsoft.AspNetCore.Mvc."; + protected EventData() { } + protected abstract int Count { get; } + protected abstract System.Collections.Generic.KeyValuePair this[int index] { get; } + int System.Collections.Generic.IReadOnlyCollection>.Count { get { throw null; } } + System.Collections.Generic.KeyValuePair System.Collections.Generic.IReadOnlyList>.this[int index] { get { throw null; } } + System.Collections.Generic.IEnumerator> System.Collections.Generic.IEnumerable>.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + 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) { } @@ -1730,18 +1741,18 @@ public AfterAction(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor action protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + 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.IDictionary arguments, object controller, Microsoft.AspNetCore.Mvc.IActionResult result) { } + public AfterActionMethod(Microsoft.AspNetCore.Mvc.ActionContext actionContext, System.Collections.Generic.IReadOnlyDictionary 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.IDictionary Arguments { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Collections.Generic.IReadOnlyDictionary 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 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.MvcDiagnostic + 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) { } @@ -1750,7 +1761,7 @@ public AfterActionResult(Microsoft.AspNetCore.Mvc.ActionContext actionContext, M protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + 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) { } @@ -1760,7 +1771,7 @@ public AfterOnActionExecuted(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescrip public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } - public sealed partial class AfterOnActionExecuting : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + 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) { } @@ -1770,7 +1781,7 @@ public AfterOnActionExecuting(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescri public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } - public sealed partial class AfterOnActionExecution : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + 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) { } @@ -1780,7 +1791,7 @@ public AfterOnActionExecution(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescri public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } - public sealed partial class AfterOnAuthorization : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + 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) { } @@ -1790,7 +1801,7 @@ public AfterOnAuthorization(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescript public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } - public sealed partial class AfterOnException : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + 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) { } @@ -1800,7 +1811,7 @@ public AfterOnException(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor a public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } - public sealed partial class AfterOnResourceExecuted : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + 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) { } @@ -1810,7 +1821,7 @@ public AfterOnResourceExecuted(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescr protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + 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) { } @@ -1820,7 +1831,7 @@ public AfterOnResourceExecuting(Microsoft.AspNetCore.Mvc.Abstractions.ActionDesc protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + 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) { } @@ -1830,7 +1841,7 @@ public AfterOnResourceExecution(Microsoft.AspNetCore.Mvc.Abstractions.ActionDesc protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + 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) { } @@ -1840,7 +1851,7 @@ public AfterOnResultExecuted(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescrip protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + 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) { } @@ -1850,7 +1861,7 @@ public AfterOnResultExecuting(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescri protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + 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) { } @@ -1860,7 +1871,7 @@ public AfterOnResultExecution(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescri protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + 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) { } @@ -1870,17 +1881,17 @@ public BeforeAction(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actio protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + 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.IDictionary arguments, object controller) { } + public BeforeActionMethod(Microsoft.AspNetCore.Mvc.ActionContext actionContext, System.Collections.Generic.IReadOnlyDictionary arguments, object controller) { } public Microsoft.AspNetCore.Mvc.ActionContext ActionContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Collections.Generic.IDictionary Arguments { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Collections.Generic.IReadOnlyDictionary 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 this[int index] { get { throw null; } } } - public sealed partial class BeforeActionResult : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + 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) { } @@ -1889,7 +1900,7 @@ public BeforeActionResult(Microsoft.AspNetCore.Mvc.ActionContext actionContext, protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + 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) { } @@ -1899,7 +1910,7 @@ public BeforeOnActionExecuted(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescri public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } - public sealed partial class BeforeOnActionExecuting : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + 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) { } @@ -1909,7 +1920,7 @@ public BeforeOnActionExecuting(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescr public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } - public sealed partial class BeforeOnActionExecution : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + 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) { } @@ -1919,7 +1930,7 @@ public BeforeOnActionExecution(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescr public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } - public sealed partial class BeforeOnAuthorization : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + 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) { } @@ -1929,7 +1940,7 @@ public BeforeOnAuthorization(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescrip public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } - public sealed partial class BeforeOnException : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + 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) { } @@ -1939,7 +1950,7 @@ public BeforeOnException(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor public Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata Filter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } - public sealed partial class BeforeOnResourceExecuted : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + 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) { } @@ -1949,7 +1960,7 @@ public BeforeOnResourceExecuted(Microsoft.AspNetCore.Mvc.Abstractions.ActionDesc protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + 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) { } @@ -1959,7 +1970,7 @@ public BeforeOnResourceExecuting(Microsoft.AspNetCore.Mvc.Abstractions.ActionDes protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + 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) { } @@ -1969,7 +1980,7 @@ public BeforeOnResourceExecution(Microsoft.AspNetCore.Mvc.Abstractions.ActionDes protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + 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) { } @@ -1979,7 +1990,7 @@ public BeforeOnResultExecuted(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescri protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + 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) { } @@ -1989,7 +2000,7 @@ public BeforeOnResultExecuting(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescr protected override System.Collections.Generic.KeyValuePair 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.MvcDiagnostic + 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) { } diff --git a/src/Mvc/Mvc.Core/src/Diagnostics/EventData.cs b/src/Mvc/Mvc.Core/src/Diagnostics/EventData.cs new file mode 100644 index 000000000000..b9d064c31410 --- /dev/null +++ b/src/Mvc/Mvc.Core/src/Diagnostics/EventData.cs @@ -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> + { + protected const string EventNamespace = "Microsoft.AspNetCore.Mvc."; + + protected abstract int Count { get; } + protected abstract KeyValuePair this[int index] { get; } + + int IReadOnlyCollection>.Count => Count; + KeyValuePair IReadOnlyList>.this[int index] => this[index]; + + Enumerator GetEnumerator() => new Enumerator(this); + + IEnumerator> IEnumerable>.GetEnumerator() + => GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() + => GetEnumerator(); + + public struct Enumerator : IEnumerator> + { + private readonly EventData _eventData; + private readonly int _count; + + private int _index; + + public KeyValuePair 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(); + } + } +} diff --git a/src/Mvc/Mvc.Core/src/Diagnostics/MvcDiagnostics.cs b/src/Mvc/Mvc.Core/src/Diagnostics/MvcDiagnostics.cs index 583dd1a913c7..8c98d8f30278 100644 --- a/src/Mvc/Mvc.Core/src/Diagnostics/MvcDiagnostics.cs +++ b/src/Mvc/Mvc.Core/src/Diagnostics/MvcDiagnostics.cs @@ -10,15 +10,9 @@ namespace Microsoft.AspNetCore.Mvc.Diagnostics { - public sealed class BeforeAction : MvcDiagnostic + public sealed class BeforeAction : EventData { public const string EventName = EventNamespace + nameof(BeforeAction); - public ActionDescriptor ActionDescriptor { get; } - public HttpContext HttpContext { get; } - public RouteData RouteData { get; } - - protected override int Count => 3; - public BeforeAction(ActionDescriptor actionDescriptor, HttpContext httpContext, RouteData routeData) { ActionDescriptor = actionDescriptor; @@ -26,6 +20,12 @@ public BeforeAction(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 this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -35,14 +35,9 @@ public BeforeAction(ActionDescriptor actionDescriptor, HttpContext httpContext, }; } - public sealed class AfterAction : MvcDiagnostic + public sealed class AfterAction : EventData { public const string EventName = EventNamespace + nameof(AfterAction); - public ActionDescriptor ActionDescriptor { get; } - public HttpContext HttpContext { get; } - public RouteData RouteData { get; } - - protected override int Count => 3; public AfterAction(ActionDescriptor actionDescriptor, HttpContext httpContext, RouteData routeData) { @@ -51,6 +46,12 @@ public AfterAction(ActionDescriptor actionDescriptor, HttpContext httpContext, R RouteData = routeData; } + public ActionDescriptor ActionDescriptor { get; } + public HttpContext HttpContext { get; } + public RouteData RouteData { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -60,14 +61,9 @@ public AfterAction(ActionDescriptor actionDescriptor, HttpContext httpContext, R }; } - public sealed class BeforeOnAuthorization : MvcDiagnostic + public sealed class BeforeOnAuthorization : EventData { public const string EventName = EventNamespace + nameof(BeforeOnAuthorization); - public ActionDescriptor ActionDescriptor { get; } - public AuthorizationFilterContext AuthorizationContext { get; } - public IFilterMetadata Filter { get; } - - protected override int Count => 3; public BeforeOnAuthorization(ActionDescriptor actionDescriptor, AuthorizationFilterContext authorizationContext, IFilterMetadata filter) { @@ -76,6 +72,12 @@ public BeforeOnAuthorization(ActionDescriptor actionDescriptor, AuthorizationFil Filter = filter; } + public ActionDescriptor ActionDescriptor { get; } + public AuthorizationFilterContext AuthorizationContext { get; } + public IFilterMetadata Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -85,14 +87,9 @@ public BeforeOnAuthorization(ActionDescriptor actionDescriptor, AuthorizationFil }; } - public sealed class AfterOnAuthorization : MvcDiagnostic + public sealed class AfterOnAuthorization : EventData { public const string EventName = EventNamespace + nameof(AfterOnAuthorization); - public ActionDescriptor ActionDescriptor { get; } - public AuthorizationFilterContext AuthorizationContext { get; } - public IFilterMetadata Filter { get; } - - protected override int Count => 3; public AfterOnAuthorization(ActionDescriptor actionDescriptor, AuthorizationFilterContext authorizationContext, IFilterMetadata filter) { @@ -101,6 +98,12 @@ public AfterOnAuthorization(ActionDescriptor actionDescriptor, AuthorizationFilt Filter = filter; } + public ActionDescriptor ActionDescriptor { get; } + public AuthorizationFilterContext AuthorizationContext { get; } + public IFilterMetadata Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -110,14 +113,9 @@ public AfterOnAuthorization(ActionDescriptor actionDescriptor, AuthorizationFilt }; } - public sealed class BeforeOnResourceExecution : MvcDiagnostic + public sealed class BeforeOnResourceExecution : EventData { public const string EventName = EventNamespace + nameof(BeforeOnResourceExecution); - public ActionDescriptor ActionDescriptor { get; } - public ResourceExecutingContext ResourceExecutingContext { get; } - public IFilterMetadata Filter { get; } - - protected override int Count => 3; public BeforeOnResourceExecution(ActionDescriptor actionDescriptor, ResourceExecutingContext resourceExecutingContext, IFilterMetadata filter) { @@ -126,6 +124,12 @@ public BeforeOnResourceExecution(ActionDescriptor actionDescriptor, ResourceExec Filter = filter; } + public ActionDescriptor ActionDescriptor { get; } + public ResourceExecutingContext ResourceExecutingContext { get; } + public IFilterMetadata Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -135,14 +139,9 @@ public BeforeOnResourceExecution(ActionDescriptor actionDescriptor, ResourceExec }; } - public sealed class AfterOnResourceExecution : MvcDiagnostic + public sealed class AfterOnResourceExecution : EventData { public const string EventName = EventNamespace + nameof(AfterOnResourceExecution); - public ActionDescriptor ActionDescriptor { get; } - public ResourceExecutedContext ResourceExecutedContext { get; } - public IFilterMetadata Filter { get; } - - protected override int Count => 3; public AfterOnResourceExecution(ActionDescriptor actionDescriptor, ResourceExecutedContext resourceExecutedContext, IFilterMetadata filter) { @@ -151,6 +150,12 @@ public AfterOnResourceExecution(ActionDescriptor actionDescriptor, ResourceExecu Filter = filter; } + public ActionDescriptor ActionDescriptor { get; } + public ResourceExecutedContext ResourceExecutedContext { get; } + public IFilterMetadata Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -160,14 +165,9 @@ public AfterOnResourceExecution(ActionDescriptor actionDescriptor, ResourceExecu }; } - public sealed class BeforeOnResourceExecuting : MvcDiagnostic + public sealed class BeforeOnResourceExecuting : EventData { public const string EventName = EventNamespace + nameof(BeforeOnResourceExecuting); - public ActionDescriptor ActionDescriptor { get; } - public ResourceExecutingContext ResourceExecutingContext { get; } - public IFilterMetadata Filter { get; } - - protected override int Count => 3; public BeforeOnResourceExecuting(ActionDescriptor actionDescriptor, ResourceExecutingContext resourceExecutingContext, IFilterMetadata filter) { @@ -176,6 +176,12 @@ public BeforeOnResourceExecuting(ActionDescriptor actionDescriptor, ResourceExec Filter = filter; } + public ActionDescriptor ActionDescriptor { get; } + public ResourceExecutingContext ResourceExecutingContext { get; } + public IFilterMetadata Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -185,14 +191,9 @@ public BeforeOnResourceExecuting(ActionDescriptor actionDescriptor, ResourceExec }; } - public sealed class AfterOnResourceExecuting : MvcDiagnostic + public sealed class AfterOnResourceExecuting : EventData { public const string EventName = EventNamespace + nameof(AfterOnResourceExecuting); - public ActionDescriptor ActionDescriptor { get; } - public ResourceExecutingContext ResourceExecutingContext { get; } - public IFilterMetadata Filter { get; } - - protected override int Count => 3; public AfterOnResourceExecuting(ActionDescriptor actionDescriptor, ResourceExecutingContext resourceExecutingContext, IFilterMetadata filter) { @@ -201,6 +202,12 @@ public AfterOnResourceExecuting(ActionDescriptor actionDescriptor, ResourceExecu Filter = filter; } + public ActionDescriptor ActionDescriptor { get; } + public ResourceExecutingContext ResourceExecutingContext { get; } + public IFilterMetadata Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -210,14 +217,9 @@ public AfterOnResourceExecuting(ActionDescriptor actionDescriptor, ResourceExecu }; } - public sealed class BeforeOnResourceExecuted : MvcDiagnostic + public sealed class BeforeOnResourceExecuted : EventData { public const string EventName = EventNamespace + nameof(BeforeOnResourceExecuted); - public ActionDescriptor ActionDescriptor { get; } - public ResourceExecutedContext ResourceExecutedContext { get; } - public IFilterMetadata Filter { get; } - - protected override int Count => 3; public BeforeOnResourceExecuted(ActionDescriptor actionDescriptor, ResourceExecutedContext resourceExecutedContext, IFilterMetadata filter) { @@ -226,6 +228,12 @@ public BeforeOnResourceExecuted(ActionDescriptor actionDescriptor, ResourceExecu Filter = filter; } + public ActionDescriptor ActionDescriptor { get; } + public ResourceExecutedContext ResourceExecutedContext { get; } + public IFilterMetadata Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -235,14 +243,9 @@ public BeforeOnResourceExecuted(ActionDescriptor actionDescriptor, ResourceExecu }; } - public sealed class AfterOnResourceExecuted : MvcDiagnostic + public sealed class AfterOnResourceExecuted : EventData { public const string EventName = EventNamespace + nameof(AfterOnResourceExecuted); - public ActionDescriptor ActionDescriptor { get; } - public ResourceExecutedContext ResourceExecutedContext { get; } - public IFilterMetadata Filter { get; } - - protected override int Count => 3; public AfterOnResourceExecuted(ActionDescriptor actionDescriptor, ResourceExecutedContext resourceExecutedContext, IFilterMetadata filter) { @@ -251,6 +254,12 @@ public AfterOnResourceExecuted(ActionDescriptor actionDescriptor, ResourceExecut Filter = filter; } + public ActionDescriptor ActionDescriptor { get; } + public ResourceExecutedContext ResourceExecutedContext { get; } + public IFilterMetadata Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -260,14 +269,9 @@ public AfterOnResourceExecuted(ActionDescriptor actionDescriptor, ResourceExecut }; } - public sealed class BeforeOnException : MvcDiagnostic + public sealed class BeforeOnException : EventData { public const string EventName = EventNamespace + nameof(BeforeOnException); - public ActionDescriptor ActionDescriptor { get; } - public ExceptionContext ExceptionContext { get; } - public IFilterMetadata Filter { get; } - - protected override int Count => 3; public BeforeOnException(ActionDescriptor actionDescriptor, ExceptionContext exceptionContext, IFilterMetadata filter) { @@ -276,6 +280,12 @@ public BeforeOnException(ActionDescriptor actionDescriptor, ExceptionContext exc Filter = filter; } + public ActionDescriptor ActionDescriptor { get; } + public ExceptionContext ExceptionContext { get; } + public IFilterMetadata Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -285,14 +295,9 @@ public BeforeOnException(ActionDescriptor actionDescriptor, ExceptionContext exc }; } - public sealed class AfterOnException : MvcDiagnostic + public sealed class AfterOnException : EventData { public const string EventName = EventNamespace + nameof(AfterOnException); - public ActionDescriptor ActionDescriptor { get; } - public ExceptionContext ExceptionContext { get; } - public IFilterMetadata Filter { get; } - - protected override int Count => 3; public AfterOnException(ActionDescriptor actionDescriptor, ExceptionContext exceptionContext, IFilterMetadata filter) { @@ -301,6 +306,12 @@ public AfterOnException(ActionDescriptor actionDescriptor, ExceptionContext exce Filter = filter; } + public ActionDescriptor ActionDescriptor { get; } + public ExceptionContext ExceptionContext { get; } + public IFilterMetadata Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -310,14 +321,9 @@ public AfterOnException(ActionDescriptor actionDescriptor, ExceptionContext exce }; } - public sealed class BeforeOnActionExecution : MvcDiagnostic + public sealed class BeforeOnActionExecution : EventData { public const string EventName = EventNamespace + nameof(BeforeOnActionExecution); - public ActionDescriptor ActionDescriptor { get; } - public ActionExecutingContext ActionExecutingContext { get; } - public IFilterMetadata Filter { get; } - - protected override int Count => 3; public BeforeOnActionExecution(ActionDescriptor actionDescriptor, ActionExecutingContext actionExecutingContext, IFilterMetadata filter) { @@ -326,6 +332,12 @@ public BeforeOnActionExecution(ActionDescriptor actionDescriptor, ActionExecutin Filter = filter; } + public ActionDescriptor ActionDescriptor { get; } + public ActionExecutingContext ActionExecutingContext { get; } + public IFilterMetadata Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -335,14 +347,9 @@ public BeforeOnActionExecution(ActionDescriptor actionDescriptor, ActionExecutin }; } - public sealed class AfterOnActionExecution : MvcDiagnostic + public sealed class AfterOnActionExecution : EventData { public const string EventName = EventNamespace + nameof(AfterOnActionExecution); - public ActionDescriptor ActionDescriptor { get; } - public ActionExecutedContext ActionExecutedContext { get; } - public IFilterMetadata Filter { get; } - - protected override int Count => 3; public AfterOnActionExecution(ActionDescriptor actionDescriptor, ActionExecutedContext actionExecutedContext, IFilterMetadata filter) { @@ -351,6 +358,12 @@ public AfterOnActionExecution(ActionDescriptor actionDescriptor, ActionExecutedC Filter = filter; } + public ActionDescriptor ActionDescriptor { get; } + public ActionExecutedContext ActionExecutedContext { get; } + public IFilterMetadata Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -360,14 +373,9 @@ public AfterOnActionExecution(ActionDescriptor actionDescriptor, ActionExecutedC }; } - public sealed class BeforeOnActionExecuting : MvcDiagnostic + public sealed class BeforeOnActionExecuting : EventData { public const string EventName = EventNamespace + nameof(BeforeOnActionExecuting); - public ActionDescriptor ActionDescriptor { get; } - public ActionExecutingContext ActionExecutingContext { get; } - public IFilterMetadata Filter { get; } - - protected override int Count => 3; public BeforeOnActionExecuting(ActionDescriptor actionDescriptor, ActionExecutingContext actionExecutingContext, IFilterMetadata filter) { @@ -376,6 +384,12 @@ public BeforeOnActionExecuting(ActionDescriptor actionDescriptor, ActionExecutin Filter = filter; } + public ActionDescriptor ActionDescriptor { get; } + public ActionExecutingContext ActionExecutingContext { get; } + public IFilterMetadata Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -385,14 +399,9 @@ public BeforeOnActionExecuting(ActionDescriptor actionDescriptor, ActionExecutin }; } - public sealed class AfterOnActionExecuting : MvcDiagnostic + public sealed class AfterOnActionExecuting : EventData { public const string EventName = EventNamespace + nameof(AfterOnActionExecuting); - public ActionDescriptor ActionDescriptor { get; } - public ActionExecutingContext ActionExecutingContext { get; } - public IFilterMetadata Filter { get; } - - protected override int Count => 3; public AfterOnActionExecuting(ActionDescriptor actionDescriptor, ActionExecutingContext actionExecutingContext, IFilterMetadata filter) { @@ -401,6 +410,12 @@ public AfterOnActionExecuting(ActionDescriptor actionDescriptor, ActionExecuting Filter = filter; } + public ActionDescriptor ActionDescriptor { get; } + public ActionExecutingContext ActionExecutingContext { get; } + public IFilterMetadata Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -410,14 +425,9 @@ public AfterOnActionExecuting(ActionDescriptor actionDescriptor, ActionExecuting }; } - public sealed class BeforeOnActionExecuted : MvcDiagnostic + public sealed class BeforeOnActionExecuted : EventData { public const string EventName = EventNamespace + nameof(BeforeOnActionExecuted); - public ActionDescriptor ActionDescriptor { get; } - public ActionExecutedContext ActionExecutedContext { get; } - public IFilterMetadata Filter { get; } - - protected override int Count => 3; public BeforeOnActionExecuted(ActionDescriptor actionDescriptor, ActionExecutedContext actionExecutedContext, IFilterMetadata filter) { @@ -426,6 +436,12 @@ public BeforeOnActionExecuted(ActionDescriptor actionDescriptor, ActionExecutedC Filter = filter; } + public ActionDescriptor ActionDescriptor { get; } + public ActionExecutedContext ActionExecutedContext { get; } + public IFilterMetadata Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -435,14 +451,9 @@ public BeforeOnActionExecuted(ActionDescriptor actionDescriptor, ActionExecutedC }; } - public sealed class AfterOnActionExecuted : MvcDiagnostic + public sealed class AfterOnActionExecuted : EventData { public const string EventName = EventNamespace + nameof(AfterOnActionExecuted); - public ActionDescriptor ActionDescriptor { get; } - public ActionExecutedContext ActionExecutedContext { get; } - public IFilterMetadata Filter { get; } - - protected override int Count => 3; public AfterOnActionExecuted(ActionDescriptor actionDescriptor, ActionExecutedContext actionExecutedContext, IFilterMetadata filter) { @@ -451,6 +462,12 @@ public AfterOnActionExecuted(ActionDescriptor actionDescriptor, ActionExecutedCo Filter = filter; } + public ActionDescriptor ActionDescriptor { get; } + public ActionExecutedContext ActionExecutedContext { get; } + public IFilterMetadata Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -460,22 +477,23 @@ public AfterOnActionExecuted(ActionDescriptor actionDescriptor, ActionExecutedCo }; } - public sealed class BeforeActionMethod : MvcDiagnostic + public sealed class BeforeActionMethod : EventData { public const string EventName = EventNamespace + nameof(BeforeActionMethod); - public ActionContext ActionContext { get; } - public IDictionary Arguments { get; } - public object Controller { get; } - - protected override int Count => 3; - public BeforeActionMethod(ActionContext actionContext, IDictionary arguments, object controller) + public BeforeActionMethod(ActionContext actionContext, IReadOnlyDictionary arguments, object controller) { ActionContext = actionContext; Arguments = arguments; Controller = controller; } + public ActionContext ActionContext { get; } + public IReadOnlyDictionary Arguments { get; } + public object Controller { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionContext), ActionContext), @@ -485,17 +503,11 @@ public BeforeActionMethod(ActionContext actionContext, IDictionary Arguments { get; } - public object Controller { get; } - public IActionResult Result { get; } - protected override int Count => 4; - - public AfterActionMethod(ActionContext actionContext, IDictionary arguments, object controller, IActionResult result) + public AfterActionMethod(ActionContext actionContext, IReadOnlyDictionary arguments, object controller, IActionResult result) { ActionContext = actionContext; Arguments = arguments; @@ -503,6 +515,13 @@ public AfterActionMethod(ActionContext actionContext, IDictionary Arguments { get; } + public object Controller { get; } + public IActionResult Result { get; } + + protected override int Count => 4; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionContext), ActionContext), @@ -513,14 +532,9 @@ public AfterActionMethod(ActionContext actionContext, IDictionary 3; public BeforeOnResultExecution(ActionDescriptor actionDescriptor, ResultExecutingContext resultExecutingContext, IFilterMetadata filter) { @@ -529,6 +543,12 @@ public BeforeOnResultExecution(ActionDescriptor actionDescriptor, ResultExecutin Filter = filter; } + public ActionDescriptor ActionDescriptor { get; } + public ResultExecutingContext ResultExecutingContext { get; } + public IFilterMetadata Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -538,14 +558,9 @@ public BeforeOnResultExecution(ActionDescriptor actionDescriptor, ResultExecutin }; } - public sealed class AfterOnResultExecution : MvcDiagnostic + public sealed class AfterOnResultExecution : EventData { public const string EventName = EventNamespace + nameof(AfterOnResultExecution); - public ActionDescriptor ActionDescriptor { get; } - public ResultExecutedContext ResultExecutedContext { get; } - public IFilterMetadata Filter { get; } - - protected override int Count => 3; public AfterOnResultExecution(ActionDescriptor actionDescriptor, ResultExecutedContext resultExecutedContext, IFilterMetadata filter) { @@ -554,6 +569,12 @@ public AfterOnResultExecution(ActionDescriptor actionDescriptor, ResultExecutedC Filter = filter; } + public ActionDescriptor ActionDescriptor { get; } + public ResultExecutedContext ResultExecutedContext { get; } + public IFilterMetadata Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -563,14 +584,9 @@ public AfterOnResultExecution(ActionDescriptor actionDescriptor, ResultExecutedC }; } - public sealed class BeforeOnResultExecuting : MvcDiagnostic + public sealed class BeforeOnResultExecuting : EventData { public const string EventName = EventNamespace + nameof(BeforeOnResultExecuting); - public ActionDescriptor ActionDescriptor { get; } - public ResultExecutingContext ResultExecutingContext { get; } - public IFilterMetadata Filter { get; } - - protected override int Count => 3; public BeforeOnResultExecuting(ActionDescriptor actionDescriptor, ResultExecutingContext resultExecutingContext, IFilterMetadata filter) { @@ -579,6 +595,12 @@ public BeforeOnResultExecuting(ActionDescriptor actionDescriptor, ResultExecutin Filter = filter; } + public ActionDescriptor ActionDescriptor { get; } + public ResultExecutingContext ResultExecutingContext { get; } + public IFilterMetadata Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -588,14 +610,9 @@ public BeforeOnResultExecuting(ActionDescriptor actionDescriptor, ResultExecutin }; } - public sealed class AfterOnResultExecuting : MvcDiagnostic + public sealed class AfterOnResultExecuting : EventData { public const string EventName = EventNamespace + nameof(AfterOnResultExecuting); - public ActionDescriptor ActionDescriptor { get; } - public ResultExecutingContext ResultExecutingContext { get; } - public IFilterMetadata Filter { get; } - - protected override int Count => 3; public AfterOnResultExecuting(ActionDescriptor actionDescriptor, ResultExecutingContext resultExecutingContext, IFilterMetadata filter) { @@ -604,6 +621,12 @@ public AfterOnResultExecuting(ActionDescriptor actionDescriptor, ResultExecuting Filter = filter; } + public ActionDescriptor ActionDescriptor { get; } + public ResultExecutingContext ResultExecutingContext { get; } + public IFilterMetadata Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -613,14 +636,9 @@ public AfterOnResultExecuting(ActionDescriptor actionDescriptor, ResultExecuting }; } - public sealed class BeforeOnResultExecuted : MvcDiagnostic + public sealed class BeforeOnResultExecuted : EventData { public const string EventName = EventNamespace + nameof(BeforeOnResultExecuted); - public ActionDescriptor ActionDescriptor { get; } - public ResultExecutedContext ResultExecutedContext { get; } - public IFilterMetadata Filter { get; } - - protected override int Count => 3; public BeforeOnResultExecuted(ActionDescriptor actionDescriptor, ResultExecutedContext resultExecutedContext, IFilterMetadata filter) { @@ -629,6 +647,12 @@ public BeforeOnResultExecuted(ActionDescriptor actionDescriptor, ResultExecutedC Filter = filter; } + public ActionDescriptor ActionDescriptor { get; } + public ResultExecutedContext ResultExecutedContext { get; } + public IFilterMetadata Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -638,14 +662,9 @@ public BeforeOnResultExecuted(ActionDescriptor actionDescriptor, ResultExecutedC }; } - public sealed class AfterOnResultExecuted : MvcDiagnostic + public sealed class AfterOnResultExecuted : EventData { public const string EventName = EventNamespace + nameof(AfterOnResultExecuted); - public ActionDescriptor ActionDescriptor { get; } - public ResultExecutedContext ResultExecutedContext { get; } - public IFilterMetadata Filter { get; } - - protected override int Count => 3; public AfterOnResultExecuted(ActionDescriptor actionDescriptor, ResultExecutedContext resultExecutedContext, IFilterMetadata filter) { @@ -654,6 +673,12 @@ public AfterOnResultExecuted(ActionDescriptor actionDescriptor, ResultExecutedCo Filter = filter; } + public ActionDescriptor ActionDescriptor { get; } + public ResultExecutedContext ResultExecutedContext { get; } + public IFilterMetadata Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -663,13 +688,9 @@ public AfterOnResultExecuted(ActionDescriptor actionDescriptor, ResultExecutedCo }; } - public sealed class BeforeActionResult : MvcDiagnostic + public sealed class BeforeActionResult : EventData { public const string EventName = EventNamespace + nameof(BeforeActionResult); - public ActionContext ActionContext { get; } - public IActionResult Result { get; } - - protected override int Count => 2; public BeforeActionResult(ActionContext actionContext, IActionResult result) { @@ -677,6 +698,11 @@ public BeforeActionResult(ActionContext actionContext, IActionResult result) Result = result; } + public ActionContext ActionContext { get; } + public IActionResult Result { get; } + + protected override int Count => 2; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionContext), ActionContext), @@ -685,13 +711,9 @@ public BeforeActionResult(ActionContext actionContext, IActionResult result) }; } - public sealed class AfterActionResult : MvcDiagnostic + public sealed class AfterActionResult : EventData { public const string EventName = EventNamespace + nameof(AfterActionResult); - public ActionContext ActionContext { get; } - public IActionResult Result { get; } - - protected override int Count => 2; public AfterActionResult(ActionContext actionContext, IActionResult result) { @@ -699,6 +721,11 @@ public AfterActionResult(ActionContext actionContext, IActionResult result) Result = result; } + public ActionContext ActionContext { get; } + public IActionResult Result { get; } + + protected override int Count => 2; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionContext), ActionContext), diff --git a/src/Mvc/Mvc.Razor/ref/Microsoft.AspNetCore.Mvc.Razor.netcoreapp3.0.cs b/src/Mvc/Mvc.Razor/ref/Microsoft.AspNetCore.Mvc.Razor.netcoreapp3.0.cs index 9ae0ae106cf6..402a9d3a3a35 100644 --- a/src/Mvc/Mvc.Razor/ref/Microsoft.AspNetCore.Mvc.Razor.netcoreapp3.0.cs +++ b/src/Mvc/Mvc.Razor/ref/Microsoft.AspNetCore.Mvc.Razor.netcoreapp3.0.cs @@ -23,7 +23,7 @@ public partial interface IRazorCompiledItemProvider } namespace Microsoft.AspNetCore.Mvc.Diagnostics { - public sealed partial class AfterViewPage : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + 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) { } @@ -34,7 +34,7 @@ public AfterViewPage(Microsoft.AspNetCore.Mvc.Razor.IRazorPage page, Microsoft.A 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.MvcDiagnostic + 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) { } @@ -45,7 +45,7 @@ public BeforeViewPage(Microsoft.AspNetCore.Mvc.Razor.IRazorPage page, Microsoft. 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 BeginInstrumentationContext : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + public sealed partial class BeginInstrumentationContext : Microsoft.AspNetCore.Mvc.Diagnostics.EventData { public const string EventName = "Microsoft.AspNetCore.Mvc.Razor.BeginInstrumentationContext"; public BeginInstrumentationContext(Microsoft.AspNetCore.Http.HttpContext httpContext, string path, int position, int length, bool isLiteral) { } @@ -57,7 +57,7 @@ public BeginInstrumentationContext(Microsoft.AspNetCore.Http.HttpContext httpCon public string Path { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public int Position { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } } - public sealed partial class EndInstrumentationContext : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + public sealed partial class EndInstrumentationContext : Microsoft.AspNetCore.Mvc.Diagnostics.EventData { public const string EventName = "Microsoft.AspNetCore.Mvc.Razor.EndInstrumentationContext"; public EndInstrumentationContext(Microsoft.AspNetCore.Http.HttpContext httpContext, string path) { } diff --git a/src/Mvc/Mvc.Razor/src/Diagnostics/MvcDiagnostics.cs b/src/Mvc/Mvc.Razor/src/Diagnostics/MvcDiagnostics.cs index 39f83f26fe6a..9a9f2c23bca7 100644 --- a/src/Mvc/Mvc.Razor/src/Diagnostics/MvcDiagnostics.cs +++ b/src/Mvc/Mvc.Razor/src/Diagnostics/MvcDiagnostics.cs @@ -10,19 +10,12 @@ namespace Microsoft.AspNetCore.Mvc.Diagnostics { - public sealed class BeforeViewPage : MvcDiagnostic + public sealed class BeforeViewPage : EventData { public const string EventName = EventNamespace + "Razor." + nameof(BeforeViewPage); - public IRazorPage Page { get; } - public ViewContext ViewContext { get; } - public ActionDescriptor ActionDescriptor { get; } - public HttpContext HttpContext { get; } - - protected override int Count => 4; - public BeforeViewPage(IRazorPage page, ViewContext viewContext, ActionDescriptor actionDescriptor, HttpContext httpContext) { Page = page; @@ -31,6 +24,13 @@ public BeforeViewPage(IRazorPage page, ViewContext viewContext, 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 this[int index] => index switch { 0 => new KeyValuePair(nameof(Page), Page), @@ -41,19 +41,12 @@ public BeforeViewPage(IRazorPage page, ViewContext viewContext, ActionDescriptor }; } - public sealed class AfterViewPage : MvcDiagnostic + public sealed class AfterViewPage : EventData { public const string EventName = EventNamespace + "Razor." + nameof(AfterViewPage); - public IRazorPage Page { get; } - public ViewContext ViewContext { get; } - public ActionDescriptor ActionDescriptor { get; } - public HttpContext HttpContext { get; } - - protected override int Count => 4; - public AfterViewPage(IRazorPage page, ViewContext viewContext, ActionDescriptor actionDescriptor, HttpContext httpContext) { Page = page; @@ -62,6 +55,13 @@ public AfterViewPage(IRazorPage page, ViewContext viewContext, 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 this[int index] => index switch { 0 => new KeyValuePair(nameof(Page), Page), @@ -72,20 +72,12 @@ public AfterViewPage(IRazorPage page, ViewContext viewContext, ActionDescriptor }; } - public sealed class BeginInstrumentationContext : MvcDiagnostic + public sealed class BeginInstrumentationContext : EventData { public const string EventName = EventNamespace + "Razor." + nameof(BeginInstrumentationContext); - public HttpContext HttpContext { get; } - public string Path { get; } - public int Position { get; } - public int Length { get; } - public bool IsLiteral { get; } - - protected override int Count => 5; - public BeginInstrumentationContext( HttpContext httpContext, string path, @@ -100,6 +92,14 @@ public BeginInstrumentationContext( IsLiteral = isLiteral; } + public HttpContext HttpContext { get; } + public string Path { get; } + public int Position { get; } + public int Length { get; } + public bool IsLiteral { get; } + + protected override int Count => 5; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(HttpContext), HttpContext), @@ -111,17 +111,12 @@ public BeginInstrumentationContext( }; } - public sealed class EndInstrumentationContext : MvcDiagnostic + public sealed class EndInstrumentationContext : EventData { public const string EventName = EventNamespace + "Razor." + nameof(EndInstrumentationContext); - public HttpContext HttpContext { get; } - public string Path { get; } - - protected override int Count => 2; - public EndInstrumentationContext( HttpContext httpContext, string path) @@ -130,6 +125,11 @@ public EndInstrumentationContext( Path = path; } + public HttpContext HttpContext { get; } + public string Path { get; } + + protected override int Count => 2; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(HttpContext), HttpContext), diff --git a/src/Mvc/Mvc.RazorPages/ref/Microsoft.AspNetCore.Mvc.RazorPages.netcoreapp3.0.cs b/src/Mvc/Mvc.RazorPages/ref/Microsoft.AspNetCore.Mvc.RazorPages.netcoreapp3.0.cs index 7573d5732f15..dbd9d6fcb792 100644 --- a/src/Mvc/Mvc.RazorPages/ref/Microsoft.AspNetCore.Mvc.RazorPages.netcoreapp3.0.cs +++ b/src/Mvc/Mvc.RazorPages/ref/Microsoft.AspNetCore.Mvc.RazorPages.netcoreapp3.0.cs @@ -145,19 +145,19 @@ public void Apply(Microsoft.AspNetCore.Mvc.ApplicationModels.PageRouteModel mode } namespace Microsoft.AspNetCore.Mvc.Diagnostics { - public sealed partial class AfterHandlerMethod : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + 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.IDictionary arguments, Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.HandlerMethodDescriptor handlerMethodDescriptor, object instance, Microsoft.AspNetCore.Mvc.IActionResult result) { } + public AfterHandlerMethod(Microsoft.AspNetCore.Mvc.ActionContext actionContext, System.Collections.Generic.IReadOnlyDictionary 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.IDictionary Arguments { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Collections.Generic.IReadOnlyDictionary 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 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.MvcDiagnostic + 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) { } @@ -167,7 +167,7 @@ public AfterOnPageHandlerExecuted(Microsoft.AspNetCore.Mvc.RazorPages.CompiledPa public Microsoft.AspNetCore.Mvc.Filters.PageHandlerExecutedContext HandlerExecutedContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } - public sealed partial class AfterOnPageHandlerExecuting : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + 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) { } @@ -177,7 +177,7 @@ public AfterOnPageHandlerExecuting(Microsoft.AspNetCore.Mvc.RazorPages.CompiledP public Microsoft.AspNetCore.Mvc.Filters.PageHandlerExecutingContext HandlerExecutingContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } - public sealed partial class AfterOnPageHandlerExecution : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + 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) { } @@ -187,7 +187,7 @@ public AfterOnPageHandlerExecution(Microsoft.AspNetCore.Mvc.RazorPages.CompiledP public Microsoft.AspNetCore.Mvc.Filters.PageHandlerExecutedContext HandlerExecutedContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } - public sealed partial class AfterOnPageHandlerSelected : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + 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) { } @@ -197,7 +197,7 @@ public AfterOnPageHandlerSelected(Microsoft.AspNetCore.Mvc.RazorPages.CompiledPa public Microsoft.AspNetCore.Mvc.Filters.PageHandlerSelectedContext HandlerSelectedContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } - public sealed partial class AfterOnPageHandlerSelection : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + 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) { } @@ -207,18 +207,18 @@ public AfterOnPageHandlerSelection(Microsoft.AspNetCore.Mvc.RazorPages.CompiledP public Microsoft.AspNetCore.Mvc.Filters.PageHandlerSelectedContext HandlerSelectedContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } - public sealed partial class BeforeHandlerMethod : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + 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.IDictionary arguments, Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.HandlerMethodDescriptor handlerMethodDescriptor, object instance) { } + public BeforeHandlerMethod(Microsoft.AspNetCore.Mvc.ActionContext actionContext, System.Collections.Generic.IReadOnlyDictionary 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.IDictionary Arguments { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Collections.Generic.IReadOnlyDictionary 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 this[int index] { get { throw null; } } } - public sealed partial class BeforeOnPageHandlerExecuted : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + 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) { } @@ -228,7 +228,7 @@ public BeforeOnPageHandlerExecuted(Microsoft.AspNetCore.Mvc.RazorPages.CompiledP public Microsoft.AspNetCore.Mvc.Filters.PageHandlerExecutedContext HandlerExecutedContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } - public sealed partial class BeforeOnPageHandlerExecuting : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + 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) { } @@ -238,7 +238,7 @@ public BeforeOnPageHandlerExecuting(Microsoft.AspNetCore.Mvc.RazorPages.Compiled public Microsoft.AspNetCore.Mvc.Filters.PageHandlerExecutingContext HandlerExecutingContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } - public sealed partial class BeforeOnPageHandlerExecution : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + 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) { } @@ -248,7 +248,7 @@ public BeforeOnPageHandlerExecution(Microsoft.AspNetCore.Mvc.RazorPages.Compiled public Microsoft.AspNetCore.Mvc.Filters.PageHandlerExecutingContext HandlerExecutionContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } - public sealed partial class BeforeOnPageHandlerSelected : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + 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) { } @@ -258,7 +258,7 @@ public BeforeOnPageHandlerSelected(Microsoft.AspNetCore.Mvc.RazorPages.CompiledP public Microsoft.AspNetCore.Mvc.Filters.PageHandlerSelectedContext HandlerSelectedContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } } - public sealed partial class BeforeOnPageHandlerSelection : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + 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) { } diff --git a/src/Mvc/Mvc.RazorPages/src/Diagnostics/MvcDiagnostics.cs b/src/Mvc/Mvc.RazorPages/src/Diagnostics/MvcDiagnostics.cs index 6c0cd4b6db68..78285b68c4a8 100644 --- a/src/Mvc/Mvc.RazorPages/src/Diagnostics/MvcDiagnostics.cs +++ b/src/Mvc/Mvc.RazorPages/src/Diagnostics/MvcDiagnostics.cs @@ -10,18 +10,11 @@ namespace Microsoft.AspNetCore.Mvc.Diagnostics { - public sealed class BeforeHandlerMethod : MvcDiagnostic + public sealed class BeforeHandlerMethod : EventData { public const string EventName = EventNamespace + nameof(BeforeHandlerMethod); - public ActionContext ActionContext { get; } - public IDictionary Arguments { get; } - public HandlerMethodDescriptor HandlerMethodDescriptor { get; } - public object Instance { get; } - - protected override int Count => 4; - - public BeforeHandlerMethod(ActionContext actionContext, IDictionary arguments, HandlerMethodDescriptor handlerMethodDescriptor, object instance) + public BeforeHandlerMethod(ActionContext actionContext, IReadOnlyDictionary arguments, HandlerMethodDescriptor handlerMethodDescriptor, object instance) { ActionContext = actionContext; Arguments = arguments; @@ -29,6 +22,13 @@ public BeforeHandlerMethod(ActionContext actionContext, IDictionary Arguments { get; } + public HandlerMethodDescriptor HandlerMethodDescriptor { get; } + public object Instance { get; } + + protected override int Count => 4; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionContext), ActionContext), @@ -39,19 +39,11 @@ public BeforeHandlerMethod(ActionContext actionContext, IDictionary Arguments { get; } - public HandlerMethodDescriptor HandlerMethodDescriptor { get; } - public object Instance { get; } - public IActionResult Result { get; } - - protected override int Count => 5; - - public AfterHandlerMethod(ActionContext actionContext, IDictionary arguments, HandlerMethodDescriptor handlerMethodDescriptor, object instance, IActionResult result) + public AfterHandlerMethod(ActionContext actionContext, IReadOnlyDictionary arguments, HandlerMethodDescriptor handlerMethodDescriptor, object instance, IActionResult result) { ActionContext = actionContext; Arguments = arguments; @@ -60,6 +52,14 @@ public AfterHandlerMethod(ActionContext actionContext, IDictionary Arguments { get; } + public HandlerMethodDescriptor HandlerMethodDescriptor { get; } + public object Instance { get; } + public IActionResult Result { get; } + + protected override int Count => 5; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionContext), ActionContext), @@ -71,16 +71,10 @@ public AfterHandlerMethod(ActionContext actionContext, IDictionary 3; - public BeforeOnPageHandlerExecution(CompiledPageActionDescriptor actionDescriptor, PageHandlerExecutingContext handlerExecutionContext, IAsyncPageFilter filter) { ActionDescriptor = actionDescriptor; @@ -88,6 +82,12 @@ public BeforeOnPageHandlerExecution(CompiledPageActionDescriptor actionDescripto Filter = filter; } + public CompiledPageActionDescriptor ActionDescriptor { get; } + public PageHandlerExecutingContext HandlerExecutionContext { get; } + public IAsyncPageFilter Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -97,16 +97,10 @@ public BeforeOnPageHandlerExecution(CompiledPageActionDescriptor actionDescripto }; } - public sealed class AfterOnPageHandlerExecution : MvcDiagnostic + public sealed class AfterOnPageHandlerExecution : EventData { public const string EventName = EventNamespace + nameof(AfterOnPageHandlerExecution); - public CompiledPageActionDescriptor ActionDescriptor { get; } - public PageHandlerExecutedContext HandlerExecutedContext { get; } - public IAsyncPageFilter Filter { get; } - - protected override int Count => 3; - public AfterOnPageHandlerExecution(CompiledPageActionDescriptor actionDescriptor, PageHandlerExecutedContext handlerExecutedContext, IAsyncPageFilter filter) { ActionDescriptor = actionDescriptor; @@ -114,6 +108,12 @@ public AfterOnPageHandlerExecution(CompiledPageActionDescriptor actionDescriptor Filter = filter; } + public CompiledPageActionDescriptor ActionDescriptor { get; } + public PageHandlerExecutedContext HandlerExecutedContext { get; } + public IAsyncPageFilter Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -123,16 +123,10 @@ public AfterOnPageHandlerExecution(CompiledPageActionDescriptor actionDescriptor }; } - public sealed class BeforeOnPageHandlerExecuting : MvcDiagnostic + public sealed class BeforeOnPageHandlerExecuting : EventData { public const string EventName = EventNamespace + nameof(BeforeOnPageHandlerExecuting); - public CompiledPageActionDescriptor ActionDescriptor { get; } - public PageHandlerExecutingContext HandlerExecutingContext { get; } - public IPageFilter Filter { get; } - - protected override int Count => 3; - public BeforeOnPageHandlerExecuting(CompiledPageActionDescriptor actionDescriptor, PageHandlerExecutingContext handlerExecutingContext, IPageFilter filter) { ActionDescriptor = actionDescriptor; @@ -140,6 +134,12 @@ public BeforeOnPageHandlerExecuting(CompiledPageActionDescriptor actionDescripto Filter = filter; } + public CompiledPageActionDescriptor ActionDescriptor { get; } + public PageHandlerExecutingContext HandlerExecutingContext { get; } + public IPageFilter Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -149,16 +149,10 @@ public BeforeOnPageHandlerExecuting(CompiledPageActionDescriptor actionDescripto }; } - public sealed class AfterOnPageHandlerExecuting : MvcDiagnostic + public sealed class AfterOnPageHandlerExecuting : EventData { public const string EventName = EventNamespace + nameof(AfterOnPageHandlerExecuting); - public CompiledPageActionDescriptor ActionDescriptor { get; } - public PageHandlerExecutingContext HandlerExecutingContext { get; } - public IPageFilter Filter { get; } - - protected override int Count => 3; - public AfterOnPageHandlerExecuting(CompiledPageActionDescriptor actionDescriptor, PageHandlerExecutingContext handlerExecutingContext, IPageFilter filter) { ActionDescriptor = actionDescriptor; @@ -166,6 +160,12 @@ public AfterOnPageHandlerExecuting(CompiledPageActionDescriptor actionDescriptor Filter = filter; } + public CompiledPageActionDescriptor ActionDescriptor { get; } + public PageHandlerExecutingContext HandlerExecutingContext { get; } + public IPageFilter Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -175,16 +175,10 @@ public AfterOnPageHandlerExecuting(CompiledPageActionDescriptor actionDescriptor }; } - public sealed class BeforeOnPageHandlerExecuted : MvcDiagnostic + public sealed class BeforeOnPageHandlerExecuted : EventData { public const string EventName = EventNamespace + nameof(BeforeOnPageHandlerExecuted); - public CompiledPageActionDescriptor ActionDescriptor { get; } - public PageHandlerExecutedContext HandlerExecutedContext { get; } - public IPageFilter Filter { get; } - - protected override int Count => 3; - public BeforeOnPageHandlerExecuted(CompiledPageActionDescriptor actionDescriptor, PageHandlerExecutedContext handlerExecutedContext, IPageFilter filter) { ActionDescriptor = actionDescriptor; @@ -192,6 +186,12 @@ public BeforeOnPageHandlerExecuted(CompiledPageActionDescriptor actionDescriptor Filter = filter; } + public CompiledPageActionDescriptor ActionDescriptor { get; } + public PageHandlerExecutedContext HandlerExecutedContext { get; } + public IPageFilter Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -201,16 +201,10 @@ public BeforeOnPageHandlerExecuted(CompiledPageActionDescriptor actionDescriptor }; } - public sealed class AfterOnPageHandlerExecuted : MvcDiagnostic + public sealed class AfterOnPageHandlerExecuted : EventData { public const string EventName = EventNamespace + nameof(AfterOnPageHandlerExecuted); - public CompiledPageActionDescriptor ActionDescriptor { get; } - public PageHandlerExecutedContext HandlerExecutedContext { get; } - public IPageFilter Filter { get; } - - protected override int Count => 3; - public AfterOnPageHandlerExecuted(CompiledPageActionDescriptor actionDescriptor, PageHandlerExecutedContext handlerExecutedContext, IPageFilter filter) { ActionDescriptor = actionDescriptor; @@ -218,6 +212,12 @@ public AfterOnPageHandlerExecuted(CompiledPageActionDescriptor actionDescriptor, Filter = filter; } + public CompiledPageActionDescriptor ActionDescriptor { get; } + public PageHandlerExecutedContext HandlerExecutedContext { get; } + public IPageFilter Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -227,16 +227,10 @@ public AfterOnPageHandlerExecuted(CompiledPageActionDescriptor actionDescriptor, }; } - public sealed class BeforeOnPageHandlerSelection : MvcDiagnostic + public sealed class BeforeOnPageHandlerSelection : EventData { public const string EventName = EventNamespace + nameof(BeforeOnPageHandlerSelection); - public CompiledPageActionDescriptor ActionDescriptor { get; } - public PageHandlerSelectedContext HandlerSelectedContext { get; } - public IAsyncPageFilter Filter { get; } - - protected override int Count => 3; - public BeforeOnPageHandlerSelection(CompiledPageActionDescriptor actionDescriptor, PageHandlerSelectedContext handlerSelectedContext, IAsyncPageFilter filter) { ActionDescriptor = actionDescriptor; @@ -244,6 +238,12 @@ public BeforeOnPageHandlerSelection(CompiledPageActionDescriptor actionDescripto Filter = filter; } + public CompiledPageActionDescriptor ActionDescriptor { get; } + public PageHandlerSelectedContext HandlerSelectedContext { get; } + public IAsyncPageFilter Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -253,16 +253,10 @@ public BeforeOnPageHandlerSelection(CompiledPageActionDescriptor actionDescripto }; } - public sealed class AfterOnPageHandlerSelection : MvcDiagnostic + public sealed class AfterOnPageHandlerSelection : EventData { public const string EventName = EventNamespace + nameof(AfterOnPageHandlerSelection); - public CompiledPageActionDescriptor ActionDescriptor { get; } - public PageHandlerSelectedContext HandlerSelectedContext { get; } - public IAsyncPageFilter Filter { get; } - - protected override int Count => 3; - public AfterOnPageHandlerSelection(CompiledPageActionDescriptor actionDescriptor, PageHandlerSelectedContext handlerSelectedContext, IAsyncPageFilter filter) { ActionDescriptor = actionDescriptor; @@ -270,6 +264,12 @@ public AfterOnPageHandlerSelection(CompiledPageActionDescriptor actionDescriptor Filter = filter; } + public CompiledPageActionDescriptor ActionDescriptor { get; } + public PageHandlerSelectedContext HandlerSelectedContext { get; } + public IAsyncPageFilter Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -279,16 +279,10 @@ public AfterOnPageHandlerSelection(CompiledPageActionDescriptor actionDescriptor }; } - public sealed class BeforeOnPageHandlerSelected : MvcDiagnostic + public sealed class BeforeOnPageHandlerSelected : EventData { public const string EventName = EventNamespace + nameof(BeforeOnPageHandlerSelected); - public CompiledPageActionDescriptor ActionDescriptor { get; } - public PageHandlerSelectedContext HandlerSelectedContext { get; } - public IPageFilter Filter { get; } - - protected override int Count => 3; - public BeforeOnPageHandlerSelected(CompiledPageActionDescriptor actionDescriptor, PageHandlerSelectedContext handlerSelectedContext, IPageFilter filter) { ActionDescriptor = actionDescriptor; @@ -296,6 +290,12 @@ public BeforeOnPageHandlerSelected(CompiledPageActionDescriptor actionDescriptor Filter = filter; } + public CompiledPageActionDescriptor ActionDescriptor { get; } + public PageHandlerSelectedContext HandlerSelectedContext { get; } + public IPageFilter Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -305,16 +305,10 @@ public BeforeOnPageHandlerSelected(CompiledPageActionDescriptor actionDescriptor }; } - public sealed class AfterOnPageHandlerSelected : MvcDiagnostic + public sealed class AfterOnPageHandlerSelected : EventData { public const string EventName = EventNamespace + nameof(AfterOnPageHandlerSelected); - public CompiledPageActionDescriptor ActionDescriptor { get; } - public PageHandlerSelectedContext HandlerSelectedContext { get; } - public IPageFilter Filter { get; } - - protected override int Count => 3; - public AfterOnPageHandlerSelected(CompiledPageActionDescriptor actionDescriptor, PageHandlerSelectedContext handlerSelectedContext, IPageFilter filter) { ActionDescriptor = actionDescriptor; @@ -322,6 +316,12 @@ public AfterOnPageHandlerSelected(CompiledPageActionDescriptor actionDescriptor, Filter = filter; } + public CompiledPageActionDescriptor ActionDescriptor { get; } + public PageHandlerSelectedContext HandlerSelectedContext { get; } + public IPageFilter Filter { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), diff --git a/src/Mvc/Mvc.ViewFeatures/ref/Microsoft.AspNetCore.Mvc.ViewFeatures.netcoreapp3.0.cs b/src/Mvc/Mvc.ViewFeatures/ref/Microsoft.AspNetCore.Mvc.ViewFeatures.netcoreapp3.0.cs index 8bd949c12e3d..945609c56031 100644 --- a/src/Mvc/Mvc.ViewFeatures/ref/Microsoft.AspNetCore.Mvc.ViewFeatures.netcoreapp3.0.cs +++ b/src/Mvc/Mvc.ViewFeatures/ref/Microsoft.AspNetCore.Mvc.ViewFeatures.netcoreapp3.0.cs @@ -215,7 +215,7 @@ public ViewResult() { } } namespace Microsoft.AspNetCore.Mvc.Diagnostics { - public sealed partial class AfterView : Microsoft.AspNetCore.Mvc.Diagnostics.MvcDiagnostic + 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) { } @@ -224,7 +224,7 @@ public AfterView(Microsoft.AspNetCore.Mvc.ViewEngines.IView view, Microsoft.AspN 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.MvcDiagnostic + 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) { } @@ -235,7 +235,7 @@ public AfterViewComponent(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor 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.MvcDiagnostic + 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) { } @@ -244,7 +244,7 @@ public BeforeView(Microsoft.AspNetCore.Mvc.ViewEngines.IView view, Microsoft.Asp 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.MvcDiagnostic + 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) { } @@ -254,7 +254,7 @@ public BeforeViewComponent(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescripto 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.MvcDiagnostic + 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) { } @@ -264,7 +264,7 @@ public ViewComponentAfterViewExecute(Microsoft.AspNetCore.Mvc.Abstractions.Actio 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.MvcDiagnostic + 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) { } @@ -274,7 +274,7 @@ public ViewComponentBeforeViewExecute(Microsoft.AspNetCore.Mvc.Abstractions.Acti 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.MvcDiagnostic + 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) { } @@ -286,7 +286,7 @@ public ViewFound(Microsoft.AspNetCore.Mvc.ActionContext actionContext, bool isMa 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.MvcDiagnostic + 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 searchedLocations) { } diff --git a/src/Mvc/Mvc.ViewFeatures/src/Diagnostics/MvcDiagnostics.cs b/src/Mvc/Mvc.ViewFeatures/src/Diagnostics/MvcDiagnostics.cs index f39ed463b995..4cccd159b37b 100644 --- a/src/Mvc/Mvc.ViewFeatures/src/Diagnostics/MvcDiagnostics.cs +++ b/src/Mvc/Mvc.ViewFeatures/src/Diagnostics/MvcDiagnostics.cs @@ -10,16 +10,10 @@ namespace Microsoft.AspNetCore.Mvc.Diagnostics { - public sealed class BeforeViewComponent : MvcDiagnostic + public sealed class BeforeViewComponent : EventData { public const string EventName = EventNamespace + nameof(BeforeViewComponent); - public ActionDescriptor ActionDescriptor { get; } - public ViewComponentContext ViewComponentContext { get; } - public object ViewComponent { get; } - - protected override int Count => 3; - public BeforeViewComponent(ActionDescriptor actionDescriptor, ViewComponentContext viewComponentContext, object viewComponent) { ActionDescriptor = actionDescriptor; @@ -27,6 +21,12 @@ public BeforeViewComponent(ActionDescriptor actionDescriptor, ViewComponentConte ViewComponent = viewComponent; } + public ActionDescriptor ActionDescriptor { get; } + public ViewComponentContext ViewComponentContext { get; } + public object ViewComponent { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -36,17 +36,10 @@ public BeforeViewComponent(ActionDescriptor actionDescriptor, ViewComponentConte }; } - public sealed class AfterViewComponent : MvcDiagnostic + public sealed class AfterViewComponent : EventData { public const string EventName = EventNamespace + nameof(AfterViewComponent); - public ActionDescriptor ActionDescriptor { get; } - public ViewComponentContext ViewComponentContext { get; } - public IViewComponentResult ViewComponentResult { get; } - public object ViewComponent { get; } - - protected override int Count => 4; - public AfterViewComponent(ActionDescriptor actionDescriptor, ViewComponentContext viewComponentContext, IViewComponentResult viewComponentResult, object viewComponent) { ActionDescriptor = actionDescriptor; @@ -55,6 +48,13 @@ public AfterViewComponent(ActionDescriptor actionDescriptor, ViewComponentContex 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 this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -65,14 +65,9 @@ public AfterViewComponent(ActionDescriptor actionDescriptor, ViewComponentContex }; } - public sealed class ViewComponentBeforeViewExecute : MvcDiagnostic + public sealed class ViewComponentBeforeViewExecute : EventData { public const string EventName = EventNamespace + nameof(ViewComponentBeforeViewExecute); - public ActionDescriptor ActionDescriptor { get; } - public ViewComponentContext ViewComponentContext { get; } - public IView View { get; } - - protected override int Count => 3; public ViewComponentBeforeViewExecute(ActionDescriptor actionDescriptor, ViewComponentContext viewComponentContext, IView view) { @@ -80,6 +75,11 @@ public ViewComponentBeforeViewExecute(ActionDescriptor actionDescriptor, ViewCom ViewComponentContext = viewComponentContext; View = view; } + public ActionDescriptor ActionDescriptor { get; } + public ViewComponentContext ViewComponentContext { get; } + public IView View { get; } + + protected override int Count => 3; protected override KeyValuePair this[int index] => index switch { @@ -90,16 +90,10 @@ public ViewComponentBeforeViewExecute(ActionDescriptor actionDescriptor, ViewCom }; } - public sealed class ViewComponentAfterViewExecute : MvcDiagnostic + public sealed class ViewComponentAfterViewExecute : EventData { public const string EventName = EventNamespace + nameof(ViewComponentAfterViewExecute); - public ActionDescriptor ActionDescriptor { get; } - public ViewComponentContext ViewComponentContext { get; } - public IView View { get; } - - protected override int Count => 3; - public ViewComponentAfterViewExecute(ActionDescriptor actionDescriptor, ViewComponentContext viewComponentContext, IView view) { ActionDescriptor = actionDescriptor; @@ -107,6 +101,12 @@ public ViewComponentAfterViewExecute(ActionDescriptor actionDescriptor, ViewComp View = view; } + public ActionDescriptor ActionDescriptor { get; } + public ViewComponentContext ViewComponentContext { get; } + public IView View { get; } + + protected override int Count => 3; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor), @@ -116,21 +116,21 @@ public ViewComponentAfterViewExecute(ActionDescriptor actionDescriptor, ViewComp }; } - public sealed class BeforeView : MvcDiagnostic + public sealed class BeforeView : EventData { public const string EventName = EventNamespace + nameof(BeforeView); - public IView View { get; } - public ViewContext ViewContext { get; } - - protected override int Count => 2; - 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 this[int index] => index switch { 0 => new KeyValuePair(nameof(View), View), @@ -139,21 +139,21 @@ public BeforeView(IView view, ViewContext viewContext) }; } - public sealed class AfterView : MvcDiagnostic + public sealed class AfterView : EventData { public const string EventName = EventNamespace + nameof(AfterView); - public IView View { get; } - public ViewContext ViewContext { get; } - - protected override int Count => 2; - 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 this[int index] => index switch { 0 => new KeyValuePair(nameof(View), View), @@ -162,18 +162,10 @@ public AfterView(IView view, ViewContext viewContext) }; } - public sealed class ViewFound : MvcDiagnostic + public sealed class ViewFound : EventData { public const string EventName = EventNamespace + nameof(ViewFound); - 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; - public ViewFound(ActionContext actionContext, bool isMainPage, ActionResult result, string viewName, IView view) { ActionContext = actionContext; @@ -183,6 +175,14 @@ public ViewFound(ActionContext actionContext, bool isMainPage, ActionResult resu 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 this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionContext), ActionContext), @@ -194,18 +194,10 @@ public ViewFound(ActionContext actionContext, bool isMainPage, ActionResult resu }; } - public sealed class ViewNotFound : MvcDiagnostic + public sealed class ViewNotFound : EventData { public const string EventName = EventNamespace + nameof(ViewNotFound); - public ActionContext ActionContext { get; } - public bool IsMainPage { get; } - public ActionResult Result { get; } - public string ViewName { get; } - public IEnumerable SearchedLocations { get; } - - protected override int Count => 5; - public ViewNotFound(ActionContext actionContext, bool isMainPage, ActionResult result, string viewName, IEnumerable searchedLocations) { ActionContext = actionContext; @@ -215,6 +207,14 @@ public ViewNotFound(ActionContext actionContext, bool isMainPage, ActionResult r SearchedLocations = searchedLocations; } + public ActionContext ActionContext { get; } + public bool IsMainPage { get; } + public ActionResult Result { get; } + public string ViewName { get; } + public IEnumerable SearchedLocations { get; } + + protected override int Count => 5; + protected override KeyValuePair this[int index] => index switch { 0 => new KeyValuePair(nameof(ActionContext), ActionContext), From 799b1edd15db472277f7a2dd7c1d19b47535c8c7 Mon Sep 17 00:00:00 2001 From: Ben Adams Date: Fri, 12 Jul 2019 23:01:43 +0100 Subject: [PATCH 07/11] IReadOnlyDictionary --- .../Mvc.Core/src/MvcCoreDiagnosticListenerExtensions.cs | 8 ++++---- .../src/MvcRazorPagesDiagnosticListenerExtensions.cs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Mvc/Mvc.Core/src/MvcCoreDiagnosticListenerExtensions.cs b/src/Mvc/Mvc.Core/src/MvcCoreDiagnosticListenerExtensions.cs index 2ecc946546a4..89ff1bc905a0 100644 --- a/src/Mvc/Mvc.Core/src/MvcCoreDiagnosticListenerExtensions.cs +++ b/src/Mvc/Mvc.Core/src/MvcCoreDiagnosticListenerExtensions.cs @@ -675,7 +675,7 @@ private static void AfterOnActionExecutedImpl(DiagnosticListener diagnosticListe public static void BeforeActionMethod( this DiagnosticListener diagnosticListener, ActionContext actionContext, - IDictionary actionArguments, + IReadOnlyDictionary actionArguments, object controller) { Debug.Assert(diagnosticListener != null); @@ -690,7 +690,7 @@ public static void BeforeActionMethod( } } - private static void BeforeActionMethodImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, IDictionary actionArguments, object controller) + private static void BeforeActionMethodImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, IReadOnlyDictionary actionArguments, object controller) { if (diagnosticListener.IsEnabled(Diagnostics.BeforeActionMethod.EventName)) { @@ -707,7 +707,7 @@ private static void BeforeActionMethodImpl(DiagnosticListener diagnosticListener public static void AfterActionMethod( this DiagnosticListener diagnosticListener, ActionContext actionContext, - IDictionary actionArguments, + IReadOnlyDictionary actionArguments, object controller, IActionResult result) { @@ -723,7 +723,7 @@ public static void AfterActionMethod( } } - private static void AfterActionMethodImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, IDictionary actionArguments, object controller, IActionResult result) + private static void AfterActionMethodImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, IReadOnlyDictionary actionArguments, object controller, IActionResult result) { if (diagnosticListener.IsEnabled(Diagnostics.AfterActionMethod.EventName)) { diff --git a/src/Mvc/Mvc.RazorPages/src/MvcRazorPagesDiagnosticListenerExtensions.cs b/src/Mvc/Mvc.RazorPages/src/MvcRazorPagesDiagnosticListenerExtensions.cs index 54be39b1b411..f96ec244bc26 100644 --- a/src/Mvc/Mvc.RazorPages/src/MvcRazorPagesDiagnosticListenerExtensions.cs +++ b/src/Mvc/Mvc.RazorPages/src/MvcRazorPagesDiagnosticListenerExtensions.cs @@ -15,7 +15,7 @@ public static void BeforeHandlerMethod( this DiagnosticListener diagnosticListener, ActionContext actionContext, HandlerMethodDescriptor handlerMethodDescriptor, - IDictionary arguments, + IReadOnlyDictionary arguments, object instance) { Debug.Assert(diagnosticListener != null); @@ -31,7 +31,7 @@ public static void BeforeHandlerMethod( } } - private static void BeforeHandlerMethodImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, HandlerMethodDescriptor handlerMethodDescriptor, IDictionary arguments, object instance) + private static void BeforeHandlerMethodImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, HandlerMethodDescriptor handlerMethodDescriptor, IReadOnlyDictionary arguments, object instance) { if (diagnosticListener.IsEnabled(Diagnostics.BeforeHandlerMethod.EventName)) { @@ -50,7 +50,7 @@ public static void AfterHandlerMethod( this DiagnosticListener diagnosticListener, ActionContext actionContext, HandlerMethodDescriptor handlerMethodDescriptor, - IDictionary arguments, + IReadOnlyDictionary arguments, object instance, IActionResult result) { @@ -67,7 +67,7 @@ public static void AfterHandlerMethod( } } - private static void AfterHandlerMethodImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, HandlerMethodDescriptor handlerMethodDescriptor, IDictionary arguments, object instance, IActionResult result) + private static void AfterHandlerMethodImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, HandlerMethodDescriptor handlerMethodDescriptor, IReadOnlyDictionary arguments, object instance, IActionResult result) { if (diagnosticListener.IsEnabled(Diagnostics.AfterHandlerMethod.EventName)) { From 868e21783d4677883b5e7428f9f5a85cffc383be Mon Sep 17 00:00:00 2001 From: Ben Adams Date: Fri, 12 Jul 2019 23:15:53 +0100 Subject: [PATCH 08/11] Remove InstrumentationContext --- .../src/Diagnostics/MvcDiagnostics.cs | 66 ------ .../MvcRazorDiagnosticListenerExtensions.cs | 73 ------ src/Mvc/Mvc.Razor/src/RazorPage.cs | 10 +- src/Mvc/Mvc.Razor/test/RazorPageTest.cs | 210 ------------------ src/Mvc/Mvc.RazorPages/src/PageBase.cs | 29 +-- 5 files changed, 9 insertions(+), 379 deletions(-) diff --git a/src/Mvc/Mvc.Razor/src/Diagnostics/MvcDiagnostics.cs b/src/Mvc/Mvc.Razor/src/Diagnostics/MvcDiagnostics.cs index 9a9f2c23bca7..d87b9709ad25 100644 --- a/src/Mvc/Mvc.Razor/src/Diagnostics/MvcDiagnostics.cs +++ b/src/Mvc/Mvc.Razor/src/Diagnostics/MvcDiagnostics.cs @@ -71,70 +71,4 @@ public AfterViewPage(IRazorPage page, ViewContext viewContext, ActionDescriptor _ => throw new IndexOutOfRangeException(nameof(index)) }; } - - public sealed class BeginInstrumentationContext : EventData - { - public const string EventName = EventNamespace + - "Razor." + - nameof(BeginInstrumentationContext); - - public BeginInstrumentationContext( - HttpContext httpContext, - string path, - int position, - int length, - bool isLiteral) - { - HttpContext = httpContext; - Path = path; - Position = position; - Length = length; - IsLiteral = isLiteral; - } - - public HttpContext HttpContext { get; } - public string Path { get; } - public int Position { get; } - public int Length { get; } - public bool IsLiteral { get; } - - protected override int Count => 5; - - protected override KeyValuePair this[int index] => index switch - { - 0 => new KeyValuePair(nameof(HttpContext), HttpContext), - 1 => new KeyValuePair(nameof(Path), Path), - 2 => new KeyValuePair(nameof(Position), Position), - 3 => new KeyValuePair(nameof(Length), Length), - 4 => new KeyValuePair(nameof(IsLiteral), IsLiteral), - _ => throw new IndexOutOfRangeException(nameof(index)) - }; - } - - public sealed class EndInstrumentationContext : EventData - { - public const string EventName = EventNamespace + - "Razor." + - nameof(EndInstrumentationContext); - - public EndInstrumentationContext( - HttpContext httpContext, - string path) - { - HttpContext = httpContext; - Path = path; - } - - public HttpContext HttpContext { get; } - public string Path { get; } - - protected override int Count => 2; - - protected override KeyValuePair this[int index] => index switch - { - 0 => new KeyValuePair(nameof(HttpContext), HttpContext), - 1 => new KeyValuePair(nameof(Path), Path), - _ => throw new IndexOutOfRangeException(nameof(index)) - }; - } } \ No newline at end of file diff --git a/src/Mvc/Mvc.Razor/src/MvcRazorDiagnosticListenerExtensions.cs b/src/Mvc/Mvc.Razor/src/MvcRazorDiagnosticListenerExtensions.cs index e0e74a6ef76a..aff60a929826 100644 --- a/src/Mvc/Mvc.Razor/src/MvcRazorDiagnosticListenerExtensions.cs +++ b/src/Mvc/Mvc.Razor/src/MvcRazorDiagnosticListenerExtensions.cs @@ -69,78 +69,5 @@ private static void AfterViewPageImpl( )); } } - - public static void BeginInstrumentationContext( - this DiagnosticListener diagnosticListener, - HttpContext httpContext, - string path, - int position, - int length, - bool isLiteral) - { - Debug.Assert(httpContext != null); - Debug.Assert(path != null); - - // Inlinable fast-path check if Diagnositcs is enabled - if (diagnosticListener?.IsEnabled() ?? false) - { - BeginInstrumentationContextImpl(diagnosticListener, httpContext, path, position, length, isLiteral); - } - } - - private static void BeginInstrumentationContextImpl(DiagnosticListener diagnosticListener, - HttpContext httpContext, - string path, - int position, - int length, - bool isLiteral) - { - Debug.Assert(diagnosticListener != null); - - if (diagnosticListener.IsEnabled(Diagnostics.BeginInstrumentationContext.EventName)) - { - diagnosticListener.Write( - Diagnostics.BeginInstrumentationContext.EventName, - new BeginInstrumentationContext( - httpContext, - path, - position, - length, - isLiteral - )); - } - } - - public static void EndInstrumentationContext( - this DiagnosticListener diagnosticListener, - HttpContext httpContext, - string path) - { - Debug.Assert(httpContext != null); - Debug.Assert(path != null); - - // Inlinable fast-path check if Diagnositcs is enabled - if (diagnosticListener?.IsEnabled() ?? false) - { - EndInstrumentationContextImpl(diagnosticListener, httpContext, path); - } - } - - private static void EndInstrumentationContextImpl(DiagnosticListener diagnosticListener, - HttpContext httpContext, - string path) - { - Debug.Assert(diagnosticListener != null); - - if (diagnosticListener.IsEnabled(Diagnostics.EndInstrumentationContext.EventName)) - { - diagnosticListener.Write( - Diagnostics.EndInstrumentationContext.EventName, - new EndInstrumentationContext( - httpContext, - path - )); - } - } } } \ No newline at end of file diff --git a/src/Mvc/Mvc.Razor/src/RazorPage.cs b/src/Mvc/Mvc.Razor/src/RazorPage.cs index c3c57e2dd758..be763a3d705f 100644 --- a/src/Mvc/Mvc.Razor/src/RazorPage.cs +++ b/src/Mvc/Mvc.Razor/src/RazorPage.cs @@ -274,11 +274,15 @@ public override void EnsureRenderedBodyOrSections() } } - public override void BeginContext(int position, int length, bool isLiteral) - => DiagnosticListener.BeginInstrumentationContext(Context, Path, position, length, isLiteral); + public override void BeginContext(int position, int length, bool isLiteral) + { + // noop + } public override void EndContext() - => DiagnosticListener.EndInstrumentationContext(Context, Path); + { + // noop + } private void EnsureMethodCanBeInvoked(string methodName) { diff --git a/src/Mvc/Mvc.Razor/test/RazorPageTest.cs b/src/Mvc/Mvc.Razor/test/RazorPageTest.cs index 0c843f655636..8b0ffc087568 100644 --- a/src/Mvc/Mvc.Razor/test/RazorPageTest.cs +++ b/src/Mvc/Mvc.Razor/test/RazorPageTest.cs @@ -948,216 +948,6 @@ public async Task FlushAsync_ReturnsEmptyHtmlString() Assert.Same(HtmlString.Empty, actual); } - [Fact] - public async Task WriteAttribute_WritesBeginAndEndEvents_ToDiagnosticListener() - { - // 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.DiagnosticListener = diagnosticListener; - - // Act - await page.ExecuteAsync(); - - // Assert - Func assertStartEvent = data => - { - var beginEvent = Assert.IsType(data); - Assert.NotNull(beginEvent.HttpContext); - Assert.Equal(path, beginEvent.Path); - - return beginEvent; - }; - - Action assertEndEvent = data => - { - var endEvent = Assert.IsType(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_ToDiagnosticListener() - { - // 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.DiagnosticListener = diagnosticListener; - - // Act - await page.ExecuteAsync(); - - // Assert - Func assertStartEvent = data => - { - var beginEvent = Assert.IsType(data); - Assert.NotNull(beginEvent.HttpContext); - Assert.Equal(path, beginEvent.Path); - - return beginEvent; - }; - - Action assertEndEvent = data => - { - var endEvent = Assert.IsType(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_ToDiagnosticListener_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.DiagnosticListener = diagnosticListener; - - // Act - await page.ExecuteAsync(); - - // Assert - Func assertStartEvent = data => - { - var beginEvent = Assert.IsType(data); - Assert.NotNull(beginEvent.HttpContext); - Assert.Equal(path, beginEvent.Path); - - return beginEvent; - }; - - Action assertEndEvent = data => - { - var endEvent = Assert.IsType(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 diff --git a/src/Mvc/Mvc.RazorPages/src/PageBase.cs b/src/Mvc/Mvc.RazorPages/src/PageBase.cs index d7eaa1849543..0ae4993b35d2 100644 --- a/src/Mvc/Mvc.RazorPages/src/PageBase.cs +++ b/src/Mvc/Mvc.RazorPages/src/PageBase.cs @@ -110,38 +110,13 @@ public override void EnsureRenderedBodyOrSections() /// public override void BeginContext(int position, int length, bool isLiteral) { - const string BeginContextEvent = "Microsoft.AspNetCore.Mvc.Razor.BeginInstrumentationContext"; - - if ((DiagnosticListener?.IsEnabled() ?? false) && DiagnosticListener?.IsEnabled(BeginContextEvent) == true) - { - DiagnosticListener.Write( - BeginContextEvent, - new - { - httpContext = ViewContext, - path = Path, - position = position, - length = length, - isLiteral = isLiteral, - }); - } + // noop } /// public override void EndContext() { - const string EndContextEvent = "Microsoft.AspNetCore.Mvc.Razor.EndInstrumentationContext"; - - if ((DiagnosticListener?.IsEnabled() ?? false) && DiagnosticListener?.IsEnabled(EndContextEvent) == true) - { - DiagnosticListener.Write( - EndContextEvent, - new - { - httpContext = ViewContext, - path = Path, - }); - } + // noop } /// From 84631cda7339201f504b8383c88ea354b1250980 Mon Sep 17 00:00:00 2001 From: Ben Adams Date: Fri, 12 Jul 2019 23:30:00 +0100 Subject: [PATCH 09/11] DiagnosticSource in RazorPageActivator --- src/Mvc/Mvc.Razor/src/RazorPageActivator.cs | 5 ++--- src/Mvc/Mvc.Razor/src/RazorPageBase.cs | 4 ++-- src/Mvc/Mvc.Razor/src/RazorPagePropertyActivator.cs | 6 ------ src/Mvc/Mvc.Razor/test/RazorPageActivatorTest.cs | 6 +++--- .../src/Infrastructure/DefaultPageFactoryProvider.cs | 1 - .../test/Infrastructure/DefaultPageFactoryProviderTest.cs | 8 ++++---- 6 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/Mvc/Mvc.Razor/src/RazorPageActivator.cs b/src/Mvc/Mvc.Razor/src/RazorPageActivator.cs index 436d6598bf90..9acc858e5a6e 100644 --- a/src/Mvc/Mvc.Razor/src/RazorPageActivator.cs +++ b/src/Mvc/Mvc.Razor/src/RazorPageActivator.cs @@ -32,7 +32,7 @@ public RazorPageActivator( IModelMetadataProvider metadataProvider, IUrlHelperFactory urlHelperFactory, IJsonHelper jsonHelper, - DiagnosticListener diagnosticListener, + DiagnosticSource diagnosticSource, HtmlEncoder htmlEncoder, IModelExpressionProvider modelExpressionProvider) { @@ -43,8 +43,7 @@ public RazorPageActivator( { UrlHelperAccessor = context => urlHelperFactory.GetUrlHelper(context), JsonHelperAccessor = context => jsonHelper, - DiagnosticListenerAccessor = context => diagnosticListener, - DiagnosticSourceAccessor = context => diagnosticListener, + DiagnosticSourceAccessor = context => diagnosticSource, HtmlEncoderAccessor = context => htmlEncoder, ModelExpressionProviderAccessor = context => modelExpressionProvider, }; diff --git a/src/Mvc/Mvc.Razor/src/RazorPageBase.cs b/src/Mvc/Mvc.Razor/src/RazorPageBase.cs index d0fc154fb878..c8af0141b96e 100644 --- a/src/Mvc/Mvc.Razor/src/RazorPageBase.cs +++ b/src/Mvc/Mvc.Razor/src/RazorPageBase.cs @@ -83,10 +83,10 @@ public virtual TextWriter Output public IDictionary PreviousSectionWriters { get; set; } /// - /// Gets or sets a instance used to instrument the page execution. + /// Gets or sets a instance used to instrument the page execution. /// [RazorInject] - public DiagnosticListener DiagnosticListener { get; set; } + public DiagnosticSource DiagnosticSource { get; set; } /// /// Gets the to use when this diff --git a/src/Mvc/Mvc.Razor/src/RazorPagePropertyActivator.cs b/src/Mvc/Mvc.Razor/src/RazorPagePropertyActivator.cs index e0cf62d65833..5bcba01b62c3 100644 --- a/src/Mvc/Mvc.Razor/src/RazorPagePropertyActivator.cs +++ b/src/Mvc/Mvc.Razor/src/RazorPagePropertyActivator.cs @@ -108,10 +108,6 @@ private static PropertyActivator CreateActivateInfo( { valueAccessor = valueAccessors.JsonHelperAccessor; } - else if (property.PropertyType == typeof(DiagnosticListener)) - { - valueAccessor = valueAccessors.DiagnosticListenerAccessor; - } else if (property.PropertyType == typeof(DiagnosticSource)) { valueAccessor = valueAccessors.DiagnosticSourceAccessor; @@ -145,8 +141,6 @@ public class PropertyValueAccessors public Func JsonHelperAccessor { get; set; } - public Func DiagnosticListenerAccessor { get; set; } - public Func DiagnosticSourceAccessor { get; set; } public Func HtmlEncoderAccessor { get; set; } diff --git a/src/Mvc/Mvc.Razor/test/RazorPageActivatorTest.cs b/src/Mvc/Mvc.Razor/test/RazorPageActivatorTest.cs index ebf87154ba78..da3f6ceccbbf 100644 --- a/src/Mvc/Mvc.Razor/test/RazorPageActivatorTest.cs +++ b/src/Mvc/Mvc.Razor/test/RazorPageActivatorTest.cs @@ -62,7 +62,7 @@ public void Activate_ContextualizesServices_AndSetsProperties_OnPage() activator.Activate(instance, viewContext); // Assert - Assert.Same(DiagnosticListener, instance.DiagnosticListener); + Assert.Same(DiagnosticListener, instance.DiagnosticSource); Assert.Same(HtmlEncoder, instance.HtmlEncoder); Assert.Same(JsonHelper, instance.Json); Assert.Same(urlHelper, instance.Url); @@ -97,7 +97,7 @@ public void Activate_ContextualizesServices_AndSetsProperties_OnPageWithoutModel activator.Activate(instance, viewContext); // Assert - Assert.Same(DiagnosticListener, instance.DiagnosticListener); + 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 @@ public void Activate_InstantiatesNewViewDataDictionaryType_IfTheTypeDoesNotMatch activator.Activate(instance, viewContext); // Assert - Assert.Same(DiagnosticListener, instance.DiagnosticListener); + Assert.Same(DiagnosticListener, instance.DiagnosticSource); Assert.Same(HtmlEncoder, instance.HtmlEncoder); Assert.Same(JsonHelper, instance.Json); Assert.Same(urlHelper, instance.Url); diff --git a/src/Mvc/Mvc.RazorPages/src/Infrastructure/DefaultPageFactoryProvider.cs b/src/Mvc/Mvc.RazorPages/src/Infrastructure/DefaultPageFactoryProvider.cs index 6cc3c5715061..607586c7ccc1 100644 --- a/src/Mvc/Mvc.RazorPages/src/Infrastructure/DefaultPageFactoryProvider.cs +++ b/src/Mvc/Mvc.RazorPages/src/Infrastructure/DefaultPageFactoryProvider.cs @@ -34,7 +34,6 @@ public DefaultPageFactoryProvider( { UrlHelperAccessor = context => urlHelperFactory.GetUrlHelper(context), JsonHelperAccessor = context => jsonHelper, - DiagnosticListenerAccessor = context => diagnosticListener, DiagnosticSourceAccessor = context => diagnosticListener, HtmlEncoderAccessor = context => htmlEncoder, ModelExpressionProviderAccessor = context => modelExpressionProvider, diff --git a/src/Mvc/Mvc.RazorPages/test/Infrastructure/DefaultPageFactoryProviderTest.cs b/src/Mvc/Mvc.RazorPages/test/Infrastructure/DefaultPageFactoryProviderTest.cs index ae9033096263..9e2871d62aca 100644 --- a/src/Mvc/Mvc.RazorPages/test/Infrastructure/DefaultPageFactoryProviderTest.cs +++ b/src/Mvc/Mvc.RazorPages/test/Infrastructure/DefaultPageFactoryProviderTest.cs @@ -279,8 +279,8 @@ public void PageFactoryDoesNotBindPropertiesWithNoRazorInjectAttribute() // Assert var testPage = Assert.IsType(instance); - Assert.Null(testPage.DiagnosticListenerWithoutInject); - Assert.NotNull(testPage.DiagnosticListenerWithInject); + Assert.Null(testPage.DiagnosticSourceWithoutInject); + Assert.NotNull(testPage.DiagnosticSourceWithInject); Assert.Null(testPage.LoggerWithoutInject); Assert.NotNull(testPage.LoggerWithInject); @@ -375,10 +375,10 @@ private class PropertiesWithoutRazorInject : Page [RazorInject] public IModelExpressionProvider ModelExpressionProviderWithInject { get; set; } - public DiagnosticListener DiagnosticListenerWithoutInject { get; set; } + public DiagnosticSource DiagnosticSourceWithoutInject { get; set; } [RazorInject] - public DiagnosticListener DiagnosticListenerWithInject { get; set; } + public DiagnosticSource DiagnosticSourceWithInject { get; set; } public ILogger LoggerWithoutInject { get; set; } From b569746180f2852dc2a55d60abb05ab02e418ae5 Mon Sep 17 00:00:00 2001 From: Ben Adams Date: Sat, 13 Jul 2019 00:22:04 +0100 Subject: [PATCH 10/11] Code check --- ...osoft.AspNetCore.Mvc.Core.netcoreapp3.0.cs | 33 ++++++++++++------- ...soft.AspNetCore.Mvc.Razor.netcoreapp3.0.cs | 25 ++------------ 2 files changed, 24 insertions(+), 34 deletions(-) diff --git a/src/Mvc/Mvc.Core/ref/Microsoft.AspNetCore.Mvc.Core.netcoreapp3.0.cs b/src/Mvc/Mvc.Core/ref/Microsoft.AspNetCore.Mvc.Core.netcoreapp3.0.cs index 64a9277e17fb..125028635853 100644 --- a/src/Mvc/Mvc.Core/ref/Microsoft.AspNetCore.Mvc.Core.netcoreapp3.0.cs +++ b/src/Mvc/Mvc.Core/ref/Microsoft.AspNetCore.Mvc.Core.netcoreapp3.0.cs @@ -1720,17 +1720,6 @@ public partial interface IAntiforgeryValidationFailedResult : Microsoft.AspNetCo } namespace Microsoft.AspNetCore.Mvc.Diagnostics { - public abstract partial class EventData : System.Collections.Generic.IEnumerable>, System.Collections.Generic.IReadOnlyCollection>, System.Collections.Generic.IReadOnlyList>, System.Collections.IEnumerable - { - protected const string EventNamespace = "Microsoft.AspNetCore.Mvc."; - protected EventData() { } - protected abstract int Count { get; } - protected abstract System.Collections.Generic.KeyValuePair this[int index] { get; } - int System.Collections.Generic.IReadOnlyCollection>.Count { get { throw null; } } - System.Collections.Generic.KeyValuePair System.Collections.Generic.IReadOnlyList>.this[int index] { get { throw null; } } - System.Collections.Generic.IEnumerator> System.Collections.Generic.IEnumerable>.GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } public sealed partial class AfterAction : Microsoft.AspNetCore.Mvc.Diagnostics.EventData { public const string EventName = "Microsoft.AspNetCore.Mvc.AfterAction"; @@ -2010,6 +1999,28 @@ public BeforeOnResultExecution(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescr protected override System.Collections.Generic.KeyValuePair 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.IReadOnlyCollection>, System.Collections.Generic.IReadOnlyList>, System.Collections.IEnumerable + { + protected const string EventNamespace = "Microsoft.AspNetCore.Mvc."; + protected EventData() { } + protected abstract int Count { get; } + protected abstract System.Collections.Generic.KeyValuePair this[int index] { get; } + int System.Collections.Generic.IReadOnlyCollection>.Count { get { throw null; } } + System.Collections.Generic.KeyValuePair System.Collections.Generic.IReadOnlyList>.this[int index] { get { throw null; } } + System.Collections.Generic.IEnumerator> System.Collections.Generic.IEnumerable>.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.IEnumerator, System.IDisposable + { + private object _dummy; + private int _dummyPrimitive; + public System.Collections.Generic.KeyValuePair 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 { diff --git a/src/Mvc/Mvc.Razor/ref/Microsoft.AspNetCore.Mvc.Razor.netcoreapp3.0.cs b/src/Mvc/Mvc.Razor/ref/Microsoft.AspNetCore.Mvc.Razor.netcoreapp3.0.cs index 402a9d3a3a35..289b37ab2723 100644 --- a/src/Mvc/Mvc.Razor/ref/Microsoft.AspNetCore.Mvc.Razor.netcoreapp3.0.cs +++ b/src/Mvc/Mvc.Razor/ref/Microsoft.AspNetCore.Mvc.Razor.netcoreapp3.0.cs @@ -45,27 +45,6 @@ public BeforeViewPage(Microsoft.AspNetCore.Mvc.Razor.IRazorPage page, Microsoft. 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 BeginInstrumentationContext : Microsoft.AspNetCore.Mvc.Diagnostics.EventData - { - public const string EventName = "Microsoft.AspNetCore.Mvc.Razor.BeginInstrumentationContext"; - public BeginInstrumentationContext(Microsoft.AspNetCore.Http.HttpContext httpContext, string path, int position, int length, bool isLiteral) { } - protected override int Count { get { throw null; } } - public Microsoft.AspNetCore.Http.HttpContext HttpContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public bool IsLiteral { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - protected override System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } - public int Length { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public string Path { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public int Position { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } - public sealed partial class EndInstrumentationContext : Microsoft.AspNetCore.Mvc.Diagnostics.EventData - { - public const string EventName = "Microsoft.AspNetCore.Mvc.Razor.EndInstrumentationContext"; - public EndInstrumentationContext(Microsoft.AspNetCore.Http.HttpContext httpContext, string path) { } - 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 this[int index] { get { throw null; } } - public string Path { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } } namespace Microsoft.AspNetCore.Mvc.Razor { @@ -149,7 +128,7 @@ public void IgnoreSection(string sectionName) { } } public partial class RazorPageActivator : Microsoft.AspNetCore.Mvc.Razor.IRazorPageActivator { - public RazorPageActivator(Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider metadataProvider, Microsoft.AspNetCore.Mvc.Routing.IUrlHelperFactory urlHelperFactory, Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper jsonHelper, System.Diagnostics.DiagnosticListener diagnosticListener, System.Text.Encodings.Web.HtmlEncoder htmlEncoder, Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider modelExpressionProvider) { } + public RazorPageActivator(Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider metadataProvider, Microsoft.AspNetCore.Mvc.Routing.IUrlHelperFactory urlHelperFactory, Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper jsonHelper, System.Diagnostics.DiagnosticSource diagnosticSource, System.Text.Encodings.Web.HtmlEncoder htmlEncoder, Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider modelExpressionProvider) { } public void Activate(Microsoft.AspNetCore.Mvc.Razor.IRazorPage page, Microsoft.AspNetCore.Mvc.Rendering.ViewContext context) { } } public abstract partial class RazorPageBase : Microsoft.AspNetCore.Mvc.Razor.IRazorPage @@ -157,7 +136,7 @@ public abstract partial class RazorPageBase : Microsoft.AspNetCore.Mvc.Razor.IRa protected RazorPageBase() { } public Microsoft.AspNetCore.Html.IHtmlContent BodyContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } [Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] - public System.Diagnostics.DiagnosticListener DiagnosticListener { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Diagnostics.DiagnosticSource DiagnosticSource { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } [Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public System.Text.Encodings.Web.HtmlEncoder HtmlEncoder { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public bool IsLayoutBeingRendered { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } From e92da5721e46eade17dbd9e20a439391508997a1 Mon Sep 17 00:00:00 2001 From: Ben Adams Date: Mon, 15 Jul 2019 17:28:00 +0100 Subject: [PATCH 11/11] Feedback --- ...ft.AspNetCore.MiddlewareAnalysis.netcoreapp3.0.cs | 2 +- .../MiddlewareAnalysis/src/AnalysisMiddleware.cs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Middleware/MiddlewareAnalysis/ref/Microsoft.AspNetCore.MiddlewareAnalysis.netcoreapp3.0.cs b/src/Middleware/MiddlewareAnalysis/ref/Microsoft.AspNetCore.MiddlewareAnalysis.netcoreapp3.0.cs index 766d1c17638f..34360758588f 100644 --- a/src/Middleware/MiddlewareAnalysis/ref/Microsoft.AspNetCore.MiddlewareAnalysis.netcoreapp3.0.cs +++ b/src/Middleware/MiddlewareAnalysis/ref/Microsoft.AspNetCore.MiddlewareAnalysis.netcoreapp3.0.cs @@ -15,7 +15,7 @@ public AnalysisBuilder(Microsoft.AspNetCore.Builder.IApplicationBuilder inner) { } public partial class AnalysisMiddleware { - public AnalysisMiddleware(Microsoft.AspNetCore.Http.RequestDelegate next, System.Diagnostics.DiagnosticListener diagnosticListener, string middlewareName) { } + public AnalysisMiddleware(Microsoft.AspNetCore.Http.RequestDelegate next, System.Diagnostics.DiagnosticSource diagnosticSource, string middlewareName) { } [System.Diagnostics.DebuggerStepThroughAttribute] public System.Threading.Tasks.Task Invoke(Microsoft.AspNetCore.Http.HttpContext httpContext) { throw null; } } diff --git a/src/Middleware/MiddlewareAnalysis/src/AnalysisMiddleware.cs b/src/Middleware/MiddlewareAnalysis/src/AnalysisMiddleware.cs index 3fa9d3e0156d..081f64f0ceae 100644 --- a/src/Middleware/MiddlewareAnalysis/src/AnalysisMiddleware.cs +++ b/src/Middleware/MiddlewareAnalysis/src/AnalysisMiddleware.cs @@ -12,13 +12,13 @@ public class AnalysisMiddleware { private readonly Guid _instanceId = Guid.NewGuid(); private readonly RequestDelegate _next; - private readonly DiagnosticListener _diagnostics; + private readonly DiagnosticSource _diagnostics; private readonly string _middlewareName; - public AnalysisMiddleware(RequestDelegate next, DiagnosticListener diagnosticListener, string middlewareName) + public AnalysisMiddleware(RequestDelegate next, DiagnosticSource diagnosticSource, string middlewareName) { _next = next; - _diagnostics = diagnosticListener; + _diagnostics = diagnosticSource; if (string.IsNullOrEmpty(middlewareName)) { middlewareName = next.Target.GetType().FullName; @@ -29,7 +29,7 @@ public AnalysisMiddleware(RequestDelegate next, DiagnosticListener diagnosticLis public async Task Invoke(HttpContext httpContext) { var startTimestamp = Stopwatch.GetTimestamp(); - if (_diagnostics.IsEnabled() && _diagnostics.IsEnabled("Microsoft.AspNetCore.MiddlewareAnalysis.MiddlewareStarting")) + if (_diagnostics.IsEnabled("Microsoft.AspNetCore.MiddlewareAnalysis.MiddlewareStarting")) { _diagnostics.Write( "Microsoft.AspNetCore.MiddlewareAnalysis.MiddlewareStarting", @@ -46,7 +46,7 @@ public async Task Invoke(HttpContext httpContext) { await _next(httpContext); - if (_diagnostics.IsEnabled() && _diagnostics.IsEnabled("Microsoft.AspNetCore.MiddlewareAnalysis.MiddlewareFinished")) + if (_diagnostics.IsEnabled("Microsoft.AspNetCore.MiddlewareAnalysis.MiddlewareFinished")) { var currentTimestamp = Stopwatch.GetTimestamp(); _diagnostics.Write( @@ -63,7 +63,7 @@ public async Task Invoke(HttpContext httpContext) } catch (Exception ex) { - if (_diagnostics.IsEnabled() && _diagnostics.IsEnabled("Microsoft.AspNetCore.MiddlewareAnalysis.MiddlewareException")) + if (_diagnostics.IsEnabled("Microsoft.AspNetCore.MiddlewareAnalysis.MiddlewareException")) { var currentTimestamp = Stopwatch.GetTimestamp(); _diagnostics.Write(