Commit 8262020
authored
Add option to keep/remove COM interfaces (#101087)
Adds an illink option that can be used to remove COM
interfaces (the existing behavior is to preserve COM interfaces
on marked types). If a type implements a COM interface that is
also marked elsewhere, it will still be kept even with
`--keep-com-interfaces false`. This includes windows runtime
interfaces under the same option name.
This eliminates some trim warnings in winforms due to
trim-incompatible code in Control's implementations of COM
interfaces like IPersistPropertyBag. Experimentally, this still
produces a working app for the scenario we've been testing
(https://github.com/dotnet/winforms/tree/main/src/System.Windows.Forms/tests/IntegrationTests/TrimTest).
For now, this just introduces the option without setting it by
default anywhere (or exposing it in MSBuild) so that we can opt
in from the winforms scenario. We might consider setting it
wherever `BuiltInComInteropSupport` is false.1 parent 1e42214 commit 8262020
File tree
6 files changed
+68
-3
lines changed- src/tools/illink
- src/linker
- Linker.Steps
- Linker
- test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType
6 files changed
+68
-3
lines changedLines changed: 14 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
1497 | 1497 | | |
1498 | 1498 | | |
1499 | 1499 | | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
1500 | 1512 | | |
1501 | 1513 | | |
1502 | 1514 | | |
| |||
1537 | 1549 | | |
1538 | 1550 | | |
1539 | 1551 | | |
1540 | | - | |
| 1552 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2438 | 2438 | | |
2439 | 2439 | | |
2440 | 2440 | | |
2441 | | - | |
| 2441 | + | |
2442 | 2442 | | |
2443 | 2443 | | |
2444 | 2444 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
365 | 371 | | |
366 | 372 | | |
367 | 373 | | |
| |||
1284 | 1290 | | |
1285 | 1291 | | |
1286 | 1292 | | |
| 1293 | + | |
1287 | 1294 | | |
1288 | 1295 | | |
1289 | 1296 | | |
| |||
1369 | 1376 | | |
1370 | 1377 | | |
1371 | 1378 | | |
| 1379 | + | |
1372 | 1380 | | |
1373 | 1381 | | |
1374 | 1382 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
| 112 | + | |
111 | 113 | | |
112 | 114 | | |
113 | 115 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
| |||
Lines changed: 40 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
0 commit comments