Граф коммитов

33 Коммитов

Автор SHA1 Сообщение Дата
Manuel de la Pena dcb0c93ab0 [Xcode12] Bring xcode 12 changes into main. 2020-09-23 16:05:22 -04:00
Manuel de la Pena eb9b690fe0 Merge xcode12 into d16-8. 2020-09-18 17:51:52 -04:00
Rolf Bjarne Kvinge 0a5b72d64b [tests] Update attributes in tests according to breaking changes in NUnit[Lite]. 2020-08-03 11:53:17 +02:00
Rolf Bjarne Kvinge 2995cd086a
[tests] Update tests to make native type vs normal type comparison explicit (#9097)
We've modified our NUnitLite to special-case the native types, so that they
can easily be compared with the standard types, but that doesn't work anymore
when switching to the official NUnit[Lite], so change all asserts to
explicitly convert whenever needed.
2020-07-17 08:48:09 +02:00
Rolf Bjarne Kvinge 3ac93d2330
[monotouch-test] Comparing uint to int for inequality doesn't work newer versions of NUnit[Lite]. (#9094)
So make sure we pass two values of the same type to Assert.AreNotEqual.
2020-07-16 08:19:01 +02:00
Sebastien Pouliot 66ae40a442
[tests][monotouch-test] Re-enable some tests with beta 2 (#9042)
Some issues we detected in beta 1 are not present in beta 2
https://github.com/xamarin/xamarin-macios/issues/8943
2020-07-09 08:53:56 -04:00
Sebastien Pouliot f427b5e91d
[xcode12] Bump for beta 1 (#8935)
Known issues https://github.com/xamarin/xamarin-macios/issues/8943
2020-06-26 14:02:44 -04:00
Rolf Bjarne Kvinge 952037b7a3
[tests] Remove Classic code from all tests. (#8707) 2020-05-29 16:43:06 +02:00
Rolf Bjarne Kvinge 2b2f1d08dc
[tests] Remove Classic code from all tests. (#8702) 2020-05-28 16:35:09 +02:00
Rolf Bjarne Kvinge eeff89f895
[monotouch-test] Improve NWBrowserTest.TestStateChangesHandler to not assert on background threads. (#8022)
Asserts will throw an exception when the assert fails, which will crash the
app if it happens on a background thread. So marshal any exceptions to the
main thread.

Solves this (by turning it into a normal NUnit assert failure):

    Unhandled Exception:
    NUnit.Framework.AssertionException:   newResult first run
      Expected: null
      But was:  <Network.NWBrowseResult>
    2020-02-28 19:47:41.214499-0500 monotouchtest[46412:20292304] Unhandled managed exception:   newResult first run
      Expected: null
      But was:  <Network.NWBrowseResult>
     (NUnit.Framework.AssertionException)

    =================================================================
    	Native Crash Reporting
    =================================================================
    Got a SIGABRT while executing native code. This usually indicates
    a fatal error in the mono runtime or one of the native libraries
    used by your application.
    =================================================================

    =================================================================
    	Native stacktrace:
    =================================================================
    	0x107c028c5 - /Users/builder/Library/Developer/CoreSimulator/Devices/E7C088E5-575C-42B7-ADFB-8144438C78A5/data/Containers/Bundle/Application/E3172E17-F6D2-4BC0-8770-379689518F78/monotouchtest.app/monotouchtest : mono_dump_native_crash_info
    	0x107bf6f85 - /Users/builder/Library/Developer/CoreSimulator/Devices/E7C088E5-575C-42B7-ADFB-8144438C78A5/data/Containers/Bundle/Application/E3172E17-F6D2-4BC0-8770-379689518F78/monotouchtest.app/monotouchtest : mono_handle_native_crash
    	0x107c01f1b - /Users/builder/Library/Developer/CoreSimulator/Devices/E7C088E5-575C-42B7-ADFB-8144438C78A5/data/Containers/Bundle/Application/E3172E17-F6D2-4BC0-8770-379689518F78/monotouchtest.app/monotouchtest : sigabrt_signal_handler
    	0x7fff40be642d - /Applications/Xcode113.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_platform.dylib : _sigtramp
    	0x7ff295501cb0 - Unknown
    	0x7fff40ad6a1c - /Applications/Xcode113.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_c.dylib : abort
    	0x107e3d33f - /Users/builder/Library/Developer/CoreSimulator/Devices/E7C088E5-575C-42B7-ADFB-8144438C78A5/data/Containers/Bundle/Application/E3172E17-F6D2-4BC0-8770-379689518F78/monotouchtest.app/monotouchtest : xamarin_unhandled_exception_handler.cold.1
    	0x107e30c09 - /Users/builder/Library/Developer/CoreSimulator/Devices/E7C088E5-575C-42B7-ADFB-8144438C78A5/data/Containers/Bundle/Application/E3172E17-F6D2-4BC0-8770-379689518F78/monotouchtest.app/monotouchtest : xamarin_unhandled_exception_handler
    	0x107cb7525 - /Users/builder/Library/Developer/CoreSimulator/Devices/E7C088E5-575C-42B7-ADFB-8144438C78A5/data/Containers/Bundle/Application/E3172E17-F6D2-4BC0-8770-379689518F78/monotouchtest.app/monotouchtest : mono_invoke_unhandled_exception_hook
    	0x107bf69ea - /Users/builder/Library/Developer/CoreSimulator/Devices/E7C088E5-575C-42B7-ADFB-8144438C78A5/data/Containers/Bundle/Application/E3172E17-F6D2-4BC0-8770-379689518F78/monotouchtest.app/monotouchtest : mono_handle_exception_internal
    	0x107bf4ed9 - /Users/builder/Library/Developer/CoreSimulator/Devices/E7C088E5-575C-42B7-ADFB-8144438C78A5/data/Containers/Bundle/Application/E3172E17-F6D2-4BC0-8770-379689518F78/monotouchtest.app/monotouchtest : mono_handle_exception
    	0x107b76019 - /Users/builder/Library/Developer/CoreSimulator/Devices/E7C088E5-575C-42B7-ADFB-8144438C78A5/data/Containers/Bundle/Application/E3172E17-F6D2-4BC0-8770-379689518F78/monotouchtest.app/monotouchtest : mono_amd64_throw_exception
    	0x1085c95b0 - Unknown
    	0x107e30a25 - /Users/builder/Library/Developer/CoreSimulator/Devices/E7C088E5-575C-42B7-ADFB-8144438C78A5/data/Containers/Bundle/Application/E3172E17-F6D2-4BC0-8770-379689518F78/monotouchtest.app/monotouchtest : xamarin_process_managed_exception
    	0x107bf671e - /Users/builder/Library/Developer/CoreSimulator/Devices/E7C088E5-575C-42B7-ADFB-8144438C78A5/data/Containers/Bundle/Application/E3172E17-F6D2-4BC0-8770-379689518F78/monotouchtest.app/monotouchtest : mono_handle_exception_internal
    	0x107bf4ed9 - /Users/builder/Library/Developer/CoreSimulator/Devices/E7C088E5-575C-42B7-ADFB-8144438C78A5/data/Containers/Bundle/Application/E3172E17-F6D2-4BC0-8770-379689518F78/monotouchtest.app/monotouchtest : mono_handle_exception
    	0x107b76019 - /Users/builder/Library/Developer/CoreSimulator/Devices/E7C088E5-575C-42B7-ADFB-8144438C78A5/data/Containers/Bundle/Application/E3172E17-F6D2-4BC0-8770-379689518F78/monotouchtest.app/monotouchtest : mono_amd64_throw_exception
    	0x1085c95b0 - Unknown
    	0x11aed4ceb - Unknown
    	0x7fff3fa7ecfe - /Applications/Xcode113.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libnetwork.dylib : nw_parallel_array_apply_with_range
    	0x7fff3f975077 - /Applications/Xcode113.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libnetwork.dylib : __nw_browser_notify_browse_result_changes_locked_block_invoke.100
    	0x7fff409c9848 - /Applications/Xcode113.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_call_block_and_release
    	0x7fff409ca7b9 - /Applications/Xcode113.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_client_callout
    	0x7fff409d9d69 - /Applications/Xcode113.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_root_queue_drain
    	0x7fff409da39b - /Applications/Xcode113.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_worker_thread2
    	0x7fff40bee6b6 - /Applications/Xcode113.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_pthread.dylib : _pthread_wqthread
    	0x7fff40bed827 - /Applications/Xcode113.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_pthread.dylib : start_wqthread
2020-03-02 17:27:27 +01:00
Alex Soto 9ac17bdbcf
Merge remote-tracking branch 'xamarin/xcode11.3' into master-xcode11.3 2019-12-17 19:25:11 -05:00
Jo Shields 5d4ada34c7 Bump to mono:2019-10 (#7192)
## Miscellaneous fixes

* Fixed
`/Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/OutputStep.cs(110,15): error CS0246: The type or namespace name ‘OutputException’ could not be found (are you missing a using directive or an assembly reference?) [/Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mmp/mmp.csproj]`
* Changed the name of the method that is used from linker. Because of this commit 6be26771b9
* Added `OutputException.cs` file on `mtouch.csproj`.
* Removing enter_gc_safe and exit_gc_safe because now it's already gc_safe in this part of code, after a mono change.
* Added known exceptions to LLVM exception list.
* Needs `ifdef` because of this https://github.com/mono/mono/pull/17260.
* Bump MIN_MONO_VERSION to 6.8.0.41 and point MIN_MONO_URL to the PR.
* Add ENABLE_IOS=1 and ENABLE_MAC=1.
* Added switch to disable packaged mono build
* [Tests] Ignore tests that fail on 32b.
    Ignore the test on 32b, and filled issue: https://github.com/mono/mono/issues/17752
* [Tests] Ignore a couple of tests causing OOM.
    Hopefully fixes https://github.com/xamarin/maccore/issues/1659 for good.
* Ignore `MM0135` test on Catalina+ because it needs Xcode 9.4.
* [monotouch-test] Add null checks for teardown when test didn't run because of a too early OS version.
* [CFNetwork]: Http 2.0 requires OS X 10.11 or later.
    Check whether `_HTTPVersion2_0` is available and fallback to HTTP 1.1 otherwise.

## Bring HttpClient from CoreFX

* #7346 
* This bumps Mono to use https://github.com/mono/mono/pull/17645 (which is the 2019-10 backport
of https://github.com/mono/mono/pull/17628).
* The big user-visible change is in regards to certificate validation, everything below are just
some minor adjustments to tests.

### SocketsHttpHandler

CoreFX uses a completely new `HttpClientHandler` implementation called `SocketsHttpHandler`,
which you can find at https://github.com/dotnet/corefx/tree/release/3.0/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler.

Since this is not based on the web stack anymore, it does not use any of the related APIs such
as `ServicePointManager` or `WebException`.

### Certificate Validation Changes

There is a new API called `HttpClientHandler.ServerCertificateCustomValidationCallback`.
- https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclienthandler.servercertificatecustomvalidationcallback?view=netframework-4.8
- c1778515a3/src/System.Net.Http/src/System/Net/Http/HttpClientHandler.Unix.cs (L154)
- c1778515a3/src/System.Net.Http/src/System/Net/Http/HttpClientHandler.Windows.cs (L383)

The `ServicePointManager.ServerCertificateValidationCallback` is no longer invoked and on
certificate validation failure, `AuthenticationException` (from `System.Security.Authentication`)
is thrown instead of `WebException`.

At the moment, the `NSUrlSessionHandler` still uses it's own validation callback and also still
throws `WebException` on failure; we should probably look into making this consistent with the
other handlers.

### Minor adjustments related to internal Mono APIs

* `HttpContent.SerializeToStreamAsync()` is now `protected` (changed from `protected internal`).
  - src/Foundation/NSUrlSessionHandler.cs: changed overload accordingly.
  - src/System.Net.Http/CFContentStream.cs: likewise.

* `HttpHeaders.GetKnownHeaderKind()` is an internal Mono API.
   There is a new internal API called `System.Net.Http.PlatformHelper.IsContentHeader(key)`
   which exists in both the old as well as the new implementation.
   The correct way of doing it with the CoreFX handler is
   `HeaderDescriptor.TryGet (key, out var descriptor) && descriptor.HeaderType == HttpHeaderType.Content`

### Minor adjustments to tests.

* `HttpClientHandler.MaxRequestContentBufferSize` is now longer supported, you can set it to
  any non-negative value, the getter will always return 0.
  See c1778515a3/src/System.Net.Http/src/System/Net/Http/HttpClientHandler.Core.cs (L18).
  - tests/linker/ios/link sdk/HttpClientHandlerTest.cs: removed assertion from test.

* `HttpMessageInvoker.handler` is a `protected private` field - in the CoreFX handler, it is
  called `_handler` and `private`.  This is accessed via reflection by some of the tests, which are
  now using the new name.
  - tests/mmptest/src/MMPTest.cs: here
  - tests/mtouch/MTouch.cs: here

* tests/monotouch-test/System.Net.Http/MessageHandlers.cs:
  Adjust `RejectSslCertificatesServicePointManager` to reflect the certificate validation
  changes described above.
  - FIXME: There was an `Assert.Ignore()` related to `NSUrlSessionHandler` and macOS 10.10;
    I removed that to reenable the test because the description linked to an old issue in
    the private repo that was referenced by several "Merged" PR's, so it looked to me that
    this might have already been fixed - and I also didn't see why it would fail there.
2019-12-04 15:10:32 -05:00
Manuel de la Pena 8abcd9c60c
[Network] Add missing BindingImplAttr. (#7530)
Fixes: https://github.com/xamarin/xamarin-macios/issues/7513
2019-12-04 11:41:29 -05:00
Manuel de la Pena d83e9687a6
[Tests] Centralized the endpoints for the different network tests. (#7418)
Use a single point where the different enpoints can be found so that
if they need to be updated (server issues or other) it is a simple
change that will affect all tests in monotouch-tests
2019-11-14 05:45:33 -05:00
Vincent Dondain a558d84457 Merge branch 'xcode11.2' into master-merge-xcode11.2 2019-11-05 15:25:49 -05:00
Vincent Dondain ec3c01d131 Merge branch 'xcode11.2' into d16-4-xcode11.2-merge 2019-11-01 17:11:44 -04:00
Manuel de la Pena 957572720e
[Tests] Fix some network tests that were leaving the connection in a bad (#7337)
state.

Some of the tests were creating connections when not needed, this
'apparetly' was leaving the internal state of the Networking API in a
bad state in which it would throw a SIGSEGV and will make the connection
of other tests fail. In this case, the Tls tests that use the Network
API.

Cleaning the tests and removing those badly managed connections ensured
that the SIGSEGV would not be thrown and got all the other tests to
work.

This is a blackbox, test now passes without problems.

Fixes: https://github.com/xamarin/maccore/issues/2048
2019-10-30 15:07:28 -04:00
Manuel de la Pena 610cefaf1e
[Tests] Fix the Network tests. (#7293)
* [Tests] Fix the Network tests.

The pattern used to Cancel then Dispose the connection is wrong and
ended up crashing the tests sometimes. It is a race condition and is
very rare, but makes the tests flaky. The changes ensures that we
Dispose the connection, which internally closes it.

Tests have been added for the NWConnection Close calls.

Also cleaned some on the CWL that were not needed.
2019-10-28 14:50:44 -04:00
Manuel de la Pena e1c12bba11
[Network] Add NWFramerMessage implementation. (#7256)
Add a missing object for the type.

Co-Authored-By: Rolf Bjarne Kvinge <rolf@xamarin.com>
2019-10-24 10:40:54 -04:00
Rolf Bjarne Kvinge 4d8ec5d531
[Network] Fix NWTxtRecord.Apply. Fixes xamarin/maccore#2036. (#7281)
The block/delegate passed to NWTxtRecord.Apply is supposed to return a bool.
Not returning anything ends up with random behavior, which causes a test
failure on Catalina:

   3) TestApply (MonoTouchFixtures.Network.NWTxtRecordTest.TestApply)
        keycount
     Expected: 4
     But was:  1

     at MonoTouchFixtures.Network.NWTxtRecordTest.TestApply () [0x000a3] in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/monotouch-test/Network/NWTxtRecordTest.cs:134
     at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
     at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/external/mono/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:395

I've fixed the existing API to return 'true' always in the block callback, to
get consistent behavior, and in addition I've added a new overload that takes
a delegate that returns a bool, which allows the consumer of the API to decide
what to return.

Fixes https://github.com/xamarin/maccore/issues/2036.
2019-10-23 23:25:27 +02:00
Manuel de la Pena 20df742564
[Network] Cleanup the NWProtocolMetadata. (#7270)
Co-Authored-By: Rolf Bjarne Kvinge <rolf@xamarin.com>
2019-10-22 23:49:51 +02:00
Manuel de la Pena a50ec24e4a
[Network] Clean up the protocol options class. (#7196)
Add classes for each of the protocol types. Deprecated the old methods.
2019-10-18 04:04:41 +02:00
Manuel de la Pena 4cff2bc4e3
[Networking] Improve the NWBrowser API. (#7214)
Kept the API as it was but added a new handler that will be called when
all the changes from the browser have been done. The old Set* method
could be deleted in a future release and just expose the property.
2019-10-15 14:31:31 -04:00
Manuel de la Pena e37549bc90
[Networking] Bring the framework up to Xcode 11.1 (#7091)
Add most of the new classes for Networking on Xcode11.1
2019-10-07 21:53:04 -04:00
Rolf Bjarne Kvinge 303aa0a649 Merge remote-tracking branch 'origin/xcode11' into master-xcode11 2019-09-13 18:35:18 +02:00
Waleed Chaudhry d4a775d8a3
[Network] Add currentPath property to NWPathMonitor. Fixes #5603. (#6931)
* Add currentPath property to NWPathMonitor. Fixes #5603.
2019-09-11 13:00:55 -04:00
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
Manuel de la Pena 422da1f8d4 [Tests] Remove IPV6 flaky test with an ignore. (#4815) 2018-09-14 10:05:17 -04:00
Manuel de la Pena eeca0b8780 [Tests] force the IP version to fix tests on bots. (#4805) 2018-09-13 14:13:21 -04:00
Manuel de la Pena bed3770bae [Tests] Add missing tests for NWProtocolStack and fix NWParameters tests. (#4793) 2018-09-12 19:15:33 -04:00
Sebastien Pouliot 2c8f882896
[security] SecProtocolMetadata update and tests (#4792)
* Avoid `ArgumentNullException` in default/empty `SecProtocolMetadata.PeerPublicKey`
* Add two `SecProtocolMetadata.CreateSecret` API - disabled as the current tests (incomplete?) crash in unit tests
* Add basic unit tests for `[Sec|NW]ProtocolMetadata`
* Update xtro
2018-09-12 13:07:10 -04:00
Manuel de la Pena e43ca080c7
[Tests] Add missing tests for NWPath. (#4765) 2018-09-12 12:35:40 +02:00
Manuel de la Pena fb9ae90937 [Network] Small change in NWParameters to use a property for RequiredInterface. (#4742)
Added missing tests. Also modified the Interface property in
NWParameters and fix a small typo in NWProtocolMetadata.
2018-09-05 08:07:10 -04:00