Skip to content
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

Merged
merged 10 commits into from
Sep 8, 2022

Conversation

mandel-macaque
Copy link
Member

No description provided.

@mandel-macaque mandel-macaque added the notes-mention Deserves a mention in release notes label Sep 1, 2022
Copy link
Contributor

@tj-devel709 tj-devel709 left a 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!

tests/monotouch-test/Network/NWEndpointTests.cs Outdated Show resolved Hide resolved
src/Network/NWProtocolFramerOptions.cs Outdated Show resolved Hide resolved
src/Network/NWProtocolFramerOptions.cs Outdated Show resolved Hide resolved
src/Network/NWAdvertiseDescriptor.cs Outdated Show resolved Hide resolved
src/Network/NWBrowserDescriptor.cs Outdated Show resolved Hide resolved
src/Network/NWBrowserDescriptor.cs Outdated Show resolved Hide resolved
src/Network/NWEndpoint.cs Show resolved Hide resolved
if (parameters is null)
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (parameters));

InitializeHandle (nw_ethernet_channel_create_with_parameters (ethernetType, networkInterface.Handle, parameters.Handle));
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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:

static public NativeHandle GetNonNullHandle (this INativeObject self, string argumentName)
{
if (self is null)
ThrowHelper.ThrowArgumentNullException (argumentName);

[iOS (16,0)]
[Watch (9,0)]
#endif
public byte StreamType => nw_quic_get_stream_type (GetCheckedHandle ());
Copy link
Member

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

Copy link
Member Author

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 :/

Copy link
Member

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;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed that, thx

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

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
Copy link
Contributor

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?

Copy link
Member Author

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]>
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

Copy link
Member

@dalexsoto dalexsoto left a 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/NWEndpoint.cs Show resolved Hide resolved
if (parameters is null)
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (parameters));

InitializeHandle (nw_ethernet_channel_create_with_parameters (ethernetType, networkInterface.Handle, parameters.Handle));
Copy link
Member

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:

static public NativeHandle GetNonNullHandle (this INativeObject self, string argumentName)
{
if (self is null)
ThrowHelper.ThrowArgumentNullException (argumentName);

[iOS (16,0)]
[Watch (9,0)]
#endif
public byte StreamType => nw_quic_get_stream_type (GetCheckedHandle ());
Copy link
Member

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;

Comment on lines 58 to 59
if (value == IntPtr.Zero)
return null;
Copy link
Member

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

@@ -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);
Copy link
Member

@rolfbjarne rolfbjarne Sep 2, 2022

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.

Copy link
Member

@rolfbjarne rolfbjarne left a 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)

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@mandel-macaque mandel-macaque merged commit 0eef1b6 into xamarin:xcode14 Sep 8, 2022
@mandel-macaque mandel-macaque deleted the netwroking-xcode14 branch September 8, 2022 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notes-mention Deserves a mention in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants