dotnet / dotnet/winforms

Make serialization trim safe

Open
#10,812 0 comments 0 reactions 0 assignees View on GitHub
area-Trimming
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
1d 13m
Merged PRs (30d)
85

Description

Making serialization work in trimming requires avoiding challenging reflection calls that tend to cause problems for the trimmer. WinForms should address trim issues related to serialization. Some specific cases impacting [TrimTest](https://github.com/dotnet/winforms/blob/main/src/System.Windows.Forms/tests/IntegrationTests/TrimTest/TrimTest.csproj) project:
- [ComponentResourceManager.ApplyResources(object value, string objectName)](https://github.com/dotnet/winforms/blob/904487a9da4bb66f2149edeaab1cc92b67bcc5b2/src/System.Windows.Forms/src/System/Windows/Forms/MDI/MDIWindowDialog.cs#L89-L121)
- Use of BinaryFormatter: [here ](https://github.com/dotnet/winforms/blob/904487a9da4bb66f2149edeaab1cc92b67bcc5b2/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/Control.ActiveXImpl.cs#L1138), [here](https://github.com/dotnet/winforms/blob/904487a9da4bb66f2149edeaab1cc92b67bcc5b2/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/Control.ActiveXImpl.cs#L1507), [here](https://github.com/dotnet/winforms/blob/904487a9da4bb66f2149edeaab1cc92b67bcc5b2/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.ComDataObjectAdapter.cs#L143), [here](https://github.com/dotnet/winforms/blob/904487a9da4bb66f2149edeaab1cc92b67bcc5b2/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs#L685)

The warnings details can be found with,
[Default_Trimmed_Warnings_wpf_attributes_excluded_Serialization.txt](https://github.com/dotnet/winforms/files/14145239/Default_Trimmed_Warnings_wpf_attributes_excluded_Serialization.txt)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.