Skip to content

Commit

Permalink
[Foundation] Allow setting NSUrlSessionHandler.Proxy to null (#21140)
Browse files Browse the repository at this point in the history
Before PR:

NSUrlSessionHandler.Proxy property throws NSE when client code set any value (including `null`):

![image](https://github.com/user-attachments/assets/bb273910-3519-490f-b5fd-1999327012b3)

After PR

NSUrlSessionHandler.Proxy property throws NSE only when the client code
tries to set a value different from `null` (Custom proxy is not
supported right now in iOS implementation so setting a value other than
null must throws NSE):

![image](https://github.com/user-attachments/assets/4a564785-3e23-469c-ac26-460d028cf770)

Fixes #21132.

PR originally submitted by @adospace in #21137.

Co-authored-by: adospace <adospace@msn.com>
  • Loading branch information
rolfbjarne and adospace authored Aug 29, 2024
1 parent b1205ce commit bd35d0d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Foundation/NSUrlSessionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,10 @@ public bool PreAuthenticate {
[EditorBrowsable (EditorBrowsableState.Never)]
public IWebProxy? Proxy {
get => null;
set => throw new PlatformNotSupportedException ();
set {
if (value is not null)
throw new PlatformNotSupportedException ();
}
}

// There doesn't seem to be a trivial way to specify the protocols to accept (or not)
Expand Down

7 comments on commit bd35d0d

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

Please # to comment.