Skip to content

[mobile] Add extra HttpClientHandler linker substitution - #64818

Merged
marek-safar merged 2 commits into
dotnet:mainfrom
steveisok:fix-http-linker-sub
Feb 7, 2022
Merged

[mobile] Add extra HttpClientHandler linker substitution#64818
marek-safar merged 2 commits into
dotnet:mainfrom
steveisok:fix-http-linker-sub

Conversation

@steveisok

Copy link
Copy Markdown
Member

The linker substitution for HttpClientHandler.IsNativeHandlerEnabled only worked when in a project was set to false. Since the default for MAUI projects is true, this caused us to carry more assemblies than needed.

Fixes#64361

The linker substitution for HttpClientHandler.IsNativeHandlerEnabled only worked when <UseNativeHttpHandler> in a project was set
to false. Since the default for MAUI projects is true, this caused us to carry more assemblies than needed.
Fixesdotnet#64361
@ghostghost added area-System.Net.Http linkable-framework Issues associated with delivering a linker friendly framework labels Feb 4, 2022
@ghostghost assigned steveisokFeb 4, 2022
@ghost

ghost commented Feb 4, 2022

Copy link
Copy Markdown

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

Issue Details

The linker substitution for HttpClientHandler.IsNativeHandlerEnabled only worked when in a project was set to false. Since the default for MAUI projects is true, this caused us to carry more assemblies than needed.

Fixes #64361

Author:steveisok
Assignees:-
Labels:

area-System.Net.Http

Milestone:-

@eerhardteerhardt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Any way we can add a test for this? Maybe adding a https://github.com/dotnet/runtime/tree/main/src/libraries/System.Net.Http/tests/TrimmingTests ?

You can set feature switches in the trimming test following this pattern:

<TestConsoleAppSourceFilesInclude="InvariantGlobalizationTrue.cs">
<EnabledFeatureSwitches>System.Globalization.Invariant;System.Globalization.PredefinedCulturesOnly</EnabledFeatureSwitches>
</TestConsoleAppSourceFiles>

cc @jonathanpeppers

@eerhardteerhardt added the size-reduction Issues impacting final app size primary for size sensitive workloads label Feb 4, 2022
@ghost

ghost commented Feb 4, 2022

Copy link
Copy Markdown

Tagging subscribers to 'size-reduction': @eerhardt, @SamMonoRT, @marek-safar
See info in area-owners.md if you want to be subscribed.

Issue Details

The linker substitution for HttpClientHandler.IsNativeHandlerEnabled only worked when in a project was set to false. Since the default for MAUI projects is true, this caused us to carry more assemblies than needed.

Fixes #64361

Author:steveisok
Assignees:steveisok
Labels:

area-System.Net.Http, linkable-framework, size-reduction

Milestone:-

…mobile.xml
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
@eerhardteerhardt removed the linkable-framework Issues associated with delivering a linker friendly framework label Feb 4, 2022
@ghostghost added the linkable-framework Issues associated with delivering a linker friendly framework label Feb 4, 2022
@ghost

ghost commented Feb 4, 2022

Copy link
Copy Markdown

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 linker substitution for HttpClientHandler.IsNativeHandlerEnabled only worked when in a project was set to false. Since the default for MAUI projects is true, this caused us to carry more assemblies than needed.

Fixes #64361

Author:steveisok
Assignees:steveisok
Labels:

area-System.Net.Http, linkable-framework, size-reduction

Milestone:-

@eerhardteerhardt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This LGTM. Thanks for getting this fixed! It should really help app size in Maui.

Rethinking the trimming test - it isn't currently possible to write the test I mention above because we don't run the trimming tests on android or ios. See #39274

@steveisok

Copy link
Copy Markdown
MemberAuthor

/backport to release/6.0

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/1800182990

@marek-safar
marek-safar merged commit 179ffff into dotnet:mainFeb 7, 2022
@ghostghost locked as resolved and limited conversation to collaborators Mar 9, 2022
@karelzkarelz added this to the 7.0.0 milestone Apr 8, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Net.Httplinkable-frameworkIssues associated with delivering a linker friendly frameworksize-reductionIssues impacting final app size primary for size sensitive workloads

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UseNativeHttpHandler=true is not trimming correctly on mobile apps

6 participants

@steveisok@marek-safar@simonrozsival@jonathanpeppers@eerhardt@karelz