Repository navigation
[WIP] Remove keep-facades option - #1781
marek-safar wants to merge 1 commit into
Conversation
It was introduced when .net core added framework initial trimming for libraries build. This is a third way to achieve same thing but less logical than using -p or -a option and it's no longer used by libraries build. Fixes dotnet#1740
| var di = new DependencyInfo (DependencyKind.TypePreserve, type); | ||
|
|
||
| switch (members) { | ||
| case TypePreserveMembers.All: |
There was a problem hiding this comment.
What's the difference between TypePreserveMembers.All and TypePreserve.All? They look like they do the same thing.
There was a problem hiding this comment.
they are enum values stored into a different annotation
There was a problem hiding this comment.
I can see that they're different enums. What I mean is, we have this case above:
case TypePreserve.All:
MarkFields (type, true, di);
MarkMethods (type, di, type);
return;Why do we need TypePreserveMembers.All if it is only duplicating this logic? Could we do Annotations.SetPreserve (type, TypePreserve.All) below, instead of Annotations.SetMembersPreserve (type, TypePreserveMembers.All)? That seems to be the only place we use it.
| [SetupLinkerAction ("copy", "copied")] | ||
|
|
||
| // --keep-facades sends the sweep step down a different code path that caused problems for this corner case | ||
| [SetupLinkerArgument ("--keep-facades", "true")] |
There was a problem hiding this comment.
I think this testcase can be deleted (it's now the same as AssemblyOnlyUsedByUsingWithCsc).
| if (assembly.MainModule.HasExportedTypes) { | ||
| // TODO: This needs more work accross all steps | ||
| foreach (var exportedType in assembly.MainModule.ExportedTypes) { | ||
| _context.Annotations.Mark (exportedType, new DependencyInfo (DependencyKind.ExportedType, exportedType)); |
There was a problem hiding this comment.
This looks like a significant behavior change:
- We didn't used to keep type forwards in copy assemblies - this could result in some extra facade dlls being kept that weren't needed previously. It's probably uncommon, since facades are usually going to be copyused as part of the framework, but it's unclear how copyused is supposed to behave now. Should a marked copyused assembly also have exported types kept? (This would be a bigger issue since copyused are more likely to pull in facades).
- I think this will prevent SweepStep from sweeping assembly refs from copy assemblies, so it will never update scopes for Copy assemblies. Same question - how should this work for copyused assemblies?
If we go this direction and mark all copy type forwarders, I think we can simplify a few cases in SweepStep:
- get rid of the copy case from
UpdateAssembliesReferencingRemovedAssembly - get rid of the
SweepTypeForwardershandling for copy assemblies
| // FIXME: AddBypassNGen is just wrong, it should not be action as we need to | ||
| // turn it to Action.Save here to e.g. correctly update debug symbols |
There was a problem hiding this comment.
Should we also delete the comment now?
There was a problem hiding this comment.
I think that still wrong. The whole AddBypassNGen thing is weird :-) and has no tests.
It was introduced when .net core added framework initial trimming for
libraries build. This is a third way to achieve same thing but less
logical than using -p or -a option and it's no longer used by libraries
build.
Fixes #1740