You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[.NET] Implement NSUrlSessionHandler members that throw PlatformNotSupportedException #14632
dotnetAn issue or pull request related to .NETenhancementThe issue or pull request is an enhancementnetworkingIf an issue or pull request is related to networking
We haven't had time to look at the other members yet.
Proxy / UseProxy is required for apps running on restricted government mobile devices, as the MDM forces the proxy on every allowed devices, and the default .net behavior is to force the use of no proxy (ie: it ignores the system wide proxy set on mobile device).
Even if this isn't immediately merged. Maybe it would be nice to early return some no-op actions?
I had to hunt down a bug today in an iOS app where a class that used HTTP crashed. The weird thing was that the HTTP code itself was definitely not using proxies at all. It said so right at the start where it initialised the HttpClientHandler:
In retrospect this was pretty funny. On iOS proxying is not supported, but not proxying is not supported either. It only works if you use the defaults, which, of course, do not proxy. The unnecessary lines were in shared code originally written for .NET Core 1 in 2017 and removing them made it work. In fact it turned out that the entire constructor of that class could be replaced by instead initialising the HttpClient member with = new(). All the work we did there was initialising values, apparently necessary in .NET Core 1, which have since become auto-initialised defaults.
var configuration = NSUrlSessionConfiguration.DefaultSessionConfiguration;
var dictionary = new NSDictionary(
new NSString("HTTPEnable"), 1,
new NSString("HTTPProxy"), ProxyServer,
new NSString("HTTPPort"), ProxyPort,
new NSString("HTTPSEnable"), 1,
new NSString("HTTPSProxy"), ProxyServer,
new NSString("HTTPSPort"), ProxyPort);
configuration.ConnectionProxyDictionary = dictionary;
var handler = NSUrlSessionHandler(configuration);
var httpClient = new HttpClient (handler);
Using this method, I have been able to send requests through the proxy server.
Do you think this method is okay? Will there be any impact when the proxy setting of NSUrlSessionHandler is not supported?
dotnetAn issue or pull request related to .NETenhancementThe issue or pull request is an enhancementnetworkingIf an issue or pull request is related to networking
Activity
rolfbjarne commentedon Apr 26, 2022
@mandel-macaque do you know the answer to ^?
filipnavara commentedon Apr 26, 2022
Import the certificate to keychain and mark it as trusted I guess.
kfuller002 commentedon Sep 10, 2022
Can someone elaborate on the workaround for this? As it seems this just got pushed to .NET 8?
kfuller002 commentedon Sep 10, 2022
I was able to get around this by Updating my iOS Build settings Linker behavior to "Dont Link"

rolfbjarne commentedon Sep 12, 2022
ServerCertificateCustomValidationCallbackis being implemented in #15117. We haven't had time to look at the other members yet.softlion commentedon Sep 24, 2022
Proxy / UseProxy is required for apps running on restricted government mobile devices, as the MDM forces the proxy on every allowed devices, and the default .net behavior is to force the use of no proxy (ie: it ignores the system wide proxy set on mobile device).
[Foundation] Implement the server certificate custom validation callb…
Ghostbird commentedon Feb 7, 2023
Even if this isn't immediately merged. Maybe it would be nice to early return some no-op actions?
I had to hunt down a bug today in an iOS app where a class that used HTTP crashed. The weird thing was that the HTTP code itself was definitely not using proxies at all. It said so right at the start where it initialised the
HttpClientHandler:In retrospect this was pretty funny. On iOS proxying is not supported, but not proxying is not supported either. It only works if you use the defaults, which, of course, do not proxy. The unnecessary lines were in shared code originally written for .NET Core 1 in 2017 and removing them made it work. In fact it turned out that the entire constructor of that class could be replaced by instead initialising the
HttpClientmember with= new(). All the work we did there was initialising values, apparently necessary in .NET Core 1, which have since become auto-initialised defaults.3 remaining items
weedcry commentedon Dec 13, 2023
@softlion @rolfbjarne @filipnavara
I am using a proxy for ios in the following way:
Refer to this discussion 86364
Using this method, I have been able to send requests through the proxy server.
Do you think this method is okay? Will there be any impact when the proxy setting of NSUrlSessionHandler is not supported?
[Foundation] Implement NSUrlSessionHandler proxy support. Fixes #14632 (
[release/10.0.1xx] [Foundation] Implement NSUrlSessionHandler proxy s…