WebEventData.ParseEventArgsJson has invalid UnconditionalSuppressMessage for JsonSerializer.Deserialize
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
See the suppression here:
https://github.com/dotnet/aspnetcore/blob/1d04387cf3b68636f8ade0118334f87ae5f56f7d/src/Components/Web/src/WebEventData/WebEventData.cs#L61-L79
This suppression is not valid because there is no guarantee the `eventArgsType` hasn't been trimmed, and thus the Deserialization may fail, or behave differently, in a trimmed app.
We should remove this suppression and address the warning correctly so this code behaves the same with and without trimming. Potentially, we can use the same approach that we are taking with https://github.com/dotnet/aspnetcore/issues/45527.
This is the root cause of https://github.com/microsoft/fast-blazor/issues/280. In that issue, the `Microsoft.Fast.Components.FluentUI.dll` assembly is marked as `IsTrimmable=true`. The assembly contains some event arg classes, like `MenuChangeEventArgs` and `DialogEventArgs`. These classes are being trimmed, since their containing assembly is marked as `IsTrimmable=true`. However, when an app tries to use these events, it fails as described in the issue. This is because the constructors are being trimmed from the classes, causing the `JsonSerializer.Deserialize` call above to fail.
cc @brunolins16 @javiercn @JamesNK
Contributor guide
Assessment
This issue has not been assessed yet.