Skip to content

Commit 68d9920

Browse files
scottaddiegewarren
andauthored
Document the Blazor WebEventDescriptor.EventArgsType breaking change (#23000)
* Document the Blazor WebEventDescriptor.EventArgsType breaking change * Apply suggestions from code review Co-authored-by: Genevieve Warren <[email protected]> * React to Youssef's feedback Co-authored-by: Genevieve Warren <[email protected]>
1 parent c6c58cc commit 68d9920

File tree

3 files changed

+58
-1
lines changed

3 files changed

+58
-1
lines changed

docs/core/compatibility/6.0.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
title: Breaking changes in .NET 6.0
33
description: Navigate to the breaking changes in .NET 6.0.
4-
ms.date: 02/16/2021
4+
ms.date: 02/24/2021
5+
no-loc: [Blazor]
56
---
67
# Breaking changes in .NET 6.0
78

@@ -15,6 +16,7 @@ If you're migrating an app to .NET 6.0, the breaking changes listed here might a
1516
- [Nullable reference type annotations changed](aspnet-core/6.0/nullable-reference-type-annotations-changed.md)
1617
- [Obsoleted and removed APIs](aspnet-core/6.0/obsolete-removed-apis.md)
1718
- [Blazor: Parameter name changed in RequestImageFileAsync method](aspnet-core/6.0/blazor-parameter-name-changed-in-method.md)
19+
- [Blazor: WebEventDescriptor.EventArgsType property replaced](aspnet-core/6.0/blazor-eventargstype-property-replaced.md)
1820
- [Kestrel: Log message attributes changed](aspnet-core/6.0/kestrel-log-message-attributes-changed.md)
1921
- [Middleware: HTTPS Redirection Middleware throws exception on ambiguous HTTPS ports](aspnet-core/6.0/middleware-ambiguous-https-ports-exception.md)
2022
- [Razor: RazorEngine APIs marked obsolete](aspnet-core/6.0/razor-engine-apis-obsolete.md)
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
title: "Breaking change: Blazor: WebEventDescriptor.EventArgsType property replaced"
3+
description: "Learn about the breaking change in ASP.NET Core 6.0 where the WebEventDescriptor.EventArgsType property is replaced by the EventName property."
4+
author: scottaddie
5+
ms.author: scaddie
6+
ms.date: 02/24/2021
7+
no-loc: [Blazor]
8+
---
9+
# Blazor: :::no-loc text="WebEventDescriptor.EventArgsType"::: property replaced
10+
11+
The <xref:Microsoft.AspNetCore.Components.RenderTree.WebEventDescriptor> class is part of Blazor's internal protocol for communicating events from JavaScript into .NET. This class isn't typically used by app code, but rather by platform authors.
12+
13+
Starting in ASP.NET Core 6.0, the <xref:Microsoft.AspNetCore.Components.RenderTree.WebEventDescriptor.EventArgsType%2A> property on `WebEventDescriptor` is being replaced by a new `EventName` property. This change is unlikely to affect any app code, as it's a low-level platform implementation detail.
14+
15+
## Version introduced
16+
17+
6.0
18+
19+
## Old behavior
20+
21+
In ASP.NET Core 5.0 and earlier, the property `EventArgsType` describes a nonstandard, Blazor-specific category name for groups of DOM event types. For example, the `click` and `mousedown` events were both mapped to an `EventArgsType` value of `mouse`. Similarly, `cut`, `copy`, and `paste` events are mapped to an `EventArgsType` value of `clipboard`. These category names are used to determine the .NET type to use for deserializing the incoming event arguments data.
22+
23+
## New behavior
24+
25+
Starting in ASP.NET Core 6.0, the new property `EventName` only specifies the original event's name. For example, `click`, `mousedown`, `cut`, `copy`, or `paste`. There's no longer a need to supply a Blazor-specific category name. For that reason, the old property `EventArgsType` is removed.
26+
27+
## Reason for change
28+
29+
In pull request [dotnet/aspnetcore#29993](https://github.com/dotnet/aspnetcore/pull/29993), support for custom event arguments classes was introduced. As part of this support, the framework no longer relies on all events fitting into a predefined set of categories. The framework now only needs to know the original event name.
30+
31+
## Recommended action
32+
33+
App code should be unaffected and doesn't need to change.
34+
35+
If building a custom Blazor rendering platform, you may need to update the mechanism for dispatching events into the `Renderer`. Replace any hardcoded rules about event categories with simpler logic that supplies the original, raw event name.
36+
37+
## Affected APIs
38+
39+
<xref:Microsoft.AspNetCore.Components.RenderTree.WebEventDescriptor.EventArgsType%2A?displayProperty=nameWithType>
40+
41+
<!--
42+
43+
## Category
44+
45+
ASP.NET Core
46+
47+
## Affected APIs
48+
49+
`P:Microsoft.AspNetCore.Components.RenderTree.WebEventDescriptor.EventArgsType`
50+
51+
-->

docs/core/compatibility/toc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
href: aspnet-core/6.0/obsolete-removed-apis.md
3131
- name: "Blazor: Parameter name changed in RequestImageFileAsync method"
3232
href: aspnet-core/6.0/blazor-parameter-name-changed-in-method.md
33+
- name: "Blazor: WebEventDescriptor.EventArgsType property replaced"
34+
href: aspnet-core/6.0/blazor-eventargstype-property-replaced.md
3335
- name: "Kestrel: Log message attributes changed"
3436
href: aspnet-core/6.0/kestrel-log-message-attributes-changed.md
3537
- name: "Middleware: HTTPS Redirection Middleware throws exception on ambiguous HTTPS ports"
@@ -328,6 +330,8 @@
328330
href: aspnet-core/6.0/obsolete-removed-apis.md
329331
- name: "Blazor: Parameter name changed in RequestImageFileAsync method"
330332
href: aspnet-core/6.0/blazor-parameter-name-changed-in-method.md
333+
- name: "Blazor: WebEventDescriptor.EventArgsType property replaced"
334+
href: aspnet-core/6.0/blazor-eventargstype-property-replaced.md
331335
- name: "Kestrel: Log message attributes changed"
332336
href: aspnet-core/6.0/kestrel-log-message-attributes-changed.md
333337
- name: "Middleware: HTTPS Redirection Middleware throws exception on ambiguous HTTPS ports"

0 commit comments

Comments
 (0)