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

Resolving most of ILLink warnings on Microsoft.Extensions.Hosting #53646

Merged
2 commits merged into from
Jun 3, 2021

Conversation

joperezr
Copy link
Member

@joperezr joperezr commented Jun 2, 2021

Resolving most of the warnings on Microsoft.Extensions.Hosting.

The last two warnings are not so easily suppressible today, so the plan for now will instead be to wait for @vitek-karas's change dotnet/linker#2075 on the linker side which will make these type of warnings easier to suppress.

@joperezr joperezr added linkable-framework Issues associated with delivering a linker friendly framework area-Extensions-Hosting labels Jun 2, 2021
@joperezr joperezr requested a review from eerhardt June 2, 2021 21:54
@ghost
Copy link

ghost commented Jun 2, 2021

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

Issue Details

Resolving most of the warnings on Microsoft.Extensions.Hosting.

The last two warnings are not so easily suppressible today, so the plan for now will instead be to wait for @vitek-karas's change dotnet/linker#2075 on the linker side which will make these type of warnings easier to suppress.

Author: joperezr
Assignees: -
Labels:

area-Extensions-Hosting, linkable-framework

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.

{
bool isDevelopment = context.HostingEnvironment.IsDevelopment();
options.ValidateScopes = isDevelopment;
options.ValidateOnBuild = isDevelopment;
});

return builder;

[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
Justification = "Calling IConfiguration.GetValue is safe when the T is bool.")]
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if it would be valuable to add some new overloads to this method for common things, like bool, int, and string. That way we don't need to suppress them in all the callsites.
It would obviously need to go through API review, but I think it might be worth it to add.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree that it would be valuable for our trimming purposes, but not so sure if that is good enough value to add the extra overloads through API Review. Anyway, I'll log an issue to track this proposal and let area-owners/ApiProposal board to decide.

Copy link
Member

Choose a reason for hiding this comment

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

We did for JsonValue: #52773. The generic overload was unsafe, but we added overloads for the primitive values because they are "safe".

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.

Once the whitespace issues are resolved. I think this looks good to merge.

@ghost
Copy link

ghost commented Jun 3, 2021

Hello @joperezr!

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 merged commit e759c0e into dotnet:main Jun 3, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jul 4, 2021
@joperezr joperezr deleted the Hosting branch April 6, 2022 16:58
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Extensions-Hosting linkable-framework Issues associated with delivering a linker friendly framework new-api-needs-documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants