Skip to content
This repository was archived by the owner on Sep 25, 2026. It is now read-only.

Enable processing of dynamically referenced assemblies - #1611

Closed
sbomer wants to merge 9 commits into
dotnet:masterfrom
sbomer:lazyLoad
Closed

sbomer wants to merge 9 commits into
dotnet:masterfrom
sbomer:lazyLoad

Conversation

@sbomer

@sbomer sbomer commented Nov 6, 2020

Copy link
Copy Markdown
Member

This introduces the ability to add assemblies to LinkContext lazily and have them
processed in MarkStep. For now, the only additional processing is to
load references and run the TypeMap logic. Later, embedded XML processing and
constant propagation will also happen for lazy assemblies.

This is Phase 1 outlined in #1164 (comment).

Fixes #943
Fixes #1079

This still needs a bit of work to handle a case where a dynamic assembly is resolved but not marked (for example when using GetType for an assembly-qualified type where the assembly exists, but the type doesn't). In this case, SweepStep can make some false assumptions.

This introduces the ability to add assemblies to LinkContext lazily and have them
processed in MarkStep. For now, the only additional processing is to
load references and run the TypeMap logic. Later, embedded XML processing and
constant propagation will also happen for lazy assemblies.

This is Phase 1 outlined in dotnet#1164 (comment).

Fixes dotnet#943
Fixes dotnet#1079
- Use Resolve for debugger attributes and CreateInstance
- Don't process references for types that come from already-processed assemblies
- Don't throw when resolving dynamic references to assemblies
- Don't allow specifying assembly with assembly-qualified type name
And update some tests
@sbomer
sbomer requested a review from marek-safar as a code owner November 6, 2020 01:21
Comment thread src/linker/Linker.Steps/IAssemblyStep.cs Outdated
Comment thread src/linker/Linker/TypeNameResolver.cs Outdated
Comment thread src/linker/Linker.Steps/LoadReferencesStep.cs
Comment thread src/linker/Linker.Steps/LoadReferencesStep.cs Outdated
Comment thread src/linker/Linker.Steps/IAssemblyStep.cs
Comment thread src/linker/Linker.Dataflow/ReflectionMethodBodyScanner.cs Outdated
[SetupLinkerCoreAction ("link")]
// IComponent has TypeConverterAttribute referencing System.dll, which has
// unresolved references to Win32 assemblies.
[SetupLinkerArgument ("--skip-unresolved", "true")]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't understand this. Is ths PR is making the situation worse instead of better?

Comment thread src/linker/Linker/Pipeline.cs Outdated
Comment thread src/linker/Linker.Steps/IAssemblyStep.cs
And fix up some existing tests
This could lead to some extra processing, but it guarantees that
references resolved in SweepStep will be registered with the context.

Also make TryParseTypeName return a bool.
@sbomer

sbomer commented Jan 5, 2021

Copy link
Copy Markdown
Member Author

Closing in favor of #1666

@sbomer sbomer closed this Jan 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

3 participants