-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Android / iOS / tvOS specific HttpClientHandler #47083
Conversation
Tagging subscribers to this area: @dotnet/ncl Issue DetailsImplements #46646 Should make .NET6 compatible with what XA currently have:
|
src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.CreateDefaultHandler.Android.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.CreateDefaultHandler.Android.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.CreateDefaultHandler.Android.cs
Outdated
Show resolved
Hide resolved
Did we decide that's not a scenario we care about? |
It's open for discussion, I was just repeating the current XA behavior. |
I don't see a reason not to preserve the existing behavior. But as Egor said, definitely up for discussion. |
@EgorBo @akoeplinger Thoughts on how we can test this? |
If the existing Xamarin behavior is that |
Either leave it for XA repo or implement that Android Handler via JNI (we can't just re-write it to JNI and use it even for XA because it already exposes some XA APIs in public (to override if users want) so we'll have to maintain two implementation in this case 😐 |
src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.CreateDefaultHandler.Android.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.CreateDefaultHandler.Android.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.CreateDefaultHandler.Android.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.CreateDefaultHandler.tvOS.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.CreateDefaultHandler.Android.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.CreateDefaultHandler.Android.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.CreateDefaultHandler.iOS.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.CreateDefaultHandler.tvOS.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.CreateDefaultHandler.Android.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.CreateDefaultHandler.Android.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.CreateDefaultHandler.cs
Show resolved
Hide resolved
In dotnet/runtime#47083, we are introducing the UseNativeHttpHandler feature switch. This change sets the default to true
In dotnet/runtime#47083, we are introducing the UseNativeHttpHandler feature switch. This change sets the default to true for Android projects.
In dotnet/runtime#47083, we are introducing the UseNativeHttpHandler feature switch. This change sets the default to true for devices.
…ault In dotnet/runtime#47083, we are introducing the UseNativeHttpHandler feature switch. This change sets the default to true for devices.
In dotnet/runtime#47083, we are introducing the UseNativeHttpHandler feature switch. This change makes sure it's defaulted to true for iOS,tvOS,maccatalyst, and android.
In dotnet/runtime#47083, we are introducing the UseNativeHttpHandler feature switch. Adds support for it.
<argument>ILLink</argument> | ||
<argument>IL2075</argument> | ||
<property name="Scope">member</property> | ||
<property name="Target">M:System.Net.Http.HttpClient.CreateDefaultHandler()</property> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@EgorBo @marek-safar - What is the plan to address this warning? We had this library ILLink "clean" already, and so it was no longer being tracked by #45623.
In the future, we should not be adding new ILLink warning suppression xmls to the libraries that are already clean. We need to address the ILLink warnings on any new features we add as we go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The suppression is intentional and will stay there. We could ideally move it to Library.xml but I think we tried that and it had some problems.
Edit: just realized you were taking about XML file. Yes we should move the suppression to the code.
Implements #46646 and #47083 (comment)
Per https://github.com/dotnet/designs/blob/main/accepted/2020/mono-convergence/platform-specific-httpclient.md , the default HttpClientHandler will be the native handler specific to Android, iOS, and tvOS.
To fall back to
SocketsHttpHandler
, simply set theSystem.Net.Http.UseNativeHttpHandler
AppContext switch.AppContext.SetSwitch("System.Net.Http.UseNativeHttpHandler", true);