xamarin-macios/tests/monotouch-test/Network
Rolf Bjarne Kvinge 85ec17a506
[Network] Improve bindings for NWProtocolMetadata. (#6389)
* [Network] Improve bindings for NWProtocolMetadata.

It turns out the NWProtocolMetadata can contain metadata for different
protocols (Ip/Tls/Tcp). This is important; if someone tries to get a value for
one protocol and the metadata is for another protocol, then they invoke the
wrath of superior beings who will smite that poor someone with uninitialized
memory.

At that point there's not much left but to pray.

I don't like to depend on divine intervention, so I've modified the API here
to check if the metadata's protocol is the required type for the native API
we're calling, and if the check fails, we throw a nice and dependable managed
exception.

This is a functional breaking change; but if there are any lost souls who
likes to pray, they can always re-implement the P/Invokes themselves and skip
the sanity checks.

In addition I've renamed a few properties whose name didn't clearly specify
which protocol type they operate on.

Ref: Apple feedback FB6155967.
Ref: https://trello.com/c/1TW0BSKJ/145-fb6155967-nwipcreatemetadata-returns-uninitialized-metadata-in-ios-13

* Fix casing in exception message.

* [tests] Adjust the SecProtocolMetadataTest according to new knowledge about the Network API.

* Fix alternative property name in obsolete attribute.
2019-06-21 15:00:19 +02:00
..
NWParametersTest.cs [Tests] Add missing tests for NWProtocolStack and fix NWParameters tests. (#4793) 2018-09-12 19:15:33 -04:00
NWPathTest.cs [Tests] Remove IPV6 flaky test with an ignore. (#4815) 2018-09-14 10:05:17 -04:00
NWProtocolMetadataTest.cs [Network] Improve bindings for NWProtocolMetadata. (#6389) 2019-06-21 15:00:19 +02:00
NWProtocolOptionsTest.cs [Network] Small change in NWParameters to use a property for RequiredInterface. (#4742) 2018-09-05 08:07:10 -04:00
NWProtocolStackTest.cs [Tests] Add missing tests for NWProtocolStack and fix NWParameters tests. (#4793) 2018-09-12 19:15:33 -04:00