Skip to content

Conversation

@jkotas
Copy link
Member

@jkotas jkotas commented Jun 10, 2022

No description provided.

@jkotas jkotas requested a review from MichalStrehovsky as a code owner June 10, 2022 05:45
@ghost ghost assigned jkotas Jun 10, 2022
@ghost
Copy link

ghost commented Jun 10, 2022

Tagging subscribers to this area: @dotnet/area-system-reflection
See info in area-owners.md if you want to be subscribed.

Issue Details

null

Author: jkotas
Assignees: jkotas
Labels:

area-System.Reflection

Milestone: -

Copy link
Member

@MichalStrehovsky MichalStrehovsky left a comment

Choose a reason for hiding this comment

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

Thanks!

@MichalStrehovsky
Copy link
Member

The warning that is failing the build is dotnet/linker#2790.

It complains that we're creating a delegate to a method with annotations. Trimming cannot enforce the delegate will be always called from places that are analyzable.

A good fix might be to just remove the annotations on the method and add a warning suppression instead (it's going to warn that we call GetUninitializedObject). It's always safe to call GetUninitializedObject on an underlying type of a nullable. We also have a test for that being added in #70201 (TestVTableOfNullableUnderlyingTypes).

@MichalStrehovsky
Copy link
Member

[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2072:UnrecognizedReflectionPattern",
            Justification = "Constructed MethodTable of a Nullable forces a constructed MethodTable of the element type")]

Is the suppression we have on GetUninitializedObject that will probably suppress the right thing here.

@jkotas
Copy link
Member Author

jkotas commented Jun 12, 2022

Failure is #70626

@jkotas jkotas merged commit b15ffe5 into dotnet:main Jun 12, 2022
@jkotas jkotas deleted the System.Private.Reflection.Core branch June 12, 2022 16:03
@ghost ghost locked as resolved and limited conversation to collaborators Jul 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants