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

494 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 8ac784ccfe Convert Runtime.GetINativeObject_[Dynamic|Static] to use GCHandle. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge e31b9db516 Convert Runtime.GetNSObjectWithType to use GCHandle. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge 5e44aac2d8 Convert Runtime.IsParameter[Out|Transient] to use GCHandle. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge cff3617dd2 Convert Runtime.Dispose to use GCHandle. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge e2ee5a2710 Convert Runtime.GetSelector to use GCHandle. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge ef92c04135 Convert Runtime.GetClass to use GCHandle. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge c25403bb21 Convert Runtime.RegisterNSObject to take a GCHandle. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge 632fd10328 Convert Runtime.GetBlockWrapperCreator, Runtime.CreateBlockProxy and Runtime.Get[Generic]MethodFromToken to use GCHandle.
The native methods xamarin_get_[generic_]method_from_token are a bit unusual
in that they return an actual GCHandle. This is for performance reasons, since
in some cases their return value is passed as parameters to other function
calls to managed code, in which case we need the GCHandle. This way we avoid
round-tripping a GCHandle multiple times.
2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge a7d68ddfbc Convert Runtime.GetMethodAndObjectForSelector to use GCHandle. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge 1bf3ccfb45 Convert Runtime.TypeGetFullName to use GCHandle. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge 6663d8d273 [runtime] Use a common cleanup logic in xamarin_get_delegate_for_block_parameter. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge 54bc2f1dfe [runtime] Add GCHandle pointer-sized API. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge 1c33bff5b3 [runtime] Support automatic GCHandle -> MonoObject* conversion for parameters and return values when calling managed delegates. 2020-05-04 11:22:26 +02:00
Rolf Bjarne Kvinge 95a9fe33fd [runtime] Don't call directly into managed delegates.
Use the wrapper methods instead, so that we get the benefits of using them
(automatic parameter/return type conversions, NULL checks, etc).
2020-05-04 11:08:24 +02:00
Rolf Bjarne Kvinge 793a2a5a57
Use the correct return type for the xamarin_get_delegate_for_block_parameter function. (#8483)
This code is old, and it seems the int* is a left-over from the 32-bit days.
Using the correct type makes us able to avoid a cast.

Ref: 0f83cf16e2
2020-04-30 16:34:08 +02:00
Rolf Bjarne Kvinge bbcab6f70c
[runtime] Remove a few unused functions. (#8482) 2020-04-30 14:40:56 +02:00
Rolf Bjarne Kvinge e4f8460277
[mmp/mtouch] Share more code. (#8394)
* Rearrange files in Xamarin.Mac a bit to ease code sharing between mmp and
  mtouch, by putting mono's static and dynamic libraries in
  /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Sdks/Xamarin.macOS.sdk
  to match how Xamarin.iOS does it.

* Don't use 'usr' as an intermediate directory. This removes another special
  case.

* Share many of the functions and properties that return specific directories,
  and document (as comments) what each function/property is supposed to
  return.
2020-04-16 14:19:45 +02:00
Alexis Christoforides 4b94e3073b
Wrap mono_gc_init_finalizer_thread() call with now-needed coop GC state transition. (#8242)
Starting with https://github.com/mono/mono/pull/16907 , the Mono runtime ends in GC-Safe state (mode) after mono_jit_init_version() is called. The monotouch code did not expect that, and calls mono_gc_init_finalizer_thread() which also tries to enter GC-safe mode.

Should fix https://github.com/mono/mono/issues/19372
2020-03-31 09:28:02 +02:00
Alex Soto 3ff3e07ebe Merge remote-tracking branch 'xamarin/d16-5-xcode11.4' 2020-03-26 19:59:14 -04:00
Rolf Bjarne Kvinge 2c86ec2533
[runtime] Abort if the call to Runtime.Initialize fails. (#8099)
Also print out something to the system log. In theory
xamarin_process_managed_exception should also end up terminating the process
in one way or another, but when something goes wrong it tend to go very, very
wrong, so this makes sure some info is printed somewhere.
2020-03-13 16:11:08 +01:00
Rolf Bjarne Kvinge 1b72c009d2
[runtime] Add asserts that gives a helpful message when a managed delegate callback doesn't exist. (#8057)
This is restricted to debug builds.

Also tell make to not delete delegates.h and delegates.inc. That makes it much
easier to inspect them.

Example before function:

    void
    xamarin_throw_ns_exception (NSException * exc)
    {
    		delegates.throw_ns_exception (exc);
    }

The after version:

    void
    xamarin_throw_ns_exception (NSException * exc)
    {
    #if DEBUG
    	if (delegates.throw_ns_exception == NULL) {
    		NSLog (@PRODUCT ": The managed function throw_ns_exception could not be loaded.");
    		xamarin_assertion_message ("The managed function throw_ns_exception could not be loaded.");
    	}
    #endif
    	delegates.throw_ns_exception (exc);
    }
2020-03-06 16:42:21 +01:00
Alex Soto 709a90599e Merge remote-tracking branch 'xamarin/xcode11.4' into d16-5-xcode11.4-merge 2020-03-03 10:57:24 -05:00
Rolf Bjarne Kvinge 2b733ae79c
[mmp] Set 'disable_omit_fp' by default to provide better native stack traces in certain cases. (#7981)
* [mmp] Set 'disable_omit_fp' by default to provide better native stack traces in certain cases.

This may produce better stack traces when crashes occur, which could be
helpful for tracking down issues like
https://github.com/xamarin/maccore/issues/643.

Also add an mmp option to override the default behavior.

This is unlikely to cause any problems, because Visual Studio for Mac sets
MONO_DEBUG=disable_omit_fp at launch, which means that all processes launched
by VSMac will also have this variable set already.

* Fix lldb attach disabling.
2020-02-26 15:49:55 +01:00
Rolf Bjarne Kvinge c53b17d79b
Make the x86-64 slice we inject into binaries optional. (#7891)
We inject an x86-64 slice into binaries that don't contain one, because
Apple's notarization process fails without such a slice.

But make the slice optional and opt-in, because it seems Apple has started
to fail on binaries with such a slice now...
2020-02-14 14:25:43 +01:00
Sebastien Pouliot 482a63dc56
Update sampletester docs and fix typos (#7822) 2020-02-10 08:10:40 -05:00
monojenkins 01ff50a27c [d16-5] [Makefile] Make csc strict and fix some small errors. (#7671)
Make csc to bee more strict when compiling the projects and mix some
small errors we had in the bindings.

Fixes: https://github.com/xamarin/xamarin-macios/issues/5398


Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2020-01-06 16:53:22 -05:00
Manuel de la Pena 8a52fcd812
[Makefile] Make csc strict and fix some small errors. (#7665)
* [Makefile] Make csc strict and fix some small errors.

Make csc to bee more strict when compiling the projects and mix some
small errors we had in the bindings.

Fixes: https://github.com/xamarin/xamarin-macios/issues/5398
2020-01-02 13:57:22 -05:00
Vincent Dondain fd3f86d912 Bump to mono:2019-10 (#7192) (#7547)
* 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.

* #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.

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`.

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.

* `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`

* `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-18 11:40:47 -05:00
Manuel de la Pena c44e339d7a
[Runtime] Move some of the changes back to int. (#7529) (#7606)
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-16 22:06:51 -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
monojenkins 3483132065 [runtime] Don't zero-terminate after the string buffer. Fixes #7564. (#7580)
Fixes https://github.com/xamarin/xamarin-macios/issues/7564.
2019-12-12 16:07:31 -05: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
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
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
Sebastien Pouliot 611d6f37fb
[runtime] Comment two special cases that triggers static analysis tools (#7491) 2019-11-26 08:30:05 -05:00
Manuel de la Pena cb815ecd39
[Runtime] Update cflags and fix warnings accordingly. (#7478)
Update flags:

* Add -Werror so that warnings are errors.
* Move to -Wconversion that adds:
  * -Wbitfield-enum-conversion
  * -Wbool-conversion
  * -Wconstant-conversion
  * -Wenum-conversion
  * -Wfloat-conversion
  * -Wimplicit-float-conversion
  * -Wimplicit-int-conversion
  * -Wint-conversion
  * -Wliteral-conversion
  * -Wnon-literal-null-conversion
  * -Wnull-conversion
  * -Wobjc-literal-conversion
  * -Wshorten-64-to-32
  * -Wsign-conversion
  * -Wstring-conversion
Last work related to: https://github.com/xamarin/xamarin-macios/pull/7405
2019-11-25 16:00:24 -05:00
Manuel de la Pena 6a702cb7b9
[Runtime] Enable the -Wsign-conversion on runtime.m files. (#7474)
Enable the flag that was disabled via pragmas and fix warnings.

Continuation of PR: https://github.com/xamarin/xamarin-macios/pull/7405
2019-11-21 09:42:17 -05:00
Manuel de la Pena 8f6a10f3bd
[Runtime] Enable the -Wsign-conversion on monotouch-debug files. (#7459)
Enable the flag that was disabled via pragmas and fix warnings.

Continuation of PR: https://github.com/xamarin/xamarin-macios/pull/7405
2019-11-20 13:42:51 -05:00
Manuel de la Pena 4aa269bbdb
[Runtime] Enable the -Wsign-conversion on monotouch-main.m files. (#7457)
Enable the flag that was disabled via pragmas and fix warnings.

Continuation of PR: https://github.com/xamarin/xamarin-macios/pull/7405
2019-11-18 08:36:47 -05:00
Manuel de la Pena 481d5ef9ab
[Runtime] Enable the -Wsign-conversion on trampolines-x86_64.m files. (#7455)
Enable the flag that was disabled via pragmas and fix warnings.

Continuation of PR: https://github.com/xamarin/xamarin-macios/pull/7405
2019-11-15 14:34:36 -05:00
Manuel de la Pena af196f1c72
[Runtime] Enable the -Wsign-conversion on trampolines.m files. (#7447)
Enable the flag that was disabled via pragmas and fix warnings.

Continuation of PR: https://github.com/xamarin/xamarin-macios/pull/7405
2019-11-15 10:39:38 -05:00
Manuel de la Pena 5e2231d533
[Runtime] Enable the -Wsign-conversion on trampolines-varargs files. (#7428)
Enable the flag that was disabled via pragmas.

Continuation of PR: https://github.com/xamarin/xamarin-macios/pull/7405
2019-11-14 14:35:27 -05:00
Sebastien Pouliot 387730516f
[runtime] Clarify size in marshal_return_value calls (#7439)
Static analysis (and any manual review) is easily confused by
`sizeof (id)`, `sizeof (self)` and `sizeof (*self)` when another
argument is `self` and can report false positives (or be missed
or misinterpreted by humans).

This simply clarify that `|` is an encoded pointer and will
be the size of the pointer (varying by architectures)
2019-11-14 14:50:34 +01:00
Manuel de la Pena dc0a877fed
[Runtime] Enable the -Wsign-conversion on trampolines-invoke.m (#7429)
Enable the flag that was disabled via pragmas.

Continuation of PR: https://github.com/xamarin/xamarin-macios/pull/7405
2019-11-14 05:44:51 -05:00
Sebastien Pouliot 089ca17e5a
[runtime] Catch and log exceptions in ObjC++ destructor (#7421)
`xamarin_notify_dealloc` can throw an exception (depending on the mode
used).

Throwing exception in a destructor is problematic in [Obj]C++ and can
abort the application. That might be fine in some cases but there's
not much point in doing so when we're about to forget everything about
that specific object.
2019-11-14 09:30:48 +01:00
Sebastien Pouliot c46d9857a4
[runtime] Filter isblank input to 8 bits values (#7420)
Help static analyzer by clarifying that only `char` will be given to
`isblank` so it does not look like it could be used to index an array
and gets out of bounds (important since this is user supplied values).

Digging down into `isblank` will get you to
> Using tainted variable _c as an index to array _DefaultRuneLocale.__runetype.
2019-11-13 20:46:20 +01:00
Manuel de la Pena 63ab48e679
[Runtime] Enable the -Wsign-conversion warnings flag and fix some of the warnings. (#7405)
The flag adds a lot (A LOT) of warnings. The diff would be huge and
dangerous to review. We enable the flag and fix file by file.
2019-11-12 15:10:16 -05:00
Sebastien Pouliot f0f06c1338
[runtime] Zeroize dummy member of structure in binding-generator (#7411)
This is not exposed so it should never be an issue - but just in
case something else goes wrong then it will only be 0 (and not
random values).
2019-11-12 21:03:56 +01:00
Sebastien Pouliot 0b323ca4cd
[runtime] Clarify redirect_io behaviour (#7409)
Change `redirect_io` to be easier to re-use correctly, i.e. returning the
file descriptor (instead of `0`).

Comment why the file descriptor are never released. It makes sense but
it's not obvious (even less in `redirect_io`) without comments.

Using static fields also makes it easier for static analysis (locals are
easier to process).

Finally reuse, mostly, the same string for the error message, i.e.

```
$ strings runtime//.libs/mac/libxammac.x86_64.dylib | grep "Could not redirect"
Xamarin.Mac: Could not redirect %s to `%s': %s
```
versus
```
$ strings runtime//.libs/mac/libxammac.x86_64.dylib | grep "Could not redirect"
Xamarin.Mac: Could not redirect stdout to `%s': %s
Xamarin.Mac: Could not redirect stderr to `%s': %s
```
2019-11-12 12:34:49 +01:00
Vincent Dondain 44fd06324a Merge master into d16-5 2019-11-08 10:21:12 -05:00
Manuel de la Pena 2e5b64893f
[Runtime] Enable the -Wshorten-64-to-32 flag and fix all warnings. (#7353)
* [Runtime] Enable the -Wshorten-64-to-32 flag and fix all warnings.

We want to enable the -Wconversion but that will raise too many warning
for a single commit. We are enabiling one by one the flags included in
-Wconversion so that we have smaller diffs.

-Wshorten-64-to-32 adds warnings when there is a implicit conversion that
loses integer precision. We are moving all the 32 to 64 conversions to
use 64. Expecially since most of the code changed is related with sizes,
legths and params counts that are never going to be negative.


Co-Authored-By: Rolf Bjarne Kvinge <rolf@xamarin.com>
2019-11-05 11:00:14 -05:00
Sebastien Pouliot e55e434213
[runtime] Free `env-argv` in `xamarin-main` (#7352)
`get_mono_env_options` allocate memory so it must [1] be freed.

[1] to be polite since it will be freed when the app exit, which
will free everything anyway
2019-11-04 08:56:59 -05:00
Sebastien Pouliot 8f92c3dcdd
[runtime] Merge two identical code paths (#7351) 2019-11-04 08:55:02 -05:00
Sebastien Pouliot e736477377
[runtime] Remove some classic (pre-unified) code that is not used anymore. (#7341) 2019-10-30 20:54:30 -04:00
Manuel de la Pena 8b45260ee4
[Runtime] Ensure that all comparisons between signed and unsigned values are fixed. (#7339)
Enable the -Wsign-compare which will raise issues when a comparison
between signed and unsigned values could produce an incorrect result
and fix all the raised warnings.
2019-10-30 15:58:13 -04:00
Sebastien Pouliot c0e5176e9e
[runtime] Simplify Vision dlsym'ed functions (#7307)
* [runtime] Simplify Vision dlsym'ed functions

More code sharing - DRYer :)

It also remove complaints (from static analysis tools) that a `dlclose`
should be present. That's not really an issue here since it's reference
counted and won't be unloaded if you use the code (and such a call is
not added in the PR). It silence the warning since it's not a local
variable anymore.
2019-10-28 09:21:34 -04:00
Sebastien Pouliot 6fca42049d
[runtime] Throw a OutOfMemoryException when processing parameters (#7308)
`calloc` can return `null` and we're writing to the memory location
which would crash the process.

An `OutOfMemoryException` is the correct way to handle this (even if
will likely crash the process anyway).
2019-10-25 15:49:22 -04:00
Sebastien Pouliot 6bada3b20c
[runtime] Simplify `xamarin_switch_gchandle` by removed dead code (#7306)
If `old_gchandle` is not set (0) then the function returns early,
so can't be 0 after the `MONO_THREAD_ATTACH` meaning:

* the `else` branch is never executed;

* the `exception_gchandle` is never set to something other than 0

* ` if (exception_gchandle == 0) {` is always `true` and can be removed (diff looks bigger than it is because of indentation change)

= the call to `xamarin_process_managed_exception_gchandle` is unneeded
2019-10-25 13:27:52 -04:00
Sebastien Pouliot f2c7eb887c
[runtime] Ensure binding-generator full initialize NVector3[d] members (#7298) 2019-10-24 18:04:26 -04:00
William Kent 9be58e4b9c os_log(3) support (#7141)
* Add xamarin_os_log function

See the comment in the function for an explanation
of why this wrapper function is required.

* Add Darwin/OSLog.cs

* Add xamarin_os_log to header

This ensures that the symbol will not be subject
to C++ name mangling, therefore breaking mmp.
With this change applied, OSLog works as expected.

* Resolve stylistic PR feedback

* Move OSLog into CoreFoundation namespace

This is where the NativeObject class lives, and it
also feels like a better fit for a low-level API
that is available on non-Mac platforms than the
macOS-only Darwin namespace.
2019-10-24 17:46:03 -04:00
Marius Ungureanu 775fbf56d0 Optimize a bit of the runtime sorting code by avoiding branches (#7145)
It is the more common and optimized idiom to just substract two integer values rather than do conditional checks. This may yield better performance for the qsort function, improving a bit of the startup time in case of many items

* Use a better, non-overflowing version with bit twiddling hacks.

Credits to @mandel-macaque for the magic
2019-10-24 16:59:36 -04:00
Rolf Bjarne Kvinge 8128976084
[runtime] Split the build differently: build libraries for simulator and device separately. (#7143)
This has a couple of advantages:

* It makes it easier to add a catalyst version of these libraries (because it
  becomes cumbersome to build for catalyst when the build rules assumes we're
  building for both simulator and device).
* It makes it easier to create an xcframework of our libraries, because the
  contents in an xcframework is split like this.
2019-10-03 16:38:44 +02:00
Rolf Bjarne Kvinge 0418008046
[runtime] Use newer atomic functions. (#7119)
Fixes these warnings:

    shared.m:252:6: warning: 'OSAtomicDecrement32Barrier' is deprecated: first deprecated in watchOS 3.0 - Use std::atomic_fetch_sub() from <atomic> instead [-Wdeprecated-declarations]
            if (OSAtomicDecrement32Barrier (&bl->descriptor->ref_count) == 0) {
                ^
    /Applications/Xcode11.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS6.0.sdk/usr/include/libkern/OSAtomicDeprecated.h:201:9: note: 'OSAtomicDecrement32Barrier' has been explicitly marked deprecated here
    int32_t OSAtomicDecrement32Barrier( volatile int32_t *__theValue );
            ^
    shared.m:270:2: warning: 'OSAtomicIncrement32' is deprecated: first deprecated in watchOS 3.0 - Use std::atomic_fetch_add_explicit(std::memory_order_relaxed) from <atomic> instead [-Wdeprecated-declarations]
            OSAtomicIncrement32 (&source->descriptor->ref_count);
            ^
    /Applications/Xcode11.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS6.0.sdk/usr/include/libkern/OSAtomicDeprecated.h:171:9: note: 'OSAtomicIncrement32' has been explicitly marked deprecated here
    int32_t OSAtomicIncrement32( volatile int32_t *__theValue );
            ^
    monotouch-debug.m:309:10: warning: 'OSAtomicIncrement32Barrier' is deprecated: first deprecated in watchOS 3.0 - Use std::atomic_fetch_add() from <atomic> instead [-Wdeprecated-declarations]
            int c = OSAtomicIncrement32Barrier (&http_send_counter);
                    ^
    /Applications/Xcode11.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS6.0.sdk/usr/include/libkern/OSAtomicDeprecated.h:182:9: note: 'OSAtomicIncrement32Barrier' has been explicitly marked deprecated here
    int32_t OSAtomicIncrement32Barrier( volatile int32_t *__theValue );
            ^
2019-09-27 07:15:59 +02:00
Rolf Bjarne Kvinge 2adecee3d9
Drop the Xcode 9.4 dependency. (#7044)
* Drop the Xcode 9.4 dependency.

Also bump mono to get the removal of the mac32 binaries.

New commits in mono/mono:

* mono/mono@70d6903053 [2019-08] [merp] Use a separate program as the hang supervisor. (#16900)
* mono/mono@4bff2b6370 [offsets-tool] Install clang into the user-specific python directory.
* mono/mono@81894ec8ca Implement WriteCore and ReadCore in DeflateStream
* mono/mono@bfbf823ca1 [ci] Remove more XCODE32_DIR usages (#16964)
* mono/mono@ce01b20a4d Add net_4.8.xml to EXTRA_DIST and bump binary-reference-assemblies again
* mono/mono@7a587d7fa6 Add .NET 4.8 reference assemblies (#16912)
* mono/mono@35e454a8f6 [sdks] Remove the mac32 build. (#16936)
* mono/mono@75eb342f53 [2019-08] [System] Make FileSystemWatcher backend non-static (#16926)
* mono/mono@5881981f79 [2019-08] [mini] Add missing membars when initializing rgctx entries (#16909)
* mono/mono@6290b6cd6e Temporarily disable embedded ppdb data decompression (#16911)
* mono/mono@a0e7f9eaf2 [2019-08] [arm64_32] make "Debug Mode" work on Watch series 4 with --interpreter (#16886)
* mono/mono@6275840a7f Rename bundle identifier for the various Mono.frameworks we create for Xamarin.iOS. Fixes xamarin/xamarin-macios#7005. (#16901)
* mono/mono@25f6093283 [corlib] Fix building nunit-lite twice (#16895)
* mono/mono@7ec17ba1be [2019-08] [android sdk] Add aprofutil tool (#16884)
* mono/mono@f755f3b539 [metadata] Fix leaks when handling a few attributes (#16850)
* mono/mono@5f9a2db39b [2019-08] Fix infrequent hangs in test-runner. (#16854)
* mono/mono@f31f5ea1f1 [2019-08] [threads] do not convert NULL thread name (#16828)
* mono/mono@20308e6f87 [aot] Do not wrap tool_prefix path when calling strip (#16820)
* mono/mono@cecda47c48 [aprofutil] Add -p and -f options
* mono/mono@824cc12ac3 Bump to mono/corefx@e79cf5b
* mono/mono@b77dc06a7e [aprofutil] Install the tool correctly (#16112)
* mono/mono@1848d78d60 [aotprof-tool] Initial import of AOT profiler tool (#15384)
* mono/mono@da0086e304 [2019-08] Add RenamedEvent* to FSW sources from CoreFX (#16756)
* mono/mono@0297b21b03 [msbuild][roslyn] Bump msbuild and roslyn to pull in new versions (#16768)
* mono/mono@40631e3b9e [2019-08] [aot] move method_addresses to data.rel.so section to avoid text relocations (#16751)
* mono/mono@68b77674e2 Vtable [i] can be null so this should be check before use it. Fixes #16712
* mono/mono@4a0b4f41ed [mini] publish global patches after JitInfo has been added
* mono/mono@7a1f63fde6 [debugger][android] It was not initialising seq_points on MonoCompile on Android, so when was compiling dynamic methods, seq_points wasn't created and we got the assert when try to single step.

Diff: 29b1ac19c9..70d6903053

* [tests] Add a fat macOS dylib for testing purposes.

Add a binary version of a fat macOS dylib (because we can't create one when we
need it since we can't create 32-bit slice anymore).

It was created like this (in tests/test-libraries):

	$ cat test.m
	int theUltimateAnswer ()
	{
		return 42;
	}

	$ /Applications/Xcode94.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang test.m -olibtest.i386.dylib -shared -isysroot /Applications/Xcode94.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -framework Foundation -framework CoreLocation -lz  -arch i386
	$ lipo -create libtest.i386.dylib .libs/macos/libtest.dylib -output libtest-fat.dylib

* [tests] Adjust XM tests to XM not having fat dylibs anymore.

* [tests] Adjust product tests to some libraries not being fat anymore.

* One more test fix.
2019-09-24 13:40:18 +02:00
Bernhard Urban 04a4c3f2ce
[coop runtime] add a GC transition and relax some GC related assertions (#7036)
* [coop] add missing gc_unsafe transition

    frame #3: 0x02a39fd4 monotouchtest`log_callback(log_domain=0x00000000, log_level="error", message="../../../../../mono/metadata/object.c:1905: Expected GC Unsafe mode but was in STATE_BLOCKING state", fatal=4, user_data=0x00000000) at runtime.m:1251:3
    frame #4: 0x02a03f78 monotouchtest`monoeg_g_logv_nofree(log_domain=0x00000000, log_level=G_LOG_LEVEL_ERROR, format=<unavailable>, args=<unavailable>) at goutput.c:149:2 [opt]
    frame #5: 0x02a03f14 monotouchtest`monoeg_g_logv(log_domain=<unavailable>, log_level=<unavailable>, format=<unavailable>, args=<unavailable>) at goutput.c:156:10 [opt]
    frame #6: 0x02a03fa8 monotouchtest`monoeg_g_log(log_domain=<unavailable>, log_level=<unavailable>, format=<unavailable>) at goutput.c:165:2 [opt]
    frame #7: 0x029e54f8 monotouchtest`assert_gc_unsafe_mode(file="../../../../../mono/metadata/object.c", lineno=1905) at checked-build.c:396:3 [opt]
    frame #8: 0x0294ef98 monotouchtest`mono_class_vtable_checked(domain=0x16d87b70, klass=0x17bfab98, error=0x19498a08) at object.c:1905:2 [opt]
    frame #9: 0x0298f0dc monotouchtest`get_current_thread_ptr_for_domain(domain=0x16d87b70, thread=0x03f645d0) at threads.c:635:2 [opt]
    frame #10: 0x0298d9dc monotouchtest`mono_thread_current at threads.c:2026:23 [opt]
    frame #11: 0x02992a80 monotouchtest`mono_runtime_set_pending_exception(exc=0x0357e4a0, overwrite=0) at threads.c:5176:23 [opt]
    frame #12: 0x02a3c650 monotouchtest`::xamarin_process_nsexception_using_mode(ns_exception=name: "System.ApplicationException" - reason: "3,14", throwManagedAsDefault=false) at runtime.m:2369:4
    frame #13: 0x02a3c478 monotouchtest`::xamarin_process_nsexception(ns_exception=name: "System.ApplicationException" - reason: "3,14") at runtime.m:2336:2
    frame #14: 0x0270b488 monotouchtest`::xamarin_pinvoke_wrapper_objc_msgSendSuper18(__p__0=0x0357d0f0, __p__1=0x02ad1ef2) at pinvokes.m:5732:4
    frame #15: 0x02a64764 monotouchtest`do_icall(frame=<unavailable>, sig=0x17d70bf0, op=<unavailable>, sp=0x19498fa0, ptr=<unavailable>, save_last_error=0) at interp.c:1947:3 [opt]
    frame #16: 0x02a632b8 monotouchtest`do_icall_wrapper(frame=0x194991b0, sig=0x17d70bf0, op=547, sp=0x19498fb0, ptr=0x0270b408, save_last_error=0) at interp.c:2037:7 [opt]
    Messaging::void_objc_msgSendSuper @ 396160394 "calli.nat.fast" || frame #17: 0x02a51d5c monotouchtest`interp_exec_method_full(frame=0x194991b0, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3229:9 [opt]
    ObjCExceptionTest::InvokeManagedExceptionThrower @ 396160296 "vcall" || frame #18: 0x02a524e8 monotouchtest`interp_exec_method_full(frame=0x19499370, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3400:4 [opt]
    ExceptionsTest::ManagedExceptionPassthrough @ 396150902 "vcallvirt.fast" || frame #19: 0x02a521cc monotouchtest`interp_exec_method_full(frame=0x194994d0, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3325:4 [opt]
    Object::runtime_invoke_direct_void__this__ @ 401347822 "vcall" || frame #20: 0x02a524e8 monotouchtest`interp_exec_method_full(frame=0x19499588, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3400:4 [opt]
    frame #21: 0x02a506f8 monotouchtest`interp_runtime_invoke(method=<unavailable>, obj=0x0357c4f0, params=0x00000000, exc=0x1949965c, error=0x194998b8) at interp.c:1766:2 [opt]
    frame #22: 0x028a739c monotouchtest`mono_jit_runtime_invoke(method=0x17534858, obj=<unavailable>, params=0x00000000, exc=<unavailable>, error=0x194998b8) at mini-runtime.c:3170:12 [opt]
    frame #23: 0x02951cfc monotouchtest`do_runtime_invoke(method=0x17534858, obj=0x0357c4f0, params=0x00000000, exc=0x00000000, error=0x194998b8) at object.c:3017:11 [opt]
    frame #24: 0x0294e6d4 monotouchtest`mono_runtime_invoke_checked(method=<unavailable>, obj=<unavailable>, params=<unavailable>, error=<unavailable>) at class-getters.h:24:1 [opt] [artificial]
    frame #25: 0x02955408 monotouchtest`mono_runtime_try_invoke_array(method=0x17534858, obj=0x0357c4f0, params=0x00000000, exc=0x00000000, error=0x194998b8) at object.c:5564:10 [opt]
    frame #26: 0x02905fac monotouchtest`ves_icall_InternalInvoke(method=<unavailable>, this_arg=<unavailable>, params=0x00000000, exc=0x19499f0c) at icall.c:3753:8 [opt]
    frame #27: 0x02a64788 monotouchtest`do_icall(frame=<unavailable>, sig=0x17496978, op=<unavailable>, sp=0x19499d88, ptr=<unavailable>, save_last_error=0) at interp.c:1982:20 [opt]
    frame #28: 0x02a632b8 monotouchtest`do_icall_wrapper(frame=0x19499fb0, sig=0x17496978, op=552, sp=0x19499da0, ptr=0x02905bec, save_last_error=0) at interp.c:2037:7 [opt]
    RuntimeMethodInfo::InternalInvoke @ 400702536 "calli.nat.fast" || frame #29: 0x02a51d5c monotouchtest`interp_exec_method_full(frame=0x19499fb0, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3229:9 [opt]
    RuntimeMethodInfo::Invoke @ 400701852 "call" || frame #30: 0x02a524e8 monotouchtest`interp_exec_method_full(frame=0x1949a110, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3400:4 [opt]
    MethodBase::Invoke @ 400700872 "callvirt.fast" || frame #31: 0x02a521cc monotouchtest`interp_exec_method_full(frame=0x1949a280, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3325:4 [opt]

* [coop] relax a couple GC state assertions

* [coop] update doc for enabling GC assertions

* [coop] relax a GC assertion in release trampoline
2019-09-23 22:08:25 +02:00
Rolf Bjarne Kvinge b8f9dccdcc
Merge pull request #7003 from xamarin/master-xcode11
Merge xcode11 into master.
2019-09-18 07:47:14 -07:00
Rolf Bjarne Kvinge 693dc758ec
[runtime] Build and ship Xamarin[-debug].framework.dSYM. Fixes #7004. (#7014)
Fixes https://github.com/xamarin/xamarin-macios/issues/7004.
2019-09-18 05:19:17 -07:00
Rolf Bjarne Kvinge da2fd8bd22
[runtime] Silence, please. (#7013) 2019-09-18 02:00:44 -07:00
Rolf Bjarne Kvinge 303aa0a649 Merge remote-tracking branch 'origin/xcode11' into master-xcode11 2019-09-13 18:35:18 +02:00
Alex Soto a1fba90ecb
[ModelIO] Fix MDLAnimatedQuaternion bindings (#6991)
Quaternion does need our special marshalling.
2019-09-12 10:53:42 -04:00
Rolf Bjarne Kvinge 366f46ba21
[ModelIO] Implement new API introduced with Xcode 11 b1-7. (#6930) 2019-09-09 13:15:07 -07:00
Rolf Bjarne Kvinge 0008c20abf
Implement notarization. (#6928)
* Add a dummy x86_64 slice to all our native libraries that don't have one. (#6848)

Apple's notarization tool has a bug where they incorrectly flag Mach-O
binaries without an x86_64 slice, so make sure all our libraries have one.

* Jenkinsfile notarization (#6869)

* Add in notarization script for xamarin.mac/xamarin.iOS

* Flatten the list to get rid of the braces

* Add in keychain password

* Add login.keychain back in to access codesigning certificates

* Always sign pkgs, upload notarized copies

* Enable ios notarization and make notarized pkgs public

* Make notarization non-fatal

* Publish GH statuses for notarized PKGs

* Don't forget to declare URI variables for notarized pkgs

* report proper package links

* [jenkins] Improve package reporting.

* Use dummy function name which our tests won't complain about.
2019-09-09 00:34:11 -07:00
Rolf Bjarne Kvinge a9abc07cb3
Rename bundle identifier for the frameworks we ship. Fixes #6920. (#6926)
Rename the bundle identifier for the frameworks we ship, because apparently
Apple has added an App Store check to reject apps with multiple frameworks
with the same bundle identifier.

For some reason that includes rejecting frameworks that are both in iOS and
watchOS apps. This feels like a bug on Apple's end, but we can still easily
work around it, so let's do just that.

Strictly speaking it's not necessary to change the bundle identifier for tvOS
frameworks, but it's more consistent that way.

Fixes https://github.com/xamarin/xamarin-macios/issues/6920.
2019-09-06 09:30:49 -07:00
Rolf Bjarne Kvinge 678a422604
[registrar] Ignore method encodings when processing copyback arguments in the dynamic registrar. Fixes #6883. (#6904)
Method encodings do not change anything for us, so skip them when processing
copyback arguments so that they don't confuse the rest of the code.

Fixes https://github.com/xamarin/xamarin-macios/issues/6883.
2019-09-04 07:02:33 -07:00
Sebastien Pouliot 9e193eaca3
[foundation] Add support for NSValue/CGAffineTransform and StoreValueAtAddress overload (#6887)
Support for `NSValue`/`CGAffineTransform` exists in iOS/tvOS/watchOS,
from UIKit, but not for macOS. However this will be required for the
new protocols inside CoreImage.

Also add an overload for `StoreValueAtAddress` since the original
one was deprecated but we did not provide the new alternative to
update the code.
2019-08-30 18:00:04 -04:00
Rolf Bjarne Kvinge ec09193daf
Build native code with -std=c++14. (#6864)
* Build native code with -std=c++14.

Apple's headers now require -std=c++14 to compile their headers in C++ mode.

This fixes a compile error that would occur with the PhotosUI framework when
compiling code for C++.

* [mmp] Use -std=c++14 when compiling.

* Fix command line output.

* [mmp] Add all source files at the end, so they all get the -x clang argument applied.

* Limit when using c++14 in mtouch according to language.
2019-08-29 08:49:06 -07:00
Rolf Bjarne Kvinge 010ae1d2c9
[runtime] Fix usage of objc_msgSend[Super] according to modified headers. (#6865)
It's now required to cast objc_msgSend[Super] to a function of the correct
signature, so let's do that.

Also remove the define that allowed us to use the previous behavior.
2019-08-28 08:05:38 -07:00
Rolf Bjarne Kvinge f3fbbd7047
Add a dummy x86_64 slice to all our native libraries that don't have one. (#6848)
Apple's notarization tool has a bug where they incorrectly flag Mach-O
binaries without an x86_64 slice, so make sure all our libraries have one.
2019-08-26 09:51:50 -07:00
Rolf Bjarne Kvinge 80421bd655 [runtime] Fix xamarin_timezone_get_local_name signature. (#6593)
Define the xamarin_timezone_get_local_name function in a header, so that we
don't get C++ mangling. Also make it return a non-const char*, since the
caller is supposed to free the returned value.

Fixes this test:

* Xamarin.Tests.Misc.PublicSymbols(iOS): Failed libraries

    Expected: <empty>
    But was: "/Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libxamarin-debug.a:
        __Z31xamarin_timezone_get_local_namev
        __Z31xamarin_timezone_get_local_namev
        __Z31xamarin_timezone_get_local_namev
        __Z31xamarin_timezone_get_local_namev
        __Z31xamarin_timezone_get_local_namev
2019-07-18 10:36:44 +02:00
Jo Shields a29ae8e6df Bump to mono:2019-06 (#6196)
* Use the commonly used casing for `MSBuildSDKsPath` property

Handle "incorrectly" cased msbuild property names

msbuild property names are case insensitive. While generating the custom
app.config, in `SetToolsetProperty(..)` we try to update the property if
it already exists. But the name lookup was case sensitive, thus causing
the lookup to fail, resulting in two entries for the same property name
differing only in case. Eg. `MSBuildSDKsPath` vs `MSBuildSdksPath`.

* [mtouch] Whitelist new Brotli native symbols in Xamarin.Tests.Misc.PublicSymbols test

* [mtouch] Better assert in NoLLVMFailuresInWatchOS() test

We'd list the "LLVM failed" messages before even though the AOT might've crashed and the list is meaningless. Assert the exit code before that.

* [mtouch] Use new LLVM even for 32bit targets

See https://github.com/mono/mono/issues/14841 and https://github.com/mono/mono/issues/9621

* [mtouch] Work around slow LLVM in "don't link" test

See https://github.com/mono/mono/issues/14843

* Remove useless conditional

* Remove LLVM36 from Makefile

* [watch4] set right min version for arm64_32 based watch devices (#6307)

Fixes the confusion around `libmono-native*` (see for example ce5ba1e41d (commitcomment-33834491) ) when building with `MONO_BUILD_FROM_SOURCE=1`.

* reflect watchos64_32_version_min change from mono sdk

* Move mono hash info to mk/mono.mk so that existing scripts work.

* Add Makefile dependency on mono.mk where necessary

With 3e7bc29ade the Mono hash was moved from Make.config to mono.mk.

We need to add a Makefile dependency on this file wherever Make.config was used to track a Mono dependency.

* [tests] Copy mk/mono.mk to the XM test package.

* [tests] Update minOS version test after consolidating min watchOS versions everywhere.

Fixes this mtouch and mmptest failure:

    1) Failed : Xamarin.Tests.ProductTests.MinOSVersion(watchOS,MinwatchOS,WatchOSSimulator,False)
      Failures
      Expected: <empty>
      But was:  < "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (mono-runtime-debug.arm64_32.o).", "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (bindings-debug.arm64_32.o).", "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (bindings-generated-debug.arm64_32.o).", "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (shared-debug.arm64_32.o).", "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (runtime-debug.arm64_32.o).", "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (trampolines-debug.arm64_32.o).", "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (trampolines-invoke-debug.arm64_32.o).", "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (xamarin-support-debug.arm64_32.o).", "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (nsstring-localization-debug.arm64_32.o).", "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (trampolines-varargs-debug.arm64_32.o)."... >

* [mmp] Fix make clean target

It needs an -r to remove directories:

```
rm: bin: is a directory
rm: obj: is a directory
```

* Add new xamarin_timezone_get_local_name() to a few more places
2019-07-16 17:24:00 +02:00
Rolf Bjarne Kvinge a495077533
[xcode11] Stop building/shipping 32-bit Xamarin.Mac bits. Partial fix for #6300. (#6393)
This includes:

* 32-bit version of Xamarin.Mac.dll and OpenTK.dll
* XamMac.dll and XamMac.CFNetwork.dll
* 32-bit versions of the runtime libraries (libxammac.a and friends).
* 32-bit version of the partial static library for Xamarin.Mac.
* Classic support in the generator.

We still ship a few Classic files so that Visual Studio for Mac continue to detect that Xamarin.Mac is installed (otherwise VSfM won't open Classic projects, which makes it impossible to use the migration wizard).

This makes our build slightly faster.

Partial fix for #6300.
2019-07-15 10:19:24 -07:00
Steve Pfister a7cb29a4b7 Ensure Local TimeZone Id is Set For TimeZoneInfo.Local (#6564)
* Mirrors the runtime change found in https://github.com/mono/mono/pull/15667.

The fix here is to return the name of the local time zone so that TimeZoneInfo.Local
can have the correct Id.

* Added nil check on name.  Returns Local as the Id in the case of nil
2019-07-15 00:47:11 -07:00
Vincent Dondain 85c955d0b2 [arkit] Update for Xcode 11 beta 2 and beta 3 (#6460) 2019-07-04 07:33:37 +02:00
Rolf Bjarne Kvinge a073c81c45
[AppKit] Implement [NSView sortSubviewsUsingFunction:context:] (#6485)
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/941421.
2019-07-04 07:30:44 +02:00
Rolf Bjarne Kvinge 801b11c60b [runtime] Implement a different fix for #6258. Fixes #6302.
It turns out 'object_getClass' and '[obj class]' does not return exactly the
same. It seems this would have gone unnoticed (the difference would not be
important), except that it made us run into yet another Objective-C runtime
bug...

So return to the previous behavior (call 'object_getClass'), and instead call
'[obj class]' as well just before to make sure the Class instance we get back
from 'object_getClass' is initialized properly.

Now you may wonder why the return value from '[obj class]' has an effect on
the different return value from 'object_getClass', and the answer is that I
have no idea whatsoever. It works, and that makes me happy.

Fixes https://github.com/xamarin/xamarin-macios/issues/6302.
2019-06-14 19:59:02 +02:00
Rolf Bjarne Kvinge ab8817d000
Merge pull request #6294 from rolfbjarne/xcode11-watchsimulator
Fix building and launching watchOS apps. Fixes #6252.
2019-06-14 16:42:13 +02:00
Rolf Bjarne Kvinge 70844a81df
[runtime] Use '[obj class]' instead of 'object_getClass' to work around an Objective-C runtime bug. Fixes #6258 and #6255. (#6293)
Xcode 11 introduces a bug in the Objective-C runtime that makes the runtime
surface uninitialized Class instances. Using these instances may lead to
crashes. Work around this issue by using a different API to get Class
instances for Objective-C objects, hoping that we won't see uninitialized
Class instances.

Ref: https://trello.com/c/2g7qtnGO/143-fb6153904-classcopyprotocollist-crashes-in-ios-13

Fixes https://github.com/xamarin/xamarin-macios/issues/6258.
Fixes https://github.com/xamarin/xamarin-macios/issues/6255.
2019-06-14 16:33:03 +02:00
Rolf Bjarne Kvinge 62043318d7 [runtime] Assume we're in the US if the OS doesn't know.
This fixes a crash when running tests in the watchOS 6.0 simulator.
2019-06-14 02:17:37 +02:00
Manuel de la Pena a0a23a42d6 Add the missing flags to the native templates. 2019-06-04 18:42:46 +02:00
Alexander Köplinger 48b3b82410 Merge remote-tracking branch 'upstream/master' into binary-artifacts
# Conflicts:
#	builds/Makefile
#	external/mono
2019-05-22 20:07:18 +02:00
Bernhard Urban 06fcf59b78 [build/runtime] Add build rules for arm64_32 2019-05-22 08:05:40 +02:00
Alexander Köplinger 247a6bf551 Switch to mono archive and remove submodule 2019-05-21 22:16:02 +02:00
Rolf Bjarne Kvinge 47beab425d Merge remote-tracking branch 'origin/master' into arm64_32-v3 2019-05-16 15:26:15 -07:00
Chris Hamons 155bb924de
Revert "[launcher] Pass --use-map-jit to mono on XM app startup" (#6051)
- This reverts commit 2278512aba.
- This is no longer necessary due to https://github.com/mono/mono/pull/14395
2019-05-16 15:09:02 -07:00
Rolf Bjarne Kvinge f272f69e3a [runtime] Enable the varargs dynamic trampolines for arm64_32.
The varargs dynamic is not even close to correct for arm64_32, but it's still
better than failing to compile the runtime.

A proper dynamic registrar for arm64_32 is much more complicated, in
particular because we can't use assembly code, so it will have to be
implemented later.
2019-05-10 08:28:43 +02:00
Bernhard Urban 4606d37d64 [build/runtime] Add build rules for arm64_32 2019-05-10 08:28:43 +02:00
Rolf Bjarne Kvinge c97d267faf
[runtime] Implement support for an arm64 dynamic registrar. (#6005)
This is required in order to execute downloaded assemblies (or any other
assembly not known at compile time) on device.
2019-05-07 07:35:39 +02:00
Rolf Bjarne Kvinge 37a280d974
[runtime] Put LOGZ directive in a header to not duplicate it everywhere. (#6001) 2019-05-06 19:29:28 +02:00
Rolf Bjarne Kvinge 82f288a135
[runtime] Refactor a bit to share code between files. (#6000) 2019-05-06 16:19:56 +02:00
Rolf Bjarne Kvinge 4be637aa8e
[registrar] Fix marshalling of structs with a single member. (#5986) 2019-05-06 07:26:54 +02:00
Rolf Bjarne Kvinge 83058e339c
[runtime] Fix crash in the x86_64 dynamic registrar. (#5989)
In [this][1] innocuous-looking commit I made the x86_64 dynamic registrar
crash when TRACE is defined. The underlying problem is that CallState's rsi
field is re-used as rax upon exit of the trampoline. This means that the
CallState.sel () function that gets the selector, will instead get the return
value upon exit. When TRACE is defined, we try to print the selector upon
exiting the trampoline, and since the rsi field is now the rax field, we end
up trying to print the return value as if it were a selector, and things go
slightly sideways.

[1]: https://github.com/xamarin/xamarin-macios/commit/464882d14a83
2019-05-06 07:25:49 +02:00
Rolf Bjarne Kvinge 50f573e84e [runtime] Add new functions to the header so that they don't use C++ mangling.
Fixes these test failures:

    2) Failed : Xamarin.Tests.Misc.PublicSymbols(iOS)
      Failed libraries
      Expected: <empty>
      But was:  "/Users/builder/jenkins/workspace/xamarin-macios-pr-builder/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib/libxamarin-debug.a:
    	__Z26xamarin_nsobject_to_objectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_object_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_inativeobject_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_nsobject_to_inativeobjectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z40xamarin_nsobject_to_inativeobject_staticP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_nsobject_to_objectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_object_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_inativeobject_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_nsobject_to_inativeobjectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z40xamarin_nsobject_to_inativeobject_staticP11objc_objectPvP10_MonoClassS1_Pj"

    3) Failed : Xamarin.Tests.Misc.PublicSymbols(tvOS)
      Failed libraries
      Expected: <empty>
      But was:  "/Users/builder/jenkins/workspace/xamarin-macios-pr-builder/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.AppleTVSimulator.sdk/usr/lib/libxamarin-debug.a:
    	__Z26xamarin_nsobject_to_objectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_object_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_inativeobject_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_nsobject_to_inativeobjectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z40xamarin_nsobject_to_inativeobject_staticP11objc_objectPvP10_MonoClassS1_Pj"

    4) Failed : Xamarin.Tests.Misc.PublicSymbols(watchOS)
      Failed libraries
      Expected: <empty>
      But was:  "/Users/builder/jenkins/workspace/xamarin-macios-pr-builder/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a:
    	__Z26xamarin_nsobject_to_objectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_object_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_inativeobject_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_nsobject_to_inativeobjectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z40xamarin_nsobject_to_inativeobject_staticP11objc_objectPvP10_MonoClassS1_Pj"

    5) Failed : Xamarin.Tests.Misc.PublicSymbols(macOSMobile)
      Failed libraries
      Expected: <empty>
      But was:  "/Users/builder/jenkins/workspace/xamarin-macios-pr-builder/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/libxammac-system-debug.a:
    	__Z26xamarin_nsobject_to_objectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_object_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_inativeobject_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_nsobject_to_inativeobjectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z40xamarin_nsobject_to_inativeobject_staticP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_nsobject_to_objectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_object_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_inativeobject_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_nsobject_to_inativeobjectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z40xamarin_nsobject_to_inativeobject_staticP11objc_objectPvP10_MonoClassS1_Pj"
2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge 868b3ecf44 [registrar] Add support for ref/out arrays. 2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge e6790b277b [registrar] Fix support for ref string parameters. 2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge b750056271 [registrar] Fix/implement returning SEL/Class in a ref/out parameter in the registrars. 2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge 84b99d85e5 [registrar] Reuse some more array conversion code from the static registrar. 2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge 8fee355aa5 [runtime] Add support for value types to xamarin_convert_managed_to_nsarray_with_func/xamarin_convert_nsarray_to_managed_with_func. 2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge 045945817b [registrar] Extract code to create a managed array from an NSArray to a separate method. 2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge 2cb20de784 [registrar] Extract code to create an NSArray from a managed array to a separate method. 2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge d9c0d5e93a [runtime] Report which element failed to convert when marshalling an array between Objective-C and managed code. 2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge 128fa1815f [registrar] Some more simplification. 2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge 484b9a3c37 [registrar] Don't let a failure to copy back a parameter go unnoticed.
Now that we ignore parameters we're not copying back, we can throw an
exception if we run into a parameter we don't know how to copy back.
2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge c7a6342900 [registrar] Simplify code a bit and reduce indentation.
Best reviewed by ignoring whitespace.
2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge a1bf26af90 [registrar] Simplify copyback loop a little bit.
Simplify by having a single loop variable, and remove the usage of the
other ('ofs'), since it's not needed.
2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge 141caaf8dc [registrar] Improve writeback logic for out/ref parameters.
* Keep track of which parameters needs to be written back. This makes sure the
  writeback loop doesn't run into non-writeback-parameters it doesn't know how
  to handle (by skipping them completely).

* Keep track of the (post-marshal) input to the out/ref parameters, so that we
  know whether we need to marshal anything back in the writeback loop.
2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge 4a173ec96f [registrar] Fix multiple ref/out parameters for a single method.
The previous code would break the loop looking for ref/out parameters after finding the first one.
2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge 497bacc6af [registrar] Refactor to reduce indentation a bit.
Best viewed by ignoring whitespace.
2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge ab5698c451 [registrar] Create a xamarin_nsstring_to_string to avoid code duplication. 2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge 8b0f3c80d8 [registrar] Create a xamarin_string_to_nsstring function to avoid code duplication. 2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge 10d7d1c26f [runtime] Use a 'void*' for the context in conversion functions instead of 'guint32'.
No function changes, just a refactoring to allow for pointers as context.
2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge 0f9c122800 [runtime] Add new functions to the header so that they don't use C++ mangling.
Fixes these test failures:

    2) Failed : Xamarin.Tests.Misc.PublicSymbols(iOS)
      Failed libraries
      Expected: <empty>
      But was:  "/Users/builder/jenkins/workspace/xamarin-macios-pr-builder/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib/libxamarin-debug.a:
    	__Z26xamarin_nsobject_to_objectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_object_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_inativeobject_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_nsobject_to_inativeobjectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z40xamarin_nsobject_to_inativeobject_staticP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_nsobject_to_objectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_object_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_inativeobject_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_nsobject_to_inativeobjectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z40xamarin_nsobject_to_inativeobject_staticP11objc_objectPvP10_MonoClassS1_Pj"

    3) Failed : Xamarin.Tests.Misc.PublicSymbols(tvOS)
      Failed libraries
      Expected: <empty>
      But was:  "/Users/builder/jenkins/workspace/xamarin-macios-pr-builder/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.AppleTVSimulator.sdk/usr/lib/libxamarin-debug.a:
    	__Z26xamarin_nsobject_to_objectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_object_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_inativeobject_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_nsobject_to_inativeobjectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z40xamarin_nsobject_to_inativeobject_staticP11objc_objectPvP10_MonoClassS1_Pj"

    4) Failed : Xamarin.Tests.Misc.PublicSymbols(watchOS)
      Failed libraries
      Expected: <empty>
      But was:  "/Users/builder/jenkins/workspace/xamarin-macios-pr-builder/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a:
    	__Z26xamarin_nsobject_to_objectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_object_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_inativeobject_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_nsobject_to_inativeobjectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z40xamarin_nsobject_to_inativeobject_staticP11objc_objectPvP10_MonoClassS1_Pj"

    5) Failed : Xamarin.Tests.Misc.PublicSymbols(macOSMobile)
      Failed libraries
      Expected: <empty>
      But was:  "/Users/builder/jenkins/workspace/xamarin-macios-pr-builder/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/libxammac-system-debug.a:
    	__Z26xamarin_nsobject_to_objectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_object_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_inativeobject_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_nsobject_to_inativeobjectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z40xamarin_nsobject_to_inativeobject_staticP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_nsobject_to_objectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_object_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_inativeobject_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_nsobject_to_inativeobjectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z40xamarin_nsobject_to_inativeobject_staticP11objc_objectPvP10_MonoClassS1_Pj"
2019-04-29 15:04:07 +02:00
Rolf Bjarne Kvinge 6e9afbc605 [registrar] Add support for ref/out arrays. 2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge 87a5b2dac8 [registrar] Fix support for ref string parameters. 2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge af38ac286c [registrar] Fix/implement returning SEL/Class in a ref/out parameter in the registrars. 2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge 1f7cdecd3d [registrar] Reuse some more array conversion code from the static registrar. 2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge 4a82341c91 [runtime] Add support for value types to xamarin_convert_managed_to_nsarray_with_func/xamarin_convert_nsarray_to_managed_with_func. 2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge 7a9cb8372a [registrar] Extract code to create a managed array from an NSArray to a separate method. 2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge 4f3b6115fc [registrar] Extract code to create an NSArray from a managed array to a separate method. 2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge f83df952de [runtime] Report which element failed to convert when marshalling an array between Objective-C and managed code. 2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge ae879324a6 [registrar] Some more simplification. 2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge 02d2dfc60e [registrar] Don't let a failure to copy back a parameter go unnoticed.
Now that we ignore parameters we're not copying back, we can throw an
exception if we run into a parameter we don't know how to copy back.
2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge 5871040bb3 [registrar] Simplify code a bit and reduce indentation.
Best reviewed by ignoring whitespace.
2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge e80f4d5dca [registrar] Simplify copyback loop a little bit.
Simplify by having a single loop variable, and remove the usage of the
other ('ofs'), since it's not needed.
2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge a3278ff178 [registrar] Improve writeback logic for out/ref parameters.
* Keep track of which parameters needs to be written back. This makes sure the
  writeback loop doesn't run into non-writeback-parameters it doesn't know how
  to handle (by skipping them completely).

* Keep track of the (post-marshal) input to the out/ref parameters, so that we
  know whether we need to marshal anything back in the writeback loop.
2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge 9b60eebaef [registrar] Fix multiple ref/out parameters for a single method.
The previous code would break the loop looking for ref/out parameters after finding the first one.
2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge ad4cc04af9 [registrar] Refactor to reduce indentation a bit.
Best viewed by ignoring whitespace.
2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge 509c5be093 [registrar] Create a xamarin_nsstring_to_string to avoid code duplication. 2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge 2b5229fe46 [registrar] Create a xamarin_string_to_nsstring function to avoid code duplication. 2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge fc6b2c0a0d [runtime] Use a 'void*' for the context in conversion functions instead of 'guint32'.
No function changes, just a refactoring to allow for pointers as context.
2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge c8ed014af7
[runtime] Improve exception creation. (#5944)
* [runtime] Add an inner exception parameter to Runtime.CreateProductException.

This allows us to simplify code by using inner (and outer) exceptions as
a means to provide information instead of passing extra information
around in order to create decent exceptions.

One example is how we pass the selector and method name to the method
that converts from a native id to a managed NSObject instance: passing
this information is not necessary anymore if we can use two exceptions,
one for the failure to convert from an id to a NSObject instance,
wrapped in a second that tells which method/selector call ran into this
conversion problem.

* [runtime] Throw better exceptions when the dynamic registrar can't marshal something.

* [runtime] Throw a better exception when something goes wrong when trying to marshal a return value.

* [runtime] Use inner exceptions to convey failure information instead of trying to create a single exception with all we know.

* Fix merge problem.
2019-04-26 11:16:23 +02:00
Alexander Köplinger 7f717f01ae
Merge pull request #5563 from xamarin/mono-2019-02
Bump to mono:2019-02
2019-04-25 19:24:35 +02:00
Rolf Bjarne Kvinge aa4eaf7c92
Make a copy of the static registrar and the runtime headers for Xamarin.Mac/Classic. (#5945)
* [registrar] Make a copy of the static registrar for Xamarin.Mac/Classic.

Make a copy of the static registrar for Xamarin.Mac/Classic, one which is
compatible with the binary artifacts we ship for Xamarin.Mac/Classic
(libxammac, XamMac.dll).

This way the static registrar can evolve in the future, without breaking
Xamarin.Mac/Classic.

* [runtime] Make a copy of the runtime headers too.

* Update comment.

* [mmp] Delay creating a Target instance until we know if we're a Classic or Unified app.

Otherwise the wrong static registrar might be created.
2019-04-25 18:08:10 +02:00
Alexander Köplinger 99ea097abf Merge remote-tracking branch 'upstream/master' into mono-2019-02 2019-04-24 23:28:00 +02:00
Rolf Bjarne Kvinge df85569d23
[runtime] Rename CallState to XamarinCallState to keep the public namespace cleaner. (#5940)
Also ignore the corresponding public symbols in the PublicSymbols test.

This was introduced in 464882d14a (changes to
the CallState struct made the compiler create public symbols).

Fixes these test failures:

    1) Failed : Xamarin.Tests.Misc.PublicSymbols(iOS)
      Failed libraries
      Expected: <empty>
      But was:  "/work/maccore/master/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libxamarin-debug.a:
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    /work/maccore/master/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib/libxamarin-debug.a:
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    "
      at Xamarin.Tests.Misc.PublicSymbols (Xamarin.Tests.Profile profile) [0x00259] in /work/maccore/master/xamarin-macios/tests/mtouch/MiscTests.cs:196

    2) Failed : Xamarin.Tests.Misc.PublicSymbols(tvOS)
      Failed libraries
      Expected: <empty>
      But was:  "/work/maccore/master/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.AppleTVOS.sdk/usr/lib/libxamarin-debug.a:
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    /work/maccore/master/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.AppleTVSimulator.sdk/usr/lib/libxamarin-debug.a:
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    "
      at Xamarin.Tests.Misc.PublicSymbols (Xamarin.Tests.Profile profile) [0x00259] in /work/maccore/master/xamarin-macios/tests/mtouch/MiscTests.cs:196

    3) Failed : Xamarin.Tests.Misc.PublicSymbols(watchOS)
      Failed libraries
      Expected: <empty>
      But was:  "/work/maccore/master/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchOS.sdk/usr/lib/libxamarin-debug.a:
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    /work/maccore/master/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a:
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    "
      at Xamarin.Tests.Misc.PublicSymbols (Xamarin.Tests.Profile profile) [0x00259] in /work/maccore/master/xamarin-macios/tests/mtouch/MiscTests.cs:196

    4) Failed : Xamarin.Tests.Misc.PublicSymbols(macOSMobile)
      Failed libraries
      Expected: <empty>
      But was:  "/work/maccore/master/xamarin-macios/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/libxammac-debug.a:
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    /work/maccore/master/xamarin-macios/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/libxammac-system-debug.a:
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    /work/maccore/master/xamarin-macios/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/libxammac-system.a:
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    /work/maccore/master/xamarin-macios/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/libxammac.a:
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    "
      at Xamarin.Tests.Misc.PublicSymbols (Xamarin.Tests.Profile profile) [0x00259] in /work/maccore/master/xamarin-macios/tests/mtouch/MiscTests.cs:196
2019-04-23 16:53:35 +01:00
Rolf Bjarne Kvinge 37a4db8335
[registrar] Use the right method to get INativeObject handles. (#5935) 2019-04-23 14:10:51 +01:00
Rolf Bjarne Kvinge 3e75c76d89
[runtime] Get the domain at the top of xamarin_invoke_trampoline. (#5925)
This avoids calling it multiple times in a loop further down in the method.
2019-04-23 06:30:46 +01:00
Rolf Bjarne Kvinge 464882d14a
[runtime] Refactor a little bit to avoid code duplication. (#5924) 2019-04-23 06:29:20 +01:00
Chris Hamons 2278512aba [launcher] Pass --use-map-jit to mono on XM app startup
- Related: https://github.com/mono/mono/pull/13446
    - Patch by Miguel
2019-04-12 18:06:28 +02:00
Rolf Bjarne Kvinge 8792992b79
[registrar] Make Runtime.GetINativeObject_Static take token references instead of type names. (#5879)
Saves some space in the executable by using 32-bit sized integers instead of much longer strings.
2019-04-09 16:47:33 +02:00