Skip to content

Commit ae413d9

Browse files
steveisoklukas-lansky
authored andcommitted
Split mobile specific ILLink.Substitutions into its own file (#56306)
It was discovered in #56161 that mobile specific HttpClientHandler substitutions were sticking around even for non mobile builds. This change moves the substitution into ILLink.Substitutions.mobile.xml.
1 parent 2c8fb17 commit ae413d9

File tree

4 files changed

+10
-14
lines changed

4 files changed

+10
-14
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<linker>
2+
<assembly fullname="System.Net.Http">
3+
<type fullname="System.Net.Http.HttpClientHandler">
4+
<method signature="System.Boolean get_IsNativeHandlerEnabled()" body="stub" value="false" feature="System.Net.Http.UseNativeHttpHandler" featurevalue="false" />
5+
</type>
6+
</assembly>
7+
</linker>

src/libraries/System.Net.Http/src/ILLink/ILLink.Substitutions.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,5 @@
33
<type fullname="System.Net.Http.DiagnosticsHandler">
44
<method signature="System.Boolean IsGloballyEnabled()" body="stub" value="false" feature="System.Net.Http.EnableActivityPropagation" featurevalue="false" />
55
</type>
6-
<type fullname="System.Net.Http.HttpClientHandler">
7-
<method signature="System.Boolean get_IsNativeHandlerEnabled()" body="stub" value="false" feature="System.Net.Http.UseNativeHttpHandler" featurevalue="false" />
8-
</type>
96
</assembly>
107
</linker>

src/libraries/System.Net.Http/src/System.Net.Http.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<WindowsRID>win</WindowsRID>
44
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
@@ -18,6 +18,8 @@
1818
</PropertyGroup>
1919
<ItemGroup>
2020
<ILLinkSubstitutionsXmls Include="$(ILLinkDirectory)ILLink.Substitutions.xml" />
21+
<ILLinkSubstitutionsXmls Condition="'$(TargetsAndroid)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetsMacCatalyst)' == 'true' or '$(TargetsTVOS)' == 'true'"
22+
Include="$(ILLinkDirectory)ILLink.Substitutions.mobile.xml" />
2123
</ItemGroup>
2224
<ItemGroup>
2325
<Compile Include="System\Net\Http\ByteArrayContent.cs" />

src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -815,16 +815,6 @@ private void PrepareRequestMessage(HttpRequestMessage request)
815815
return (pendingRequestsCts, DisposeTokenSource: false, pendingRequestsCts);
816816
}
817817

818-
private static bool IsNativeHandlerEnabled()
819-
{
820-
if (!AppContext.TryGetSwitch("System.Net.Http.UseNativeHttpHandler", out bool isEnabled))
821-
{
822-
return false;
823-
}
824-
825-
return isEnabled;
826-
}
827-
828818
private Uri? CreateUri(string? uri) =>
829819
string.IsNullOrEmpty(uri) ? null : new Uri(uri, UriKind.RelativeOrAbsolute);
830820

0 commit comments

Comments
 (0)