Skip to content

Commit 77a9250

Browse files
authored
[foundation] Fix possible abort when using NSUrlSessionHandler. Fix #50891 (#1451) (#1452)
PR 1435 did not fix bug #50891. The default (native) implementation till get called and abort the process. The right way to solve this is to override the members (easier now that it's not internal anymore) and return `false` (or `null`) so the caller (the OS) knows it's not supported (that's fine) references: * https://bugzilla.xamarin.com/show_bug.cgi?id=50891 * #1435
1 parent 7e46164 commit 77a9250

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/Foundation/NSUrlSessionHandler.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,17 @@ protected override bool GetBuffer (out IntPtr buffer, out nuint len)
611611
return base.GetBuffer (out buffer, out len);
612612
}
613613

614+
// NSInvalidArgumentException Reason: *** -propertyForKey: only defined for abstract class. Define -[System_Net_Http_NSUrlSessionHandler_WrappedNSInputStream propertyForKey:]!
615+
protected override NSObject GetProperty (NSString key)
616+
{
617+
return null;
618+
}
619+
620+
protected override bool SetProperty (NSObject property, NSString key)
621+
{
622+
return false;
623+
}
624+
614625
protected override bool SetCFClientFlags (CFStreamEventType inFlags, IntPtr inCallback, IntPtr inContextPtr)
615626
{
616627
// Just call the base implementation, which knows how to handle everything.

0 commit comments

Comments
 (0)