-
Notifications
You must be signed in to change notification settings - Fork 514
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
[Network] Add support for Xcode 14 beta 6. #15841
[Network] Add support for Xcode 14 beta 6. #15841
Conversation
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.
A few small things, but LGTM otherwise!
src/Network/NWEthernetChannel.cs
Outdated
if (parameters is null) | ||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (parameters)); | ||
|
||
InitializeHandle (nw_ethernet_channel_create_with_parameters (ethernetType, networkInterface.Handle, parameters.Handle)); |
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.
You can use GetNonNullHandle here instead of manually checking above.
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.
But I need to check nevertheless to throw the exception.
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.
No, GetNonNullHandle
throws the exception:
xamarin-macios/src/ObjCRuntime/INativeObject.cs
Lines 30 to 33 in 7511281
static public NativeHandle GetNonNullHandle (this INativeObject self, string argumentName) | |
{ | |
if (self is null) | |
ThrowHelper.ThrowArgumentNullException (argumentName); |
src/Network/NWProtocolQuicOptions.cs
Outdated
[iOS (16,0)] | ||
[Watch (9,0)] | ||
#endif | ||
public byte StreamType => nw_quic_get_stream_type (GetCheckedHandle ()); |
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.
Looks like this can return an enum
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.
But we do not know the enum values :/
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.
/*
* @result
* Returns the type of the QUIC stream, stored in nw_quic_stream_type_t.
* If the type can not be determined, returns nw_quic_stream_type_unknown.
/**
* @typedef nw_quic_stream_type_t
* @abstract
* Represents the type of a QUIC stream.
*/
typedef enum {
/*! @const nw_quic_stream_type_unknown A QUIC stream whose direction can not be determined. */
nw_quic_stream_type_unknown = 0,
/*! @const nw_quic_stream_type_bidirectional A bidirectional QUIC stream. */
nw_quic_stream_type_bidirectional = 1,
/*! @const nw_quic_stream_type_unidirectional An unidirectional QUIC stream. */
nw_quic_stream_type_unidirectional = 2,
} nw_quic_stream_type_t;
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.
I missed that, thx
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
[DllImport (Constants.NetworkLibrary)] | ||
static extern void nw_framer_options_set_object_value (OS_nw_protocol_options options, string key, NativeHandle value); | ||
|
||
public void SetValue<T> (string key, T? value) where T : NSObject |
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.
If value
is null
won't value.GetHandle
throw a NRE?
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.
GetHandle is an extension that checks if the ptr is null.
Co-authored-by: Rolf Bjarne Kvinge <[email protected]> Co-authored-by: TJ Lambert <[email protected]>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
Just double check your tests results! But looks good so far!
src/Network/NWEthernetChannel.cs
Outdated
if (parameters is null) | ||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (parameters)); | ||
|
||
InitializeHandle (nw_ethernet_channel_create_with_parameters (ethernetType, networkInterface.Handle, parameters.Handle)); |
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.
No, GetNonNullHandle
throws the exception:
xamarin-macios/src/ObjCRuntime/INativeObject.cs
Lines 30 to 33 in 7511281
static public NativeHandle GetNonNullHandle (this INativeObject self, string argumentName) | |
{ | |
if (self is null) | |
ThrowHelper.ThrowArgumentNullException (argumentName); |
src/Network/NWProtocolQuicOptions.cs
Outdated
[iOS (16,0)] | ||
[Watch (9,0)] | ||
#endif | ||
public byte StreamType => nw_quic_get_stream_type (GetCheckedHandle ()); |
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.
/*
* @result
* Returns the type of the QUIC stream, stored in nw_quic_stream_type_t.
* If the type can not be determined, returns nw_quic_stream_type_unknown.
/**
* @typedef nw_quic_stream_type_t
* @abstract
* Represents the type of a QUIC stream.
*/
typedef enum {
/*! @const nw_quic_stream_type_unknown A QUIC stream whose direction can not be determined. */
nw_quic_stream_type_unknown = 0,
/*! @const nw_quic_stream_type_bidirectional A bidirectional QUIC stream. */
nw_quic_stream_type_bidirectional = 1,
/*! @const nw_quic_stream_type_unidirectional An unidirectional QUIC stream. */
nw_quic_stream_type_unidirectional = 2,
} nw_quic_stream_type_t;
if (value == IntPtr.Zero) | ||
return null; |
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.
This IntPtr.Zero check is unnecessary
src/Network/NWProtocolQuicOptions.cs
Outdated
@@ -276,7 +276,7 @@ public SecProtocolOptions SecProtocolOptions | |||
[Watch (9,0)] | |||
#endif | |||
[DllImport (Constants.NetworkLibrary)] | |||
static extern byte nw_quic_get_stream_type (OS_nw_protocol_metadata stream_metadata); | |||
static extern NWQuicStreamType nw_quic_get_stream_type (OS_nw_protocol_metadata stream_metadata); |
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 native function still returns a byte, so it should be declared as such.
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.
Actually this is still an issue: #15841 (review)
No description provided.