Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add diagnostic message when trimming WinForms/WPF for .NET 6 #16716

Closed
agocke opened this issue Apr 2, 2021 · 4 comments
Closed

Add diagnostic message when trimming WinForms/WPF for .NET 6 #16716

agocke opened this issue Apr 2, 2021 · 4 comments
Assignees
Milestone

Comments

@agocke
Copy link
Member

agocke commented Apr 2, 2021

This is certainly necessary for WinForms, it may also be necessary for WPF if it also uses COM.

We have determined that COM is not trim-safe and that WinForms requires it to function. Since the current plan of record is to add a COM feature switch and disable it by default when trimming, WinForms should have an error of the form:

WinForms requires COM, which is not trim safe. COM is disabled by default when trimming. To enable COM and proceed with trimming, <language around setting feature flag>. This configuration is not recommended."

For WPF, if it does not require COM, we should at least provide a top-level warning that WPF is not trim-safe for .NET 6 and is not recommended.

@agocke agocke added this to the 6.0.1xx milestone Apr 2, 2021
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Request triage from a team member label Apr 2, 2021
@agocke agocke removed the untriaged Request triage from a team member label Apr 2, 2021
@agocke agocke changed the title Add error when trimming WinForms without COM for .NET 6 Add diagnostic message when trimming WinForms/WPF for .NET 6 Apr 2, 2021
@AaronRobinsonMSFT
Copy link
Member

We have determined that COM is not trim-safe and that WinForms requires it to function.

@agocke Have we captured the list of concerns for this in a design doc or another issue? Recording this will help with future costing.

@agocke
Copy link
Member Author

agocke commented Apr 2, 2021

dotnet/runtime#36659 tracks adding the feature flag. I agree that when we add the feature flag we should note that it's disabled by default in trimming because it's not trim safe, then describe why, and the proposed path forward for existing COM uses.

fyi @LakshanF

@vitek-karas
Copy link
Member

I don't think we should talk about COM as being the only reason - there are other issues with WinForms.
I would work the message in general terms "WinForms is not compatible with trimming".

We should have a property which if used will override the message, something like "I Want WinForms Trimmed Anyway". If set I think it would make sense to also revert some of the default feature switches to ON, so that we don't break WinForms on-purpose. The COM feature switch is the obvious first choice.

@agocke
Copy link
Member Author

agocke commented May 3, 2021

Closed by #16892

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants