Skip to content

Conversation

@LakshanF
Copy link
Contributor

@LakshanF LakshanF commented Jul 30, 2021

The trimmer already has intrinsic to analyze annotations for generic types in MakeGenericType/Method and warns if a type is not statically known. Adding the matched RequiresUnreferencedCodeAttribute to MakeGenericType/Method in Type and MethodInfo in the runtime library and propagated the warnings in the library code.

Suppressed the warning on DispatchProxyGenerator since its trim-safe. The existing trimmer behavior does not change for known input types with this change. Also added RequiresUnreferencedCodeAttribute to the RunClassConstructor since the trimmer cannot guarantee existence of a static ctor.

Fixes #53121

@LakshanF LakshanF requested a review from marek-safar as a code owner July 30, 2021 16:04
@LakshanF LakshanF marked this pull request as draft July 30, 2021 16:05
@LakshanF LakshanF requested review from tlakollo and vitek-karas July 30, 2021 16:06
@LakshanF LakshanF marked this pull request as ready for review August 2, 2021 14:22
@LakshanF LakshanF requested a review from eerhardt August 2, 2021 14:22
Copy link
Member

@vitek-karas vitek-karas left a comment

Choose a reason for hiding this comment

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

The intent looks good to me. I'll defer to @eerhardt on the specifics of OOB assemblies and alike, so please make sure you get a sign-off from him as well.

@danmoseley danmoseley added the linkable-framework Issues associated with delivering a linker friendly framework label Aug 11, 2021
@ghost
Copy link

ghost commented Aug 11, 2021

Tagging subscribers to 'linkable-framework': @eerhardt, @vitek-karas, @LakshanF, @sbomer, @joperezr
See info in area-owners.md if you want to be subscribed.

Issue Details

The trimmer already has intrinsic to analyze annotations for generic types in MakeGenericType/Method and warns if a type is not statically known. Adding the matched RequiresUnreferencedCodeAttribute to MakeGenericType/Method in Type and MethodInfo in the runtime library and propagated the warnings in the library code.

Suppressed the warning on DispatchProxyGenerator since its trim-safe. The existing trimmer behavior does not change for known input types with this change. Also added RequiresUnreferencedCodeAttribute to the RunClassConstructor since the trimmer cannot guarantee existence of a static ctor.

Fixes #53121

Author: LakshanF
Assignees: -
Labels:

linkable-framework

Milestone: -

Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks.

@LakshanF LakshanF merged commit a489488 into dotnet:main Aug 12, 2021
@LakshanF LakshanF deleted the LinkerFixForMakeGenerics branch August 12, 2021 15:32
@ghost ghost locked as resolved and limited conversation to collaborators Sep 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Reflection linkable-framework Issues associated with delivering a linker friendly framework

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

Ensure methods recognized as illink intrinsics are annotated

8 participants