Skip to content

Commit b23ea5b

Browse files
committed
Improvements to MVC EventData typess
Improvments to names - Using EventData suffix - More clarity for events assocated with filters Fixes: #12263 We have to report the BeforeActionMethod using its old signature because it's used by Intellitrace. I added a new pair of events with a better name to use with strong types since there's no practical way to update the old ones.
1 parent 39c3ca2 commit b23ea5b

13 files changed

+520
-494
lines changed

src/Mvc/Mvc.Core/ref/Microsoft.AspNetCore.Mvc.Core.netcoreapp3.0.cs

Lines changed: 87 additions & 87 deletions
Large diffs are not rendered by default.

src/Mvc/Mvc.Core/src/Diagnostics/MvcDiagnostics.cs

Lines changed: 89 additions & 89 deletions
Large diffs are not rendered by default.

src/Mvc/Mvc.Core/src/Infrastructure/ControllerActionInvoker.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ static async Task Logged(ControllerActionInvoker invoker)
419419
IActionResult result = null;
420420
try
421421
{
422-
diagnosticListener.BeforeActionMethod(
422+
diagnosticListener.BeforeControllerActionMethod(
423423
controllerContext,
424424
arguments,
425425
controller);
@@ -440,7 +440,7 @@ static async Task Logged(ControllerActionInvoker invoker)
440440
}
441441
finally
442442
{
443-
diagnosticListener.AfterActionMethod(
443+
diagnosticListener.AfterControllerActionMethod(
444444
controllerContext,
445445
arguments,
446446
controllerContext,

src/Mvc/Mvc.Core/src/MvcCoreDiagnosticListenerExtensions.cs

Lines changed: 157 additions & 130 deletions
Large diffs are not rendered by default.

src/Mvc/Mvc.Razor/ref/Microsoft.AspNetCore.Mvc.Razor.netcoreapp3.0.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,21 @@ public partial interface IRazorCompiledItemProvider
2323
}
2424
namespace Microsoft.AspNetCore.Mvc.Diagnostics
2525
{
26-
public sealed partial class AfterViewPage : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
26+
public sealed partial class AfterViewPageEventData : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
2727
{
2828
public const string EventName = "Microsoft.AspNetCore.Mvc.Razor.AfterViewPage";
29-
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) { }
29+
public AfterViewPageEventData(Microsoft.AspNetCore.Mvc.Razor.IRazorPage page, Microsoft.AspNetCore.Mvc.Rendering.ViewContext viewContext, Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Http.HttpContext httpContext) { }
3030
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
3131
protected override int Count { get { throw null; } }
3232
public Microsoft.AspNetCore.Http.HttpContext HttpContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
3333
protected override System.Collections.Generic.KeyValuePair<string, object> this[int index] { get { throw null; } }
3434
public Microsoft.AspNetCore.Mvc.Razor.IRazorPage Page { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
3535
public Microsoft.AspNetCore.Mvc.Rendering.ViewContext ViewContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
3636
}
37-
public sealed partial class BeforeViewPage : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
37+
public sealed partial class BeforeViewPageEventData : Microsoft.AspNetCore.Mvc.Diagnostics.EventData
3838
{
3939
public const string EventName = "Microsoft.AspNetCore.Mvc.Razor.BeforeViewPage";
40-
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) { }
40+
public BeforeViewPageEventData(Microsoft.AspNetCore.Mvc.Razor.IRazorPage page, Microsoft.AspNetCore.Mvc.Rendering.ViewContext viewContext, Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor actionDescriptor, Microsoft.AspNetCore.Http.HttpContext httpContext) { }
4141
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor ActionDescriptor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
4242
protected override int Count { get { throw null; } }
4343
public Microsoft.AspNetCore.Http.HttpContext HttpContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }

src/Mvc/Mvc.Razor/src/Diagnostics/MvcDiagnostics.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010

1111
namespace Microsoft.AspNetCore.Mvc.Diagnostics
1212
{
13-
public sealed class BeforeViewPage : EventData
13+
public sealed class BeforeViewPageEventData : EventData
1414
{
1515
public const string EventName = EventNamespace +
1616
"Razor." +
17-
nameof(BeforeViewPage);
17+
"BeforeViewPage";
1818

19-
public BeforeViewPage(IRazorPage page, ViewContext viewContext, ActionDescriptor actionDescriptor, HttpContext httpContext)
19+
public BeforeViewPageEventData(IRazorPage page, ViewContext viewContext, ActionDescriptor actionDescriptor, HttpContext httpContext)
2020
{
2121
Page = page;
2222
ViewContext = viewContext;
@@ -41,13 +41,13 @@ public BeforeViewPage(IRazorPage page, ViewContext viewContext, ActionDescriptor
4141
};
4242
}
4343

44-
public sealed class AfterViewPage : EventData
44+
public sealed class AfterViewPageEventData : EventData
4545
{
4646
public const string EventName = EventNamespace +
4747
"Razor." +
48-
nameof(AfterViewPage);
48+
"AfterViewPage";
4949

50-
public AfterViewPage(IRazorPage page, ViewContext viewContext, ActionDescriptor actionDescriptor, HttpContext httpContext)
50+
public AfterViewPageEventData(IRazorPage page, ViewContext viewContext, ActionDescriptor actionDescriptor, HttpContext httpContext)
5151
{
5252
Page = page;
5353
ViewContext = viewContext;

src/Mvc/Mvc.Razor/src/MvcRazorDiagnosticListenerExtensions.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ private static void BeforeViewPageImpl(
2727
IRazorPage page,
2828
ViewContext viewContext)
2929
{
30-
if (diagnosticListener.IsEnabled(Diagnostics.BeforeViewPage.EventName))
30+
if (diagnosticListener.IsEnabled(Diagnostics.BeforeViewPageEventData.EventName))
3131
{
3232
diagnosticListener.Write(
33-
Diagnostics.BeforeViewPage.EventName,
34-
new BeforeViewPage(
33+
Diagnostics.BeforeViewPageEventData.EventName,
34+
new BeforeViewPageEventData(
3535
page,
3636
viewContext,
3737
viewContext.ActionDescriptor,
@@ -57,11 +57,11 @@ private static void AfterViewPageImpl(
5757
IRazorPage page,
5858
ViewContext viewContext)
5959
{
60-
if (diagnosticListener.IsEnabled(Diagnostics.AfterViewPage.EventName))
60+
if (diagnosticListener.IsEnabled(Diagnostics.AfterViewPageEventData.EventName))
6161
{
6262
diagnosticListener.Write(
63-
Diagnostics.AfterViewPage.EventName,
64-
new AfterViewPage(
63+
Diagnostics.AfterViewPageEventData.EventName,
64+
new AfterViewPageEventData(
6565
page,
6666
viewContext,
6767
viewContext.ActionDescriptor,

0 commit comments

Comments
 (0)