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

Copy action behavior #1941

Merged
merged 41 commits into from
Apr 6, 2021
Merged

Copy action behavior #1941

merged 41 commits into from
Apr 6, 2021

Conversation

mateoatr
Copy link
Contributor

@mateoatr mateoatr commented Apr 5, 2021

This PR contains all changes previously introduced in #1869 and fixes an edge case that caused us to revert the merged PR:

SweepStep removes the (unused) enum forwarder before it tries to fix the scope of the attribute arg, so fixing the scope fails

Final size impact on a blazorwasm app:

Total size: 2240 KB (used to be 2228 KB).

   17408 Microsoft.AspNetCore.Components.Web.dll
   48128 Microsoft.AspNetCore.Components.WebAssembly.dll
  121856 Microsoft.AspNetCore.Components.dll
    6144 Microsoft.Extensions.Configuration.Abstractions.dll
    8704 Microsoft.Extensions.Configuration.Json.dll
    7680 Microsoft.Extensions.Configuration.dll
   12800 Microsoft.Extensions.DependencyInjection.Abstractions.dll
   38400 Microsoft.Extensions.DependencyInjection.dll
   24064 Microsoft.Extensions.Logging.Abstractions.dll
   17408 Microsoft.Extensions.Logging.dll
   14848 Microsoft.Extensions.Options.dll
    8704 Microsoft.Extensions.Primitives.dll
    8704 Microsoft.JSInterop.WebAssembly.dll
   30720 Microsoft.JSInterop.dll
   17408 System.Collections.Concurrent.dll
   66560 System.Collections.Immutable.dll
!  22016 System.Collections.dll (before: 22528)
    4608 System.ComponentModel.dll
   13824 System.Console.dll
   25088 System.Linq.dll
!  17920 System.Memory.dll (before: 18432)
   10752 System.Net.Http.Json.dll
  138752 System.Net.Http.dll
    7168 System.Net.Primitives.dll
    7680 System.ObjectModel.dll
!1116672 System.Private.CoreLib.dll (before: 1117184)
   21504 System.Private.Runtime.InteropServices.JavaScript.dll
   65536 System.Private.Uri.dll
    3072 System.Runtime.CompilerServices.Unsafe.dll
-   5632 System.Runtime.dll
   29696 System.Text.Encodings.Web.dll
  239104 System.Text.Json.dll
   17408 foo.dll
+  21860 foo.pdb (before: 13032)

Copy link
Member

@sbomer sbomer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple more comments around the copyused edge case, otherwise LGTM. Thanks a lot!

src/linker/Linker.Steps/SweepStep.cs Outdated Show resolved Hide resolved
src/linker/Linker.Steps/SweepStep.cs Show resolved Hide resolved
@mateoatr mateoatr merged commit 2674d7d into dotnet:main Apr 6, 2021
agocke pushed a commit to dotnet/runtime that referenced this pull request Nov 16, 2022
* Stop rewriting scopes for copy assemblies with removed references

* Keep exported types in copy assemblies
Mark dynamically accessed forwarders
Add tests

* Transitive forwarders are linked

* Keep copyused behavior

* Tests

* Mark type if it's exported

* PR feedback

* Transitively mark forwarders when a facade is dynamically accessed and has copy action

* Transitively mark forwarders

* Fix formatting

* Update MarkExportedType

* Keep mscorlib assert

* Mark forwarders when there's a type ref to an exported type in a copy assembly

* Update DependencyKind

* Keep forwarders when member ref is resolved from a copy assembly

* Add more tests, mark forwarded CAs

* Mark forwarded interfaces

* Simplify logic for typerefs

* Clean

* Keep ProcessInternalsVisibleAttributes in process while-loop

* Fix whitespace formatting

* Remove unused param

* Feedback

* Whitespace formatting

* Remove unnecessary assembly

* Add IL2104 warning

* Remove unnecessary marking

* Update comment

* Remove ExportedTypeExtensions

* Remove formatDiagnostics and revert cecil subm change

* Remove warning

* Comment out check for removed warning

* Update more of existing calls

* Reproduce attribute issue

* Update scopes before sweeping forwarders

* Remove my enum from compilation

* Fix formatting

* Keep same behavior for scopes in copyused assemblies

Co-authored-by: Marek Safar <[email protected]>
Co-authored-by: Sven Boemer <[email protected]>

Commit migrated from dotnet/linker@2674d7d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants