-
Notifications
You must be signed in to change notification settings - Fork 5.4k
UseNativeHttpHandler=true is not trimming correctly on mobile apps #64361
Description
In a default Maui Android app, I see the following assemblies present in my Release .apk:
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.
runtime/src/libraries/System.Net.Http/src/ILLink/ILLink.Substitutions.mobile.xml
Lines 1 to 7 in c0d481f
| <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.
