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

Resolve ILLink warnings in System.Text.Json (Round 1) #51886

Merged
2 commits merged into from
Apr 28, 2021

Conversation

eerhardt
Copy link
Member

Also resolve ILLink warnings in System.Net.Http.Json.

Contributes to #45623

There is one last ILLink warning in JsonValue<T> that I intend to address in a separate PR, since this change is big enough as it is.

@ghost
Copy link

ghost commented Apr 26, 2021

Tagging subscribers to this area: @eiriktsarpalis, @layomia
See info in area-owners.md if you want to be subscribed.

Issue Details

Also resolve ILLink warnings in System.Net.Http.Json.

Contributes to #45623

There is one last ILLink warning in JsonValue<T> that I intend to address in a separate PR, since this change is big enough as it is.

Author: eerhardt
Assignees: -
Labels:

area-System.Text.Json

Milestone: -

@dotnet-issue-labeler
Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@eerhardt eerhardt added linkable-framework Issues associated with delivering a linker friendly framework and removed new-api-needs-documentation labels Apr 26, 2021
@ghost
Copy link

ghost commented Apr 26, 2021

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

Issue Details

Also resolve ILLink warnings in System.Net.Http.Json.

Contributes to #45623

There is one last ILLink warning in JsonValue<T> that I intend to address in a separate PR, since this change is big enough as it is.

Author: eerhardt
Assignees: -
Labels:

area-System.Text.Json, linkable-framework

Milestone: -

@@ -13,6 +13,11 @@
using System.Threading;
using System.Threading.Tasks;

[assembly: UnconditionalSuppressMessage("ReflectionAnalysis", "IL2091:UnrecognizedReflectionPattern",
Target = "M:System.Text.Json.JsonSerializer.<<DeserializeAsyncEnumerable>g__CreateAsyncEnumerableDeserializer|27_0>d`1.MoveNext()",
Copy link
Member

Choose a reason for hiding this comment

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

Appears to be based on C# generated types which in theory could change in the future

Copy link
Member Author

@eerhardt eerhardt Apr 27, 2021

Choose a reason for hiding this comment

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

Yes, unfortunately this is a current limitation of the trimmer with async methods. I'm open to other suggestions, because this is the only way I know how to resolve these warnings.

cc @vitek-karas @MichalStrehovsky @agocke

Copy link
Member

@agocke agocke Apr 28, 2021

Choose a reason for hiding this comment

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

No great answers here, unfortunately. I think the C# compiler should be involved in brainstorming a solution. The same problem would appear if you wanted to, say, put MethodImplOptions on an async method.

Copy link
Member

Choose a reason for hiding this comment

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

The mapping from the kickoff method to the MoveNext method is available in the debug info - when illinker is running in the "library mode", it could propagate the attribute (simply write it into the trimmed library). It shouldn't be too hard and it would work as a stopgap for us.

Of course this would only work if one has debug info and one runs illink in this special mode to propagate the attribute.

Copy link
Member Author

Choose a reason for hiding this comment

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

Of course this would only work if one has debug info

Which will be a problem for our customers trimming their apps that use System.Text.Json, since they won't have .pdbs for System.Text.Json at build time. So they would see these warnings.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, that's why I was suggesting we would propagate it when illink is running as part of building this repo (i.e. when it runs in the library mode, it would just look at the debug info and add a physical attribute on the MoveNext method). It would solve the problem for us right now and I don't think it's very expensive to do.

Also resolve ILLink warnings in System.Net.Http.Json.

Contributes to dotnet#45623
@ghost
Copy link

ghost commented Apr 28, 2021

Hello @eerhardt!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost locked as resolved and limited conversation to collaborators Jun 19, 2021
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Text.Json linkable-framework Issues associated with delivering a linker friendly framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants