-
Notifications
You must be signed in to change notification settings - Fork 511
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
Consider using a Feature Switch for CFNetworkHandler and NSUrlSessionHandler #14298
Comments
Hi, I would like to work on this issue. Requesting the maintainers to kindly assign the issue to me |
@Agnik7 done! Feel free to ask any questions, either here, or in our Discord channel (https://discord.com/channels/732297728826277939/732297808148824115) |
Thanks a lot @rolfbjarne !! Sure, I'll ask whenever I need help |
Hi @rolfbjarne , I am new to open-source and contributing. It will be really appreciated if you could kindly guide me as to which file(s) needs to be updated, and give a basic idea about how to update them. Eagerly waiting for your guidance at the earliest. Thank you!!! |
The idea would be to:
Note: these changes must be done for `#if NET" only. |
Ok, so I need to make the changes in the |
Yes. |
@rolfbjarne I have created a PR #19003 , where I have tried to implemented your valuable guidance. Kindly review it, and do tell me if there are any changes to be made or not. Thanks a lot!! |
In .NET 5 we introduced the concept of a "Feature Switch". This allows .NET apps to change behavior by setting switches at build/publish time. It also allows for the trimmer to remove unused code based on the switch setting.
You can see the current list of Feature Switches the .NET Runtime has for ideas on how these work.
Today, we have code that reads which HttpMessageHandler (
CFNetworkHandler
orNSUrlSessionHandler
) to use at runtime based on a setting in a Resource NSDictionary:xamarin-macios/src/ObjCRuntime/RuntimeOptions.cs
Lines 156 to 189 in 3cce274
This has the following disadvantages:
UseNativeHttpHandler
MSBuild property tofalse
in their .csproj. But if they want to switch between CFNetworkHandler or NSUrlSessionHandler, they need to set this setting in the resource file. Using a feature switch here would make it a consistent experience with the built-in .NET SocketsHttpHandler.cc @rolfbjarne
The text was updated successfully, but these errors were encountered: