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

7495 Коммитов

Автор SHA1 Сообщение Дата
Manuel de la Pena 002b4dffd2
[xharness] Support the split of test assemblies from the BCL. (#7625)
Some of the test assemblies are too large and will be splitted by mono so
that they can be compiled for iOS 32b. In that case, we are using the
following pattern

`
test_assembly_name.dll
`
becomes
`
test_assembly_name.part1.dll
test_assembly_name.part2.dll
`
Perse the only change we need to add to make our life easier is to be
able to mantain a single .ignore file since mantaining more .ignore
files is hard and more error prone. This change simply checks if we are
working with a splitted dll and ensures that the correct .ignore files
are added to the BCL test application.

Co-Authored-By: Pramit Mallick <prmallic@microsoft.com>
2019-12-19 09:29:43 -05:00
Rolf Bjarne Kvinge cf97aaf971
[msbuild] Don't use gdk-sharp, use native functions instead. (#7623)
* [msbuild] Don't use gdk-sharp, use native functions instead.

There's no netstandard version of gdk-sharp.

* Don't require the source checkout to be named 'xamarin-macios'.
2019-12-19 15:21:09 +01:00
Alex Soto 01f6710a15
Merge pull request #7620 from dalexsoto/master-xcode11.3
[master] Merge Xcode 11.3 into master
2019-12-18 18:52:20 -05:00
Rolf Bjarne Kvinge 6ceb45c9fc
Merge pull request #7611 from rolfbjarne/msbuild-use-system-text-json
[msbuild] Use System.Text.Json instead of System.Json, since only the former is available in .netcore.
2019-12-19 00:35:04 +01:00
Rolf Bjarne Kvinge 3d465f4149
[msbuild] Use mono's coding style. (#7622) 2019-12-18 19:20:16 +01:00
Alex Soto d527862915
[xharness] Fix ExecuteCommandAsync args parameter 2019-12-18 12:19:22 -05:00
Marius Ungureanu fb9bc22d06 GetParameters should _never_ return null (#7554) 2019-12-18 11:40:13 -05:00
Marius Ungureanu 3386acb6ea Switch to Array.Empty and use Marshal.Copy instead of manual copying (#7559)
Switch to Array.Empty and use Marshal.Copy instead of manual copying


Co-Authored-By: Rolf Bjarne Kvinge <rolf@xamarin.com>
2019-12-18 11:39:29 -05:00
Marius Ungureanu 7b1049cf24 Wrap some objects in using statements (#7560)
* Wrap some objects in using statements

* Switch to using statement.
2019-12-18 11:28:23 -05:00
Rolf Bjarne Kvinge 8c589c0093
[msbuild] Remove unused file. (#7610) 2019-12-18 07:15:49 +01:00
Alex Soto 28f8313b1b
Use the latest mono 2019-10 to get Xcode11.3 binaries 2019-12-17 19:36:07 -05:00
Alex Soto 9ac17bdbcf
Merge remote-tracking branch 'xamarin/xcode11.3' into master-xcode11.3 2019-12-17 19:25:11 -05:00
Manuel de la Pena 867dcfaa77
[Tests] Split groups so that they work on iOS 32b. (#7612)
After this commit we will have more application but they will be the
appropiate size so that they can be built with the linker for iOS 32b.
It is important to note that the following apps WILL CONTINUE to fail
since the dlls need to be splitted in mono:

* mscorlib tests
* Mono BCL tests group 5 - Which is monotouch_System.Core_xunit-test.dll
and is too large.
2019-12-17 17:09:28 -05:00
monojenkins aaafa2df6f [xharness] Don't try to parse log files that don't exist. (#7614)
Makes xharness throw fewer exceptions, which makes tracing output simpler to read.
2019-12-17 17:04:00 -05:00
monojenkins a6c714fa84 [xcode11.3] [monotouch-test] Simplify NetworkReachabilityTest.CtorIPAddressPair test. (#7613)
* [monotouch-test] Improve reachability test.

Tested on:

* All macOS versions we support (10.9 -> 10.15).
* tvOS device: 13.2
* iOS devices: 8.2, 9.3.5, 10.3.3, 11.4.1, 12.4.1, 13.3
* iOS simulators: 10.3, 11.0, 12.0, 13.2.
* tvOS simulators: 10.2, 13.2

* Yay Apple!

* Give up.

* Revert unneeded change.
2019-12-17 16:07:22 -05:00
Rolf Bjarne Kvinge 015cbf1efc [msbuild] Use faster string comparison (OrdinalIgnoreCase). 2019-12-17 18:55:16 +01:00
Rolf Bjarne Kvinge ca88b95c0e [msbuild] Tell ILRepack where netstandard.dll can be found.
System.Text.Json references netstandard.dll, and ILRepack needs to be able to find it.
2019-12-17 11:34:27 +01:00
Rolf Bjarne Kvinge 0d299e0eb8 [msbuild] Calculate assemblies to be IL merged differently.
We now need to merge System.Text.Json into the final assembly, which means all
the System.Text.Json dependencies as well (there are quite a few), so adjust
the logic to figure out which assemblies to be merged to include every
library, except:

* MSBuild assemblies
* Resource assemblies
* System assemblies.
2019-12-17 11:34:24 +01:00
Rolf Bjarne Kvinge b7a50608f6 [msbuild] Adjust the Bug60536 test so that it continues to fail as expected after switching json parser.
The Bug60536 is about showing a good error message if the json in an asset
pack is invalid. It turns out that System.Text.Json is a bit more permissive
than System.Json, so the json that was previously failing to parse is now
parsing fine [1]. So introduce something that is certainly invalid json
everywhere, and update the test itself as well to cope with different error
message and error location.

Also remove workaround for xbuild in this test, since xbuild isn't used anymore.

[1]: Technically the json is still invalid, because according to the json spec
it's not valid to end a list of array elements with a trailing comma. The
problem is that System.Json would in some cases allow trailing commas for
lists of array elements, and sometimes not, which means that we have to ask
System.Text.Json to allow trailing commas as well. And when System.Text.Json
is asked to allow trailing commas, it also successfully parses a case of
trailing comma where System.Json didn't, thus the need for coming up with
something even more invalid.
2019-12-17 11:28:42 +01:00
Rolf Bjarne Kvinge a1acbd7d0d [msbuild] Use System.Text.Json instead of System.Json, since only the former is available in .netcore. 2019-12-17 11:28:11 +01:00
Rolf Bjarne Kvinge 32cd69d274 [msbuild] Split long exec command over multiple lines.
Makes it easier to understand what's happening when new arguments are added
(and easier to add comments to specific arguments).
2019-12-17 11:17:01 +01:00
Manuel de la Pena cfd8c7a20b
[Tests] Improve error when we have network issues in ImageCaptioningTest.GetCaption (#7591)
The error does give a description letting us know that the url was
invalid, that is, we could not reach it.

Fixes: https://github.com/xamarin/maccore/issues/2088
2019-12-16 22:07:22 -05:00
Manuel de la Pena 746d52ef51
[Tests] Ensure that if the TCP connection cannot be done, test are run. (#7605)
TouchUnit uses Console.Out as the writer when the TCP connection cannot
be performed. The BCL tests were not doing so and were crashing.

With this change, when ran locally, if the TCP connection is not done,
we will use Console.Out as TouchUnit and the file will be parsed by
xharness correctly.
2019-12-16 22:05:20 -05:00
Alex Soto 2bb244fcb0
Merge pull request #7600 from dalexsoto/xcode11.3-d16-4
[xcode11.3] Merge d16-4 into xcode11.3
2019-12-16 21:03:29 -05:00
Rolf Bjarne Kvinge c422869c4b
[msbuild] Update tests to NUnit 3.12. (#7597)
Updating the msbuild tasks to use netstandard2.0 requires us to bump NUnit to 3+.

This requires:

* A few code changes due to breaking API changes in NUnit.
* Changes in xharness and a makefile to cope with the new location for the
  NUnit console runner (I added a helper script to make things slightly
  easier).
2019-12-16 23:55:59 +01:00
Rolf Bjarne Kvinge d5135cce25
[msbuild] Update to latest ILRepack. (#7594)
The latest ILRepack has fixes for netstandard we'll need.

Also use package references.
2019-12-16 19:06:25 +01:00
Rolf Bjarne Kvinge 3f84883ebf
[msbuild] Remove xbuild-specific code since we don't support building with xbuild anymore. (#7601) 2019-12-16 19:05:40 +01:00
Rolf Bjarne Kvinge 0ea29935b4
[msbuild] Remove unused files. (#7599) 2019-12-16 19:04:41 +01:00
Sebastien Pouliot 2c8cc9bd43
[test][monotouch-test] Fix crash on old iOS8 32bits devices (#7595)
```
20:11:28.9562500 2019-12-12 20:11:48.058 monotouchtest[873:239608] Xamarin.iOS: Received unhandled ObjectiveC exception: NSInvalidArgumentException *** -[AVCaptureMetadataOutput setMetadataObjectTypes:] - unsupported type found.  Use -availableMetadataObjectTypes.
20:11:29.0542980 2019-12-12 20:11:48.154 monotouchtest[873:239608]
20:11:29.0543360 Unhandled Exception:
20:11:29.0543440 0   libmonosgen-2.0.dylib               0x04d53c45 setup_stack_trace + 188
20:11:29.0543500 1   libmonosgen-2.0.dylib               0x04d51df9 mono_handle_exception_internal + 2120
20:11:29.0543560 2   libmonosgen-2.0.dylib               0x04d515ad mono_handle_exception + 50
20:11:29.0543620 3   libmonosgen-2.0.dylib               0x04d47de9 mono_arm_throw_exception + 132
20:11:29.0543690 4   libmscorlib.dll.dylib               0x01570648 throw_exception + 72
...
```

Fixes https://github.com/xamarin/maccore/issues/2091
2019-12-16 08:57:57 -05:00
Alex Soto e98a9440ca
Merge remote-tracking branch 'xamarin/d16-4' into xcode11.3-d16-4 2019-12-15 19:36:45 -05:00
Alexander Köplinger 7bc1903f80 Bump mono to latest 2019-10 (#7574)
New commits in mono/mono:

* mono/mono@9bcfa60312 [2019-10] Bump msbuild to track mono-2019-10 (#18132)
* mono/mono@e6cd9a15cd [2019-10] [mini] Fix delegate trampoline virtual call via delgate Invoke (#18115)
* mono/mono@7c95e4bc48 [debugger] skip suspend for unattached threads (#18111)
* mono/mono@77147e7526 [2019-10] Bump msbuild+roslyn to track mono-2019-10 (#18093)
* mono/mono@d7337e5beb Bump to mono/corefx@f3815a9 (#18104)
* mono/mono@6ac11972db [2019-10] [threads] Add back mono_threads_attach_tools_thread as a public API (#18075)
* mono/mono@b687667619 Bump corefx to pick up https://github.com/mono/corefx/pull/370 (#18068)
* mono/mono@da605d8081 Remove DNS lookups of the local hostname in tests (#18059)
* mono/mono@a6e867fe96 Bump msbuild to track mono-2019-10 (#18045)
* mono/mono@3387bd4a26 Bump bockbuild to get https://github.com/mono/bockbuild/pull/136
* mono/mono@5dd74a60e8 Fix side effect.
* mono/mono@a36f07c803 Fix DIM in a generic interface. Fixes #17869
* mono/mono@08e5a9751a Bump msbuild to track mono-2019-10 (#18014)
* mono/mono@56a583ea5c [2019-10] [profiler] disable inlining when coverage profiler is used and fix allocation sizes (#17991)
* mono/mono@914ffea421 [sgen] Don't trigger collections during allocation of thread objects (#17997)

Diff: 18920a83f4..9bcfa60312
2019-12-13 11:59:16 -05:00
monojenkins 380ad56e4d [introspection] Update according to changes that seem to have occurred in macOS 10.15.2. (#7592) 2019-12-13 10:22:16 -05:00
Sebastien Pouliot 144c193332
Revert "[mtouch] Fix caching issues. Fix #7514 (#7544)" (#7589)
This reverts commit b3bc04c919.
2019-12-12 18:01:29 -05:00
monojenkins b0f99834b9 [runtime] Don't zero-terminate after the string buffer. Fixes #7564. (#7585)
Fixes https://github.com/xamarin/xamarin-macios/issues/7564.
2019-12-12 16:31:59 -05:00
Rolf Bjarne Kvinge 9b30d7016a
[xharness] Don't try to parse log files that don't exist. (#7583)
Makes xharness throw fewer exceptions, which makes tracing output simpler to read.
2019-12-12 19:13:19 +01:00
Rolf Bjarne Kvinge a6d2ebddfd
[monotouch-test] Simplify NetworkReachabilityTest.CtorIPAddressPair test. (#7546)
* [monotouch-test] Improve reachability test.

Give up.

Different versions of OSes report different flags. Trying to
figure out which OS versions have which flags set turned out to
be a never-ending game of whack-a-mole, so just don't assert
that any specific flags are set.
2019-12-12 07:57:23 +01:00
Rolf Bjarne Kvinge 1ae28bf034
[introspection] Update according to changes that seem to have occurred in macOS 10.15.2. (#7567) 2019-12-12 07:28:23 +01:00
Manuel de la Pena 3f0985ecac
[Runtime] Move some of the changes back to int. (#7529)
Some of the fixes done for the warnings have breaking changes. Move back
to int and ensure that we do not have any compilation errors (we are
using -Werror).

Fixes: https://github.com/xamarin/xamarin-macios/issues/7509
2019-12-11 22:17:29 -05:00
Marius Ungureanu 3c4cdef538 Set LangVersion in order to be able to build from an IDE (#7552) 2019-12-11 17:10:16 -05:00
Marius Ungureanu da8ef25e0c ArgumentNullException allows passing null as message parameter (#7556) 2019-12-11 17:09:13 -05:00
Marius Ungureanu 035dcd0012 Move pinning outside the loop (#7557) 2019-12-11 17:08:56 -05:00
Rolf Bjarne Kvinge 3f069f4378
[runtime] Don't zero-terminate after the string buffer. Fixes #7564. (#7571)
Fixes https://github.com/xamarin/xamarin-macios/issues/7564.
2019-12-11 19:31:15 +01:00
Alex Soto fc51536ced
[xcode11.3] Bump version number now that Xcode 11.3 is out (#7573) 2019-12-11 12:31:55 -05:00
Vincent Dondain 889705c2ee Bump for Xcode 11.3 final (#7568) 2019-12-11 09:11:17 +01:00
Oleg Demchenko 7cfbe40bcb
Merge pull request #7533 from xamarin/olegoid/vsts-1029041
[vsts-1029041] Add FileType to the list of parameters for altool
2019-12-10 11:56:44 -05:00
Sebastien Pouliot ff2d5bb94f
[mtouch][mmp] Include satellite assemblies from nuget dependencies. Fix #7113 (#7548)
It's possible for a nuget to have dependencies that will bring satellite
assemblies into a project.

When doing so the satellite assemblies are copied to the right output
(e.g. `Debug`) directory, so they work fine at runtime. However it's
not 100% fine at build time, e.g. msbuild won't detected them as
satellite assemblies.

Something similar happens with `mtouch` (and `mmp`) since the satellite
assemblies won't be found inside a (culture-named) subdirectory from the
original assembly location. In our case this means the assemblies won't
be copied into the .app bundle (since we don't run from `Debug`) and
localization won't work properly.

The solution is to check for both the (culture-named) subdirectories
from the assembly location (like before) and, if nothing is found, also
try to locate them in the _build_ (like `Debug`) directory - so if
something else (nuget or custom build scripts) tried to outsmart the
build logic then we'll still bring those satellite assemblies in the
app bundle we produce.

https://github.com/xamarin/xamarin-macios/issues/7113
2019-12-10 09:23:31 -05:00
Rolf Bjarne Kvinge 9fe358650b
Use relative paths in scripts. (#7545)
It makes relocating XI/XM easier.
2019-12-10 12:47:30 +01:00
Sebastien Pouliot b3bc04c919
[mtouch] Fix caching issues. Fix #7514 (#7544)
The nice, repeatable test case from #7514 pointed out two issues

1. `cache.cs` ignored some changes

It looks like something changed (at some point) and the first _ignored_
line was the `@x.rsp` our response file - which should not be ignored.

This solved the build issue where updating the nuget should have
triggered a rebuild because
> /Users/poupou/.nuget/packages/skiasharp/1.68.0/lib/Xamarin.iOS/SkiaSharp.dll
and
> /Users/poupou/.nuget/packages/skiasharp/1.68.1/lib/Xamarin.iOS/SkiaSharp.dll
are different assemblies (but the same response file).

2. `copyfile` could fail silently

Copying the framework could fail (error 260) and the failure was never
reported so the build succeeded - but without updating (completely) the
framework.

The exact reason it fails is unknown :( but we can recover from it by
deleting the target and copying (everything) back to the expected
(target) location.

Build logs will now indicate when this fails and will try to recover
before reporting a build error. Best case it works :) worse case we'll
be aware something is wrong (which is better than ignoring)

ref: https://github.com/xamarin/xamarin-macios/issues/7514

* Do not call `Marshal.GetLastWin32Error` instead the callback
as the `SetLastError` logic has yet to be executed so we get a bogus
`260` value...

Instead we call it after the `copyfile` call returns but, at this stage,
the callback (i.e. **us**) signaled an error so what we get back (`17`)
is not very helpful - as we aborted (Quit) the logic when copying a file
that existed.

```c
#define EEXIST          17      /* File exists */
```

from Console logs

```
default	14:23:54.771292-0500	mono64	Cannot make directory /Users/poupou/Projects/gh7514/gh7514/bin/iPhoneSimulator/Debug/gh7514.app/Frameworks/libSkiaSharp.framework: File exists
default	14:23:54.771620-0500	mono64	Cannot make directory /Users/poupou/Projects/gh7514/gh7514/bin/iPhoneSimulator/Debug/gh7514.app/Frameworks/libSkiaSharp.framework/_CodeSignature: File exists
default	14:23:54.771850-0500	mono64	open on /Users/poupou/Projects/gh7514/gh7514/bin/iPhoneSimulator/Debug/gh7514.app/Frameworks/libSkiaSharp.framework/_CodeSignature/CodeResources: File exists
```

`copyfile.c` source code (might not be the latest) can be seen from
https://opensource.apple.com/source/copyfile/copyfile-42/copyfile.c

```c
if (mkdir(s->dst, mode) == -1) {
	if (errno != EEXIST || (s->flags & COPYFILE_EXCL)) {
		copyfile_warn("Cannot make directory %s", s->dst);
```

so `mkdir` fails - but not because of `EEXIST` and from `copyfile.h`
we see that `EXCL` exists but it's not using (or even defined) in our
bindings.

```c
#define COPYFILE_EXCL		(1<<17) /* fail if destination exists */
```

So sadly the `Err` condition (inside the callback) does not give us more
detail about the error itself.
2019-12-05 09:15:11 -05:00
Rolf Bjarne Kvinge e19fd5ba00
[monotouch-test] Improve MessageHandlerTest.TestNSUrlSessionHandlerCookies. (#7542)
1. Instead of fetching the managed response's cookies twice, and then
   comparing them to themselves, fetch the managed response's cookies once and
   then the native response's cookies once, and compare that. This way the
   test does what it's actually supposed to do!
2. Don't pass if we fail to get the managed response's cookies.
3. Improve assertions to verify the actual cookie content as well.
4. Improve diagnostics if an exception was thrown by checking for the
   exception first instead of failing due to something else being different
   (since the underlying cause of the difference is the exception, that's what
   will have the most information about the failure).
5. Use httpbin.org instead of microsoft.com, since microsoft.com does UA
   sniffing and returns different results between the http handlers :/
2019-12-04 23:26:31 +01: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