Skip to content

UseNativeHttpHandler=true is not trimming correctly on mobile apps #64361

@eerhardt

Description

@eerhardt

In a default Maui Android app, I see the following assemblies present in my Release .apk:

image

The first thing that caught my eye was that System.Net.Quic.dll is there. But on Mobile apps, we are using UseNativeHttpHandler=true, see this Android SDK setting.

Since we are using the native HTTP handler, there should be no reason we are bringing .NET sockets handler (and with it HTTP 2 & 3 support).

The reason this code isn't getting trimmed is because we only have a Linker substitution for when false is specified.

<linker>
<assembly fullname="System.Net.Http">
<type fullname="System.Net.Http.HttpClientHandler">
<method signature="System.Boolean get_IsNativeHandlerEnabled()" body="stub" value="false" feature="System.Net.Http.UseNativeHttpHandler" featurevalue="false" />
</type>
</assembly>
</linker>

We should add a substitution entry for true as well. This way a bunch of System.Net.* IL can be trimmed from mobile apps by default.

cc @steveisok @jonathanpeppers

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions