dotnet / dotnet/wpf

WPF is not trim-compatible

Open
#3,811 32 comments 106 reactions 1 assignee Claimed by @ryalanms View on GitHub
Enhancement Requested Work Item
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

At the top-level, WPF apps should be able to use trimming with predictable results. To trim WPF safely, the trim warnings need to be fixed. A list of all warnings and a summary are provided here:

WPF specific warnings can be seen in the file below,
[usinglinkerwrn3.txt](https://github.com/dotnet/wpf/files/5660731/usinglinkerwrn3.txt)

Warning information can be found [here](https://github.com/mono/linker/blob/master/docs/error-codes.md#warning-codes) at the mono site.

[This ](https://github.com/dotnet/designs/blob/main/accepted/2020/linking-libraries.md#annotating-code) sections of the linking design document gives guidance for library developers on how to approach fixing warnings.

The warnings grouping is as below

Warnings | Count
-- | --
IL2075 | 89
IL2070 | 59
IL2026 | 37
IL2072 | 25
IL2080 | 22
IL2094 | 11
IL2057 | 10
IL2067 | 8
IL2077 | 6
IL2060 | 5
IL2055 | 5
IL2090 | 4
IL2087 | 2
IL2065 | 1
IL2091 | 1
IL2058 | 1
IL2059 | 1

## Goals

- [ ] WPF template produces zero/minimal trim warnings
- [ ] WPF APIs which are not linker-friendly are correctly annotated

## Progress

### Information gathering

- [x] Generate list of warnings produced when linking a representative WPF app
- [x] Categorize warnings, sorting to netcore warnings and WPF-specific warnings (see https://github.com/dotnet/runtime/issues/43078)
- [x] Identify the cause of the warnings and propose fixes

### Code fixes

- [ ] Fix warnings or annotate APIs as necessary
- [ ] Identify linker-unsafe constructs and propose replacements for functionality

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.