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

2212 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 17f3cedc75 [tools] Rework GetAotArguments so we get the output in different variables, like the .NET AOT task requires it 2021-01-28 08:09:59 +01:00
Rolf Bjarne Kvinge 592ff8b931 [dotnet-tools] Make it compile. 2021-01-28 08:09:59 +01:00
Rolf Bjarne Kvinge 8f36d37659 [tools] Move Driver.GetAotArguments to shared code. 2021-01-28 08:09:59 +01:00
Rolf Bjarne Kvinge 03cef5c3c2 [dotnet-tools] Initialize EnableMSym on .NET 2021-01-28 08:09:59 +01:00
Rolf Bjarne Kvinge 96a2d84403 [tools] Move Application.EnableMSym from mtouch to shared code. 2021-01-28 08:09:59 +01:00
Rolf Bjarne Kvinge abffb528d1 [tools] Move the various Dlsym options/logic from mtouch to shared code 2021-01-28 08:09:59 +01:00
Rolf Bjarne Kvinge 32b13d4598 [tools] Move the DlsymOptions enum to its own file.
Also add it to mmp.
2021-01-28 08:09:59 +01:00
Rolf Bjarne Kvinge d75a455e45 [dotnet] Don't call mono_ee_interp_init in .NET.
It ends up asserting:

> * Assertion at /Users/runner/work/1/s/src/mono/mono/mini/interp/interp.c:7543, condition `!interp_init_done' not met

because it's already been called.
2021-01-28 08:09:59 +01:00
Rolf Bjarne Kvinge c80eed5d62 [tools] Pass and parse the MtouchInterpreter value. 2021-01-28 08:09:59 +01:00
VS MobileTools Engineering Service 2 04bdcdaa8c
[d16-9] [CI][VSTS] Use the creds store in git for https. (#10536) 2021-01-28 00:01:01 -05:00
VS MobileTools Engineering Service 2 fd1fc09999
[CI][VSTS] Fix needed in ESRP landed in the prod feed so we can use it now. (#10505)
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-01-27 17:18:59 -05:00
Manuel de la Pena 91ee3b8a34
[CI][VSTS] Use the creds store in git for https. (#10535)
VSTS is using https and not ssh to clone the repos, this means than if
we have any bash that uses git, it will fail. Cred store fixes this by
removing the need to pass the token in all bash scripts.

We remove allways the cred store once we are done.
2021-01-27 15:25:38 -05:00
VS MobileTools Engineering Service 2 9c98dcf844
[CI][VSTS] Do not use ESRP when no pkgs is present or in a PR. (#10527)
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-01-26 19:34:22 -05:00
Manuel de la Pena 22a5ba1199
[CI][VSTS] Do not use ESRP when no pkgs is present or in a PR. (#10516) 2021-01-26 13:26:27 -05:00
VS MobileTools Engineering Service 2 505e29a8bb
[CI][VSTS] Set to no output vars back to be in the env. (#10519)
If we set the variables as output variables they are not accessible by
the bash scripts resulting in a warning.

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-01-26 13:26:15 -05:00
Manuel de la Pena a3b7520b98
[CI][VSTS] Set to no output vars back to be in the env. (#10515)
If we set the variables as output variables they are not accessible by
the bash scripts resulting in a warning.
2021-01-25 15:38:01 -05:00
VS MobileTools Engineering Service 2 9987f73e6e
[mtouch] Fix embedding Mono (and Xamarin) as frameworks. Fixes #10382 (#10471)
This broke with 1582bf47cc and cause the
frameworks to be nested under another `Frameworks` directory.

See https://github.com/xamarin/xamarin-macios/issues/10382

Co-authored-by: Sebastien Pouliot <sebastien.pouliot@microsoft.com>
2021-01-25 10:14:21 -05:00
VS MobileTools Engineering Service 2 6219f7a59e
[d16-9] [CI][VSTS] Add a poor mans debugger. (#10502)
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-01-22 14:09:46 -05:00
Manuel de la Pena b3469fd5a0
[CI][VSTS] Fix needed in ESRP landed in the prod feed so we can use it now. (#10494) 2021-01-22 12:13:01 -05:00
VS MobileTools Engineering Service 2 38c2919a0c
[CI][VSTS] Ensure that the required simulators are present in the machine. (#10496)
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-01-22 10:14:23 -05:00
VS MobileTools Engineering Service 2 914f8192b9
[CI][VSTS] Continue on profiles failure. (#10499)
We want to continue and generate the pkgs, the failure of this step only
results in failing tests.

fixes: https://github.com/xamarin/maccore/issues/2376

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-01-22 10:12:26 -05:00
Manuel de la Pena 5dbc349c0b
[CI][VSTS] Add a poor mans debugger. (#10495) 2021-01-22 10:08:51 -05:00
Manuel de la Pena 335ac8fe15
[CI][VSTS] Continue on profiles failure. (#10487)
We want to continue and generate the pkgs, the failure of this step only
results in failing tests.

fixes: https://github.com/xamarin/maccore/issues/2376
2021-01-21 15:20:00 -05:00
VS MobileTools Engineering Service 2 b252d8c232
[d16-9] [VSTS][CI] Add links with the generated pkgs. (#10489)
We do have the pkgs when we have not been triggered by a PR.


Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-01-21 15:18:53 -05:00
Manuel de la Pena ad72f32e30
[CI][VSTS] Ensure that the required simulators are present in the machine. (#10486) 2021-01-21 15:16:36 -05:00
VS MobileTools Engineering Service 2 35833cd28b
[CI][VSTS] Remove ALL .xip (#10491)
This is clearly something that has a human behind it and not a script. We
have seen Xcode*.xip which is the download name BUT also xcode12.xip
which looks like a point&click intervention
(https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=4387395&view=logs&j=f0137cdf-e292-5541-69aa-72303a08a0ba&t=59bea1c0-f907-5818-000e-f6fef9d3ffa2&l=234)

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-01-21 13:57:36 -05:00
VS MobileTools Engineering Service 2 7ee11daba7
[d16-9] [CI][VSTS] Move to ESRP for notarization. (#10484)
This change perse does not do other thing than removing the use of
virtuanenv and remove the installation of python-magic.

We have taken this approach because the images that will be used to provision the CI
bots will have python-magic installed by default. We want to do this
because:

1. CI should not be modifying the machine, we do not install any pkg.
2. python-magic should be present, if not, we will get an import error
   and we will know how to fix it (re-image).

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-01-21 09:52:06 -05:00
Manuel de la Pena 8ec5937de7
[CI][VSTS] Remove ALL .xip (#10483)
This is clearly something that has a human behind it and not a script. We
have seen Xcode*.xip which is the download name BUT also xcode12.xip
which looks like a point&click intervention
(https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=4387395&view=logs&j=f0137cdf-e292-5541-69aa-72303a08a0ba&t=59bea1c0-f907-5818-000e-f6fef9d3ffa2&l=234)
2021-01-21 09:47:34 -05:00
Manuel de la Pena 197c114702
[VSTS][CI] Add links with the generated pkgs. (#10481) 2021-01-21 09:43:27 -05:00
Manuel de la Pena 6cebeca4db
[CI][VSTS] Move to ESRP for notarization. (#10444)
This change perse does not do other thing than removing the use of
virtuanenv and remove the installation of python-magic.

We have taken this approach because the images that will be used to provision the CI
bots will have python-magic installed by default. We want to do this
because:

1. CI should not be modifying the machine, we do not install any pkg.
2. python-magic should be present, if not, we will get an import error
   and we will know how to fix it (re-image).
2021-01-20 13:09:17 -05:00
VS MobileTools Engineering Service 2 fa7399f8bc
[CI][VSTS] Remove warning from mac tests upload. (#10464)
The template does not expand wildcards. The template does not know how to
reuse paths.

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-01-20 07:48:27 -05:00
VS MobileTools Engineering Service 2 540c429a3d
[d16-9] [CI][VSTS] Add required profiles for mac. (#10395)
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-01-20 07:46:30 -05:00
Rolf Bjarne Kvinge ae2243adad
[dotnet-linker] Delete unnecessary NuGet.config. (#10466) 2021-01-20 12:24:11 +01:00
Rolf Bjarne Kvinge c0ecd33bf9
[mlaunch] Improve make logic to only install bin/mlaunch if it changed. (#10461)
This way the bin directory doesn't unnecessarily get an updated timestamp, so
that some build targets in the dotnet/ directory don't rebuild unnecessarily.
2021-01-20 08:16:28 +01:00
Manuel de la Pena 0aa7d32d79
[CI][VSTS] Remove warning from mac tests upload. (#10442)
The template does not expand wildcards. The template does not know how to
reuse paths.
2021-01-19 11:25:50 -05:00
Sebastien Pouliot 77c154df35
[mtouch][mmp] Exclude extraneous framework files from being copied into apps (#10441)
Today both `mtouch` and `mmp` are copying the entire `.framework`
directories inside the `.app\[Contents\]Frameworks\` directory.

However not everything in a framework is required at runtime. The most
common unrequired files would be headers (`Headers/*.h`) and modules
(`Modules/*`).

Looking at Xcode build output we can see something like:

```
builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -exclude Headers -exclude PrivateHeaders -exclude Modules -exclude \*.tbd -bitcode-strip replace-with-marker -bitcode-strip-tool
```

which excludes a few more, less common, files.

This _builtin_ command is not available externally (for us to re-use)
but it hints that Xcode is likely using `rsync` to avoid copying part of
the files.

Note: the builtin command also _likely_ calls `bitcode_strip` too (or has
similar code embedded) and `mtouch` already does so too

There's a cost to spawning an external process, like `rsync`, which we
avoid by having our own file copier, which clones files (almost zero
cost). That does not support excluding files, but deleting files is also
very cheap. Testing shows copying a framework to be less than 1 ms, even
with with extra deletion step.

* Tweak `GetRealPath` to optionally not to warn if the path does not exists

since, in this case, it's a check we want to do after resolving the path

This fixes several (5) MTouch tests looking for specific (and no extra)
warnings

```
Unable to canonicalize the path '/Users/builder/azdo/_work/2/s/xamarin-macios/tests/mtouch/bin/Debug/tmp-test-dir/Xamarin.Tests.BundlerTool.CreateTemporaryDirectory195/testApp.app/Frameworks/Mono.framework/CVS': No such file or directory (2).
```
2021-01-19 08:48:10 -05:00
Sebastien Pouliot 56d073317a
[tools] Do not check the existing of a file before deleting it (#10443)
because:

> If the file to be deleted does not exist, no exception is thrown.

https://docs.microsoft.com/en-us/dotnet/api/system.io.file.delete?view=net-5.0

and yes this is different from `Directory.Delete` and PR https://github.com/xamarin/xamarin-macios/pull/10441

* Fix MT0015 test failure

The MT0015 test creates a directory where a file is expected.

That's fine except the code for handling this was a bit weird. It
worked because of a `TryDelete` on the path, which avoided the
`UnauthorizedAccessException` when `File.Delete` is used on a path.
Then later there's a `Directory.Exists` check that would throw...

The code now does the `Directory.Exists` first and only call
`File.Delete` if it returns false. The throwing of the exception
is kept since the code (and test) are already present (and this
minimize changes and chance of other surprises)
2021-01-19 08:29:11 -05:00
Rolf Bjarne Kvinge 3dbdc1ea81
[dotnet-linker] Add the RemoveUserResources sub step. (#10456)
* [dotnet-linker] Add the RemoveUserResources sub step.

This comes with a few changes to the RemoveUserResources sub step as well:

* Bail out earlier if we're in the simulator (no need to do any processing at
  all - we know at the very beginning if we're building for the simulator).
* Do a positive simulator check, instead of a negative device check (because
  Mac[Catalyst] are neither devices - so they pass the negative device check).
* Remove all the conditional mtouch/mmp code, and figure out at runtime which
  resource prefixes we need to check for.

It was also necessary to change where steps are added to the pipeline: we have
to remove resources before the OutputStep, but at the same time we have to do
it after the ExtractBindingLibraries step, otherwise the
ExtractBindingLibraries step won't find any binding libraries to extract. So
move the ExtractBindingLibraries, LoadNonSkippedAssemblies and
ListExportedSymbols to before the OutputStep (to keep their internal order),
and then add the RemoveUserResources after those.

This fixes the following link sdk/link all test when running on device:

    BundledResources.ResourcesTest
        [FAIL] Bundled :   No resources
            Expected: 0
            But was:  2

* [tests] Update the BuildInterdependentBindingProjects test now that we're removing resources.
2021-01-19 14:06:25 +01:00
Rolf Bjarne Kvinge fc5ae53649
[dotnet] Bump ILLink to get an updated linker reference assembly. (#10450)
This allows us to undo a workaround we made for a missing API in the linker
reference assembly (an AnnotationStore.AddPreservedMethod overload).

This also requires a change to use MessageContainer.CreateCustomErrorMessage
instead of MessageContainer.CreateErrorMessage, because apparently having a
reference assembly doesn't mean there can't be incompatible changes in it 😒.
2021-01-18 14:28:31 +01:00
VS MobileTools Engineering Service 2 f0b4e54ae4
[CI][VSTS] If comments are too large, provide a gist. (#10433)
Github has a limited size for messages in comments. If we did reach that
limit, we create a gist to show all the results.

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-01-15 10:16:40 -05:00
Manuel de la Pena 518657ba15
[CI][VSTS] If comments are too large, provide a gist. (#10431)
Github has a limited size for messages in comments. If we did reach that
limit, we create a gist to show all the results.
2021-01-14 18:33:22 -05:00
VS MobileTools Engineering Service 2 5597dcb332
[d16-9] [CI][VSTS] When webservers are rude, retry (#10429)
Perseverance is failing 19 times and succeeding the 20th.

fix: https://github.com/xamarin/maccore/issues/2361

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-01-14 16:57:54 -05:00
VS MobileTools Engineering Service 2 201ef3c1ce
[d16-9] [CI][VSTS] Clean .xip files. (#10417)
At some point either due to a manual error or a bug in provisionator a
*.xip file was left behind. Those files make provisioantor fail, for
example: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=4361631&view=logs&j=f0137cdf-e292-5541-69aa-72303a08a0ba&t=59bea1c0-f907-5818-000e-f6fef9d3ffa2&l=230

We will remove those files to make sure provisionator works and we get
device tests back.

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-01-14 12:36:58 -05:00
Manuel de la Pena 4f3b942a78
[CI][VSTS] When webservers are rude, retry (#10411)
Perseverance is failing 19 times and succeeding the 20th.

fix: https://github.com/xamarin/maccore/issues/2361
2021-01-14 12:34:42 -05:00
Sebastien Pouliot 05e28c3713
[macos] Add correct support for producing/archiving `dSYM` (#10409)
TL&DR: This PR

1. Removes the creation of the `.dSYM` based on `Debug Information` [1]

2. Adds dSYM support to XM msbuild (now shared with XI implementation)

3. Archive the `.dSYM` directories (plural) properly, e.g.

```
msbuild -p:Configuration=Release -p:ArchiveOnBuild=true
```

Why ? The long story...

Historically `.dSYM` for Xamarin.Mac have not been very useful, largely
because (most of) the code is JITed so not much is known before runtime.
So they were simply not generated during the builds...

However AOT options were added to Xamarin.Mac, making them potentially
more useful. Also symbols from `libmono` and other native libraries /
frameworks can prove useful when diagnosing application crashes.

Unsurprisingly developers looking to get symbols eventually found _a way_
[1] to get a `.dSYM` for their applications - but it was not quite
correct because:

* setting the debug information option meant that `mmp` would be supplied with `-debug`. This disables several optimizations that are, by default, enabled for release builds. IOW generating symbols should have no effect on the executing code (but it had);

* it was produced when compiling the native launcher, so the symbols coverage was incomplete. How much depends if mono was statically or dynamically linked. However this would not cover any AOTed code nor bundled libraries or user frameworks.

* the .dSYM was produced inside the `x.app/Contents/MacOS/`, side-by-side with the native executable, which makes it part of the **signed** `.app` and also part of the created (and signed) `.pkg`. This had a large impact on the application's, disk and download, size(s). Manually (re)moving the `.dSYM` means re-signing the app and re-creating (and signing) the `.pkg` is not a good solution.

[1] https://forums.xamarin.com/discussion/139705/how-to-symbolicate-a-xam-mac-crash-log

Additional fixes

* Use `Directory.Move` instead of running the `mv` command

While the result is identical there is a cost to spawn several `mv`
processes. Doing it in parallel (might have) helped but that setup
also comes at a cost.

`Directory.Move` the four `.dylib.dSYM` of an app takes 1 ms, while
the existing code took 17 ms to do the same.

* Fix building mmptest since the DeleteDebugSymbolCommand constant is not present (nor used) anymore
2021-01-14 08:42:24 -05:00
Rolf Bjarne Kvinge 7584ada30d
Bump to .NET 6.0.100-alpha.1.21060.3. (#10388)
* Bump to .NET 6.0.100-alpha.1.21060.3.

* Fix dotnet command line arguments.

* dotnet build: the project file must be the first argument.
* dotnet build/publish: use the documented verbosity format.

* Update version number in tests.

* [tests/introspection] Adjust introspection to cope with different library names in the new .NET version.

* [tests/link sdk] Adjust the LinkSdkRegressionTest.SpecialFolder test according to the new version of .NET 6.

* [tests/link sdk] Preserve a required method in System.Private.CoreLib to work around a bug in .NET 6.

Ref: https://github.com/dotnet/runtime/issues/46908.

* Revert "[CI][VSTS] Add the donet 6 pkg as a dependency. (#10348)"

This reverts commit 6de4e717e7.

There's no need to provision .NET 6, it's done automatically.
2021-01-14 14:07:28 +01:00
Rolf Bjarne Kvinge cfb32cba09
[dotnet-linker] Link with GSS when building for iOS/Mac Catalyst. (#10414)
* [dotnet-linker] Add support for writing to the same MSBuild output items multiple times.

* Split parts of LinkerConfiguration.WriteOutputForMSBuild into a FlushOutputForMSBuild
  method (the part that does the actual writing).
* Make WriteOutputForMSBuild just store the items in a dictionary.
* Add a DoneStep that runs at the very end and that writes out the MSBuild output
  items.

* [dotnet-linker] Link with GSS when building for iOS/Mac Catalyst.

Add a ComputeNativeBuildFlagsStep, which computes the flags to pass to the native
compiler + native linker. This is currently a very simple implementation, but it
will become more complex as support for missing features are added.

GSS is required because of libSystem.Net.Security.Native.a:

    Undefined symbols for architecture arm64:
      "___gss_c_nt_hostbased_service_oid_desc", referenced from:
          _NetSecurityNative_ImportPrincipalName in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "___gss_c_nt_user_name_oid_desc", referenced from:
          _NetSecurityNative_ImportUserName in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "___gss_krb5_cred_no_ci_flags_x_oid_desc", referenced from:
          _NetSecurityNative_InitiateCredSpNego in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          _NetSecurityNative_InitiateCredWithPassword in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "___gss_krb5_mechanism_oid_desc", referenced from:
          _NetSecurityNative_InitSecContext in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          _NetSecurityNative_InitSecContextEx in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "___gss_ntlm_mechanism_oid_desc", referenced from:
          _NetSecurityNative_InitSecContext in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          _NetSecurityNative_InitSecContextEx in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          _NetSecurityNative_AcceptSecContext in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          _NetSecurityNative_IsNtlmInstalled in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "___gss_spnego_mechanism_oid_desc", referenced from:
          _NetSecurityNative_InitSecContext in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          _NetSecurityNative_InitSecContextEx in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          l___const.NetSecurityNative_AcquireCredSpNego.gss_mech_spnego_OID_set_desc in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_accept_sec_context", referenced from:
          _NetSecurityNative_AcceptSecContext in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_acquire_cred", referenced from:
          _NetSecurityNative_InitiateCredSpNego in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          _NetSecurityNative_AcquireAcceptorCred in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_acquire_cred_with_password", referenced from:
          _NetSecurityNative_InitiateCredWithPassword in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_delete_sec_context", referenced from:
          _NetSecurityNative_DeleteSecContext in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_display_name", referenced from:
          _NetSecurityNative_GetUser in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_display_status", referenced from:
          _NetSecurityNative_DisplayMinorStatus in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          _NetSecurityNative_DisplayMajorStatus in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_import_name", referenced from:
          _NetSecurityNative_ImportUserName in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          _NetSecurityNative_ImportPrincipalName in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_indicate_mechs", referenced from:
          _NetSecurityNative_IsNtlmInstalled in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_init_sec_context", referenced from:
          _NetSecurityNative_InitSecContext in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          _NetSecurityNative_InitSecContextEx in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_inquire_context", referenced from:
          _NetSecurityNative_GetUser in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_oid_equal", referenced from:
          _NetSecurityNative_InitSecContext in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          _NetSecurityNative_InitSecContextEx in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          _NetSecurityNative_AcceptSecContext in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_release_buffer", referenced from:
          _NetSecurityNative_ReleaseGssBuffer in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_release_cred", referenced from:
          _NetSecurityNative_ReleaseCred in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_release_name", referenced from:
          _NetSecurityNative_GetUser in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          _NetSecurityNative_ReleaseName in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_release_oid_set", referenced from:
          _NetSecurityNative_IsNtlmInstalled in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_set_cred_option", referenced from:
          _NetSecurityNative_InitiateCredSpNego in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          _NetSecurityNative_InitiateCredWithPassword in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_unwrap", referenced from:
          _NetSecurityNative_Unwrap in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_wrap", referenced from:
          _NetSecurityNative_Wrap in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
    ld: symbol(s) not found for architecture arm64
2021-01-14 07:50:49 +01:00
vs-mobiletools-engineering-service2 4ffd1d9062
[d16-9] [CI][VSTS] Add links to the created pkgs. (#10393)
Add a list with all the pkgs created to make users life better.

fixes: https://github.com/xamarin/xamarin-macios/issues/10298



Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-01-13 16:14:08 -05:00
Manuel de la Pena 9d1ce6130b
[CI][VSTS] Clean .xip files. (#10398)
At some point either due to a manual error or a bug in provisionator a
*.xip file was left behind. Those files make provisioantor fail, for
example: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=4361631&view=logs&j=f0137cdf-e292-5541-69aa-72303a08a0ba&t=59bea1c0-f907-5818-000e-f6fef9d3ffa2&l=230

We will remove those files to make sure provisionator works and we get
device tests back.


Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-01-13 16:12:53 -05:00
Mike Bond 39409c6216
YAML build: Dump environment steps: Include HOSTNAME (#10397) 2021-01-13 09:47:58 -08:00
vs-mobiletools-engineering-service2 dcbe96c1f5
[d16-9] [CI][VSTS] Add a better title for the comments. (#10392)
Remove the misleading title 'Device tests..' for 'Tests..'. The message
already contains the context of the test execution, it can be:

* Build
* VSTS: device tests iOS32b
* VSTS: device tests tvOS
* VSTS: device tests iOS

Removing the 'Device' word is enough to do not confuse users.

fixes: https://github.com/xamarin/maccore/issues/2358

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-01-13 09:37:29 -05:00
vs-mobiletools-engineering-service2 09e87fc3cc
[CI][VSTS] Rename path to fix API diff (#10389)
Since 'packages' is a common dir name that is ignored. Revert the change
in the .gitignore and rename the template path since it just means a one
liner change in the entry yaml file.

fixes: https://github.com/xamarin/maccore/issues/2359

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-01-13 09:34:58 -05:00
Sebastien Pouliot d9b0097c3b
[mtouch] Fix embedding Mono (and Xamarin) as frameworks. Fixes #10382 (#10400)
This broke with 1582bf47cc and cause the
frameworks to be nested under another `Frameworks` directory.

See https://github.com/xamarin/xamarin-macios/issues/10382
2021-01-13 08:22:55 -05:00
Sebastien Pouliot 734b8a7f2a
[msbuild] Simplify resolving xcframeworks (#10376)
TD&LR: This PR simplifies how we refer to user frameworks and fixes both
warnings and non-optimal (app) output.

Much longer story:

Additional testing on macOS showed some build-time warnings and an
[extra (dupe) file](a20f8aba41 (diff-54fd7d9cd5deae57f30195be0a43133eace03c1132401741a317e0ae8d5e13fdR34)).

Logs shows that we referred to the xcframework several times, where once
should have been enough.

```
/native-reference:/Users/poupou/git/spouliot/xcframework/Universal.xcframework
/native-reference:/Users/poupou/git/spouliot/xcframework/Universal.xcframework/macos-arm64_x86_64/Universal.framework
/native-reference:/Users/poupou/git/spouliot/xcframework/Universal.xcframework/macos-arm64_x86_64/Universal.framework/Universal
```

The first `/native-reference` line produced a warning like:

```
MMP warning MM2006: Native library 'Universal.xcframework' was referenced but could not be found.
```

which makes sense as the tools (both `mmp` and `mtouch`) are not, by
design, aware of (unresolved) xcframeworks.

Removing `{NativeReference}` from `Xamarin.Mac.Common.targets` (and
`Xamarin.iOS.Common.targets`) as it has already been processed by
`_ExpandNativeReferences` solves this.

The other part of the issue (next two lines) is because `msbuild` does
not track changes to directories like it does for files - and the
workaround (in `_ExpandNativeReferences`) had to be copied in other
places (both XI and XM `_CompileToNative`) and that was not enough (and
would eventually need to be duplicated again and again).

This could lead to duplicate entries (i msbuild logs) like

```
NativeReferences
../../Universal.xcframework/macos-arm64_x86_64/Universal.framework
../../Universal.xcframework/macos-arm64_x86_64/Universal.framework/Univeral
```
which maps to our extra entries.

In order to simplify things we make the `_ExpandNativeReferences` resolve
the full path to the library name (not the `.framework` directory) which
simplifies both `_CompileToNative` and ensure a single way (at least for
`msbuild`) to provide this data to the tools (`mmp` and `mtouch`).

Using a file, instead of a directory, is also more consistent for the
existing `-framework` option, e.g. we provide the names like:

```
--framework=CoreLocation
--framework=ModelIO
```

So adding a full path that include the name is more appropriate, e.g.

``` --framework=/Users/poupou/git/master/xamarin-macios/tests/xharness/tmp-test-dir/xcframework-test760/bin/AnyCPU/Debug/bindings-xcframework-test.resources/XTest.xcframework/ios-i386_x86_64-simulator/XTest.framework/XTest
```

Finally for macOS applications it turns out we were embedding yet another
copy of the framework's library inside the `MonoBundle`, which is clearly
wrong, because of the last entry.

```
$ l bin/Release/xcf-mac.app/Contents/MonoBundle/Universal
-rwxr-xr-x  1 poupou  staff  167152  2 Dec 16:16 bin/Release/xcf-mac.app/Contents/MonoBundle/Universal
```

The tool now checks if a provided library is inside a framework (or not)
which is a good validation to have anyway when it gets called directly,
i.e. not thru `msbuild`.
2021-01-12 16:02:01 -05:00
Manuel de la Pena 8f25850c20
[CI][VSTS] Add required profiles for mac. (#10366)
fixes: xamarin/maccore#2357
2021-01-12 15:29:49 -05:00
Manuel de la Pena ec38f76ab1
[CI][VSTS] Add links to the created pkgs. (#10360)
Add a list with all the pkgs created to make users life better.

fixes: https://github.com/xamarin/xamarin-macios/issues/10298
2021-01-12 15:20:54 -05:00
Manuel de la Pena bd76b393f2
[CI][VSTS] Add a better title for the comments. (#10383)
Remove the misleading title 'Device tests..' for 'Tests..'. The message
already contains the context of the test execution, it can be:

* Build
* VSTS: device tests iOS32b
* VSTS: device tests tvOS
* VSTS: device tests iOS

Removing the 'Device' word is enough to do not confuse users.

fixes: https://github.com/xamarin/maccore/issues/2358
2021-01-12 12:33:23 -05:00
Manuel de la Pena 3e7464e461
[CI][VSTS] Rename path to fix API diff (#10384)
Since 'packages' is a common dir name that is ignored. Revert the change
in the .gitignore and rename the template path since it just means a one
liner change in the entry yaml file.

fixes: https://github.com/xamarin/maccore/issues/2359
2021-01-12 11:32:26 -05:00
vs-mobiletools-engineering-service2 ecf6871265
[CI][VSTS] Add trigger for xcode branches. (#10363)
fixes: https://github.com/xamarin/maccore/issues/2355

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-01-08 12:32:35 -05:00
Manuel de la Pena e2db8536f4
[CI][VSTS] Add trigger for xcode branches. (#10349)
fixes: https://github.com/xamarin/maccore/issues/2355
2021-01-07 17:30:50 -05:00
vs-mobiletools-engineering-service2 a593dc8c11
[CI][VSTS] Ensure that xharness creates an index with the correct uris. (#10351)
The prefix of the location of the logs depends on the platform where it
was executed (else we step on them) but that was not added in the env
var use by xharness.

fixes: https://github.com/xamarin/maccore/issues/2349

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-01-07 15:42:24 -05:00
vs-mobiletools-engineering-service2 1264be3ee9
[d16-9] [CI][VSTS] Add comments to PR not only to commits. (#10357)
The GitHup url to be used to create comments in PRs is diff to the one
for comments. Use the build reason AND the changeID to identify if we
are building due to a PR and use the correct url.

fixes: https://github.com/xamarin/maccore/issues/2356

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
Co-authored-by: Alex Soto <alex@alexsoto.me>
2021-01-07 15:33:34 -05:00
vs-mobiletools-engineering-service2 89877232f1
[CI][VSTS] Add the correct mac pkg file name. (#10353)
The wrong variable was used and therefore the dir path was used instead
of the mac pkg name.

fixes: https://github.com/xamarin/maccore/issues/2353

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-01-07 12:02:30 -05:00
Sebastien Pouliot 89482b5d5b
[macos] Handle symlinks in user frameworks (#10281)
User frameworks for macOS often uses symlinks (as Xcode creates them
this way).

This cause problem cause the symlink is on the binary and we expected
the `_CodeSignature` directory to by side-by-side with the binary. This
was missing and cause exceptions when codesigning such frameworks.

A second problem happened because `mmp` use `lipo -thin` to remove
non-required architectures. However when a framework has symlinks, like:

```
├── Frameworks
│   └── Universal.framework
│       ├── Resources -> Versions/Current/Resources
│       ├── Universal -> Versions/Current/Universal
│       └── Versions
│           ├── A
│           │   ├── Resources
│           │   │   └── Info.plist
│           │   ├── Universal
│           │   └── _CodeSignature
│           │       └── CodeResources
│           └── Current -> A
```

then this actually replaced the (very small) symlink with a thin version
of the framework. Which means the original one was still _fat_ and the
whole app was now larger than the original version.

Sample used: https://github.com/spouliot/xcframework/tree/main/xamarin/xcf-mac
2021-01-07 11:20:31 -05:00
Manuel de la Pena 4396368851
[CI][VSTS] Add comments to PR not only to commits. (#10350)
The GitHup url to be used to create comments in PRs is diff to the one
for comments. Use the build reason AND the changeID to identify if we
are building due to a PR and use the correct url.

fixes: https://github.com/xamarin/maccore/issues/2356

Co-authored-by: Alex Soto <alex@alexsoto.me>
2021-01-07 10:57:49 -05:00
Manuel de la Pena 6de4e717e7
[CI][VSTS] Add the donet 6 pkg as a dependency. (#10348)
Ensure that the new dotnet 6 is installed so that we do build with the
support for it.

fixes: https://github.com/xamarin/maccore/issues/2354
2021-01-06 18:21:46 -05:00
Manuel de la Pena 7a06a22be4
[CI][VSTS] Add the correct mac pkg file name. (#10347)
The wrong variable was used and therefore the dir path was used instead
of the mac pkg name.

fixes: https://github.com/xamarin/maccore/issues/2353
2021-01-06 18:18:24 -05:00
Manuel de la Pena e1cfe7c500
[VSTS] Move away from Jenkins to VSTS pipelines for xamarin-macios. (#10302) (#10343)
Initial implementation of the projects CI in yaml to be uses with VSTS. The port is not complete as there are some small issues to address, the following are the known issues:

* https://github.com/xamarin/maccore/issues/2349 
* https://github.com/xamarin/maccore/issues/2350
* https://github.com/xamarin/xamarin-macios/issues/10299
* https://github.com/xamarin/xamarin-macios/issues/10298
* https://github.com/xamarin/xamarin-macios/issues/10300
* https://github.com/xamarin/maccore/issues/2351

Nevertheless the CI already compiles the project, creates the pkgs and nugets and publishes them so that we can create insertions.

Co-authored-by: Mike Bond <mjbond-msft@outlook.com>
Co-authored-by: cadsit <connor.adsit@gmail.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-01-06 16:26:21 -05:00
Manuel de la Pena 30f0010184
[CI][VSTS] Ensure that xharness creates an index with the correct uris. (#10345)
The prefix of the location of the logs depends on the platform where it
was executed (else we step on them) but that was not added in the env
var use by xharness.

fixes: https://github.com/xamarin/maccore/issues/2349
2021-01-06 15:33:57 -05:00
Manuel de la Pena 1e78a9de6a
[VSTS] Move away from Jenkins to VSTS pipelines for xamarin-macios. (#10302)
Initial implementation of the projects CI in yaml to be uses with VSTS. The port is not complete as there are some small issues to address, the following are the known issues:

* https://github.com/xamarin/maccore/issues/2349 
* https://github.com/xamarin/maccore/issues/2350
* https://github.com/xamarin/xamarin-macios/issues/10299
* https://github.com/xamarin/xamarin-macios/issues/10298
* https://github.com/xamarin/xamarin-macios/issues/10300
* https://github.com/xamarin/maccore/issues/2351

Nevertheless the CI already compiles the project, creates the pkgs and nugets and publishes them so that we can create insertions.


Co-authored-by: Mike Bond <mjbond-msft@outlook.com>
Co-authored-by: cadsit <connor.adsit@gmail.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-01-06 10:48:54 -05:00
Rolf Bjarne Kvinge 61bd40e39c
[mtouch] Allow referencing Xamarin.iOS.dll in a Mac Catalyst app. (#10318) 2020-12-18 16:47:08 +01:00
Alex Soto 04461cd5c8
Merge pull request #10306 from dalexsoto/main-xcode12.3
[main] Merge xcode12.3 into main
2020-12-17 15:20:24 -05:00
Rolf Bjarne Kvinge 1582bf47cc
Add support for binding projects in Mac Catalyst. Fixes #10286. (#10295)
* [tests] Build test-libraries for Mac Catalyst.

* [msbuild] Add support for Mac Catalyst binding projects.

* [mtouch] Allow frameworks for Mac Catalyst apps.

* [mtouch] Put frameworks in the expected location for Mac Catalyst apps.

* [msbuild] Create the Resources directory before trying to put files in it.
2020-12-17 18:53:16 +01:00
Alex Soto bd16f26f88 Merge remote-tracking branch 'xamarin/xcode12.3' into main 2020-12-15 23:50:18 -05:00
Rolf Bjarne Kvinge bf847323a0
Replace manually maintained code about frameworks with generated code. (#10218)
* [src] Generate the string constants for each framework from our list of frameworks.

This makes it less error prone to add new frameworks (one less place to add
them), and easier to add new platforms (only one place to make sure the list
of frameworks is correct).

This also revelead a few issues in our list of frameworks (missing frameworks,
frameworks that have been moved, etc.), which have been fixed.

* [mmp] Generate the library path -> namespace map for the linker to optimize away dlopen statements.

* Fix indentation to be just as broken as the surrounding indentation.

* Remove unused Cecil reference.

* Fix c&p oversight.

* Adjust more Mac Catalyst API.

* CFNetwork is its own top-level framework.
2020-12-15 18:44:05 +01:00
Manuel de la Pena 896479e1bd
[VSTS] Remove all the device pipelines. (#10280)
With the migration away from Jenkins, we do not longer ping them.
2020-12-14 16:43:06 -05:00
Rolf Bjarne Kvinge 9a20a26694
[compare-commits] Rework logic to build xamarin-macios again from a separate clone. (#10264)
Rework the code to generate an API comparison and a generator comparison: we
now clone xamarin-macios into a different directory, checks out the hash we
want to compare against, build the whole thing, and then compare the results.

This is somewhat slower than the previous implementation (which would checkout
the previous hash and build that on top of the existing build), but since we
don't have to build mono, it shouldn't make too much of a difference (the
biggest chunk of our build is building src/, and we had to do that anyway with
the previous implementation as well).

The upside is that it should be much more reliable.

Fixes https://github.com/xamarin/maccore/issues/2034.
Fixes https://github.com/xamarin/maccore/issues/1467.
Fixes https://github.com/xamarin/maccore/issues/1059.
Maybe https://github.com/xamarin/maccore/issues/1173 too.
2020-12-12 16:27:16 -05:00
Rolf Bjarne Kvinge 38531bdcab
[CallKit] Add to macOS. (#10244) 2020-12-10 11:37:15 +01:00
Rolf Bjarne Kvinge 88039ea35b
[compare-commits] Fix building the previous commit for Xamarin.MacCatalyst. Fixes #10222. (#10242)
Fixes https://github.com/xamarin/xamarin-macios/issues/10222.
2020-12-09 15:29:57 +01:00
Alex Soto 8830d0c088
Merge pull request #10196 from dalexsoto/xcode12.3-watchsim64
[Xcode12.3] [watchOS] Add x86_64 simulator support (#10059)
2020-12-08 08:04:53 -05:00
Sebastien Pouliot 16cd30a42c
[adservices] New in Xcode 12.3 beta 1 (#10229)
Annotations suggest that it's available on tvOS 14.3 but the headers
are not shipped in tvOS SDK.
2020-12-07 20:00:38 -05:00
Rolf Bjarne Kvinge daa7e123e2
Add very early support for Mac Catalyst. (#10199)
* Install the Mac Catalyst versions of the mono libraries and BCL.
   * The BCL is the same as the one for Xamarin.iOS, which means it has to be post-processed a bit to work with a Xamarin.MacCatalyst.dll
* Build our runtime for Mac Catalyst.
* Build a Xamarin.MacCatalyst.dll with the Mac Catalyst API (it compiles, but I haven't looked at the API surface at all). This PR assumes we're going to have a new TargetFrameworkIdentifier for Mac Catalyst, but a final decision has not been made (see https://github.com/dotnet/runtime/issues/44882), so this may change.
* Build a Xamarin.iOS.dll that contains type forwarders to Mac Catalyst for all the types that exist in both Mac Catalyst and Xamarin.iOS.
* Add support to xharness for running introspection on Mac Catalyst (there are a lot of failures because the API surface is wrong)
* Add support to our msbuild tasks and mtouch for building Mac Catalyst apps. This basically comes down to adding a new case in numerous places to either do things the iOS way or the macOS way, depending on each case.
* Add a __MACCATALYST__ define (which is in addition to the __IOS__ define).
2020-12-04 18:27:37 +01:00
monojenkins e7855bcca1
[VSTS] If we fail dumping the env, continue. (#10202)
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2020-12-04 06:03:40 -05:00
monojenkins 1bc6fa3fd4
[VSTS] Ensure that we have a reasonable timeout. Will unblock device tests. (#10206)
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2020-12-04 06:03:05 -05:00
Manuel de la Pena fdfed3f74f
[VSTS] Ensure that we have a reasonable timeout. Will unblock device tests. (#10204) 2020-12-03 18:16:27 -05:00
Filip Navara 17722deab4
[dotnet] Prevent linking out code referenced by P/Invoke (#10182)
* [dotnet] Generate references.mm to prevent linking out code referenced by P/Invoke

* Address PR feedback: Namespaces.Foundation -> "Foundation."

* Address PR feedback: Simplify hasSymbols

* Reuse ListExportedSymbols step, respect App.SymbolMode

* Address PR feedback

* Workaround for tvOS
2020-12-03 14:04:11 +01:00
Rolf Bjarne Kvinge 199396e983 [mtouch] The product assembly for Mac Catalyst is Xamarin.MacCatalyst.dll. 2020-12-03 10:43:19 +01:00
Rolf Bjarne Kvinge ee735ea034 [mtouch] Mac Catalyst apps do not require PInvoke wrappers.
Just like simulator builds.
2020-12-03 10:43:19 +01:00
Rolf Bjarne Kvinge a0ad38abe1 [mtouch] Add mapping between PlatformName and ApplePlatform enums 2020-12-03 10:43:19 +01:00
Rolf Bjarne Kvinge 2a48373e05 [mtouch] Allow referencing Xamarin.iOS.dll when building for Mac Catalyst 2020-12-03 10:43:19 +01:00
Rolf Bjarne Kvinge 7c3a53fcaf [mtouch] Use macOS' logic to determine whether Mac Catalyst has dynamic obj_msgSend 2020-12-03 10:43:19 +01:00
Rolf Bjarne Kvinge 42687be5d5 [tools] OS Versions are messy in Mac Catalyst 😡
In some places we have to provide the macOS version, and in other places the
iOS version. Add a map and the corresponding code to convert between the two,
and use them when needed.
2020-12-03 10:43:19 +01:00
Rolf Bjarne Kvinge cdf97ba554 [tools] Put assemblies and other app bundle content in the correct app bundle location depending on the platform we're targetting.
This makes it so that assemblies end up in the Contents/MonoBundle/ subdirectory
as opposed to in the root app directory for catalyst.
2020-12-03 10:42:27 +01:00
Rolf Bjarne Kvinge 88b74704b0 [tools] We must manually copy/lipo the executable into the app, it's not done automatically as it is for simulator builds. 2020-12-03 10:42:27 +01:00
Rolf Bjarne Kvinge 668fbd663e [tools] Xcode's SDK uses 'MacOSX' for the catalyst platform name. 2020-12-03 10:42:27 +01:00
Rolf Bjarne Kvinge 183f40c407 [tools] Use the same constants for catalyst as for iOS for now 2020-12-03 10:42:27 +01:00
Rolf Bjarne Kvinge 74a3d530c1 [tools] Link with libcompression in catalyst 2020-12-03 10:42:27 +01:00
Rolf Bjarne Kvinge 75876f24c9 [tools] Select the mono native mode for catalyst. 2020-12-03 10:42:27 +01:00
Rolf Bjarne Kvinge 0d5f4a31a8 [msbuild/tools] The (Sdk)Platform for Catalyst is 'MacCatalyst'. 2020-12-03 10:42:26 +01:00
Rolf Bjarne Kvinge 6e906ec7e6 [tools] Catalyst apps are not simulator apps. 2020-12-03 10:42:26 +01:00
Rolf Bjarne Kvinge 70298395d9 [tools] Catalyst requires the GSS framework, just like iOS does. 2020-12-03 10:42:26 +01:00
Rolf Bjarne Kvinge ff57778c38 [mtouch] Use the correct native compiler/linker flags for catalyst apps 2020-12-03 10:42:26 +01:00
Rolf Bjarne Kvinge e6a976de2c [tools] Catalyst is a part of Xamarin.iOS, so use the iOS logic to generate the main function 2020-12-03 10:42:26 +01:00
Rolf Bjarne Kvinge 5f25d80c16 [tools] Use the same defaults for exception marshalling for catalyst as we use for Xamarin.Mac. 2020-12-03 10:42:26 +01:00
Rolf Bjarne Kvinge 4e69f99ce9 [tools] Use the same GC configuration for catalyst as we use for Xamarin.Mac
Since that's the closest runtime environment.
2020-12-03 10:42:26 +01:00
Rolf Bjarne Kvinge d394761aea [tools] x86_64 is a valid ABI for catalyst! 2020-12-03 10:42:26 +01:00
Rolf Bjarne Kvinge fdaf51f3a8 [mtouch] Build the partial static registrar for Mac Catalyst 2020-12-03 10:42:26 +01:00
Rolf Bjarne Kvinge e9f0b1f8e6 [msbuild] Implement support for Mac Catalyst 2020-12-03 10:42:26 +01:00
Rolf Bjarne Kvinge 2b5723067c [tools] Catalyst apps require Xcode header files in the same circumstances as other Xamarin.iOS platforms.
When linking is disabled.
2020-12-03 10:42:26 +01:00
Rolf Bjarne Kvinge 5f0fc5858f [tools] Catalyst apps are never build for device (just like macOS apps) 2020-12-03 10:42:26 +01:00
Rolf Bjarne Kvinge 3556b8468d [tools/bgen] Catalyst is a part of Xamarin.iOS, so use '_ios-build' and 'MD_MTOUCH_SDK_ROOT' 2020-12-03 10:42:26 +01:00
Rolf Bjarne Kvinge 4389e19a06 [tools] Add MacCatalyst to our list of platforms 2020-12-03 10:42:26 +01:00
Rolf Bjarne Kvinge 716e395ea4 [tools] Catalyst apps must specify their target ABI(s)
No assumptions makes it easier down the road when we're adding support for ARM64.
2020-12-03 10:42:26 +01:00
Rolf Bjarne Kvinge 76da5c461e [tools] Add support for Catalyst frameworks.
The list of Catalyst frameworks is close to the iOS frameworks, so clone the list
of iOS frameworks and then just modify that list.
2020-12-03 10:42:26 +01:00
Rolf Bjarne Kvinge 8b2c3bdd6f [tools] Add an 'Unavailable' property to each framework and check it whenever needed.
Also emit a warning whenever we run into an unavailable framework.
2020-12-03 10:42:26 +01:00
Rolf Bjarne Kvinge ff950f7a1f [mtouch] Our native catalyst bits are in the Xamarin.MacCatalyst.sdk directory. 2020-12-03 10:42:26 +01:00
Rolf Bjarne Kvinge 78ff0ee892 Add a Xamarin.MacCatalyst target framework identifier. 2020-12-03 10:42:26 +01:00
Rolf Bjarne Kvinge 731094006c [mtouch] Make the full path to the Info.plist dependent on the target platform.
Because for Catalyst it's in the same place as for macOS; in the Contents/ subdirectory
in the app.
2020-12-03 10:42:26 +01:00
Rolf Bjarne Kvinge 38eca9806a [runtime] Look for files in the Contents/MonoBundle directory for catalyst apps. 2020-12-03 10:42:26 +01:00
Rolf Bjarne Kvinge f3ed478c1d [mtouch] Symbols are always required for catalyst apps.
In this case we're like iOS simulator builds: symbols may not be required under a
few circumstances, one of which is AOT compilation, which doesn't happen for catalyst
apps, thus symbols are always required for catalyst apps.
2020-12-03 10:42:26 +01:00
Rolf Bjarne Kvinge f48991fadd [mtouch] The executable path in the app is in the Contents/MacOS subdirectory (just like for macOS apps) 2020-12-03 10:42:26 +01:00
Rolf Bjarne Kvinge 17e5519692 [mtouch] We don't AOT compile anything for catalyst apps. 2020-12-03 10:42:26 +01:00
Alex Soto 2b1d0799aa [xcode12.3][watchOS] Add x86_64 simulator support
* Bumps mono binaries to include x86_64 watchOS support
* Build runtime/registrar x86_64 slices
* Produce a 64 bit version of Xamarin.WatchOS.dll
* Allow building x86_64 for watch simulators in mtouch
* Let xharness know about x86_64

* [tests] Add x86_64 arch to test-libraries

* Make dotnet package aware of x64

* [ObjCRuntime] Fix computing if we're calling a stret function or not in a 64-bit watchOS simulator.

* [xharness] Re-enable some watchOS tests.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>

New commits in mono/mono:

* mono/mono@ac596375c7 Add support for OP_FCONV_TO_I to mini-arm64.c. (#20548)
* mono/mono@392fe5b87b [2020-02][watchOS] Add simwatch64 support (#20552)
* mono/mono@a22ed3f094 Fix potential crash for Encoder.Convert (#20522)
* mono/mono@970783731f Bump to F# 5.0 (#20511)
* mono/mono@32ab5066f7 Bump msbuild to fix a build issue
* mono/mono@93a7fe77e8 Ensure special static slots respect alignment. (#20506)
* mono/mono@3db5b35841 [debugger] Switch to GC Unsafe in signal handler callbacks (#20495)
* mono/mono@af315f44c4 [2020-02][corlib] ThreadAbortException protection for ArraySortHelper (#20468)
* mono/mono@ca11fb0fd8 [2020-02] Bump ikvm-fork to include https://github.com/mono/ikvm-fork/pull/20 (#20452)

Diff: be2226b5a1..ac596375c7
2020-12-02 22:23:45 -05:00
Manuel de la Pena b4c549f5a8
[VSTS] If we fail dumping the env, continue. (#10193) 2020-12-02 18:50:55 -05:00
Rolf Bjarne Kvinge 7251902439
[bgen] Use ErrorHelper.Verbosity to store the verbosity to avoid storing it in multiple places with different values (#10175)
This avoids some code using one value, and other code using another value.,
and things don't quite work as expected.

In particular it makes it so that passing -v to bgen makes errors show the
stack trace of the corresponding exception.
2020-12-01 11:34:47 +01:00
Filip Navara 56a5432bdf
[dotnet] Avoid double registration of static registrar (#10185) 2020-12-01 08:11:36 +01:00
Sebastien Pouliot 3bd14c3eef
[msbuild] Add support for `.xcframework` (#10046)
This is done early so we can resolve the inner framework, inside the
xcframework, and let the existing framework support do most of the
work.

The resolving code has unit tests. Custom projects for "NoEmbedding"
exists for all supported platforms and executed by xharness.

A sample `xcframework` with tests projects is also available 
[here](https://github.com/spouliot/xcframework).

The xcframework test case is based on Rolf's earlier/partial implementation.
https://github.com/rolfbjarne/xamarin-macios/commit/xcframework

Things to note:

Do not rename a framework (like XTest) to use it in an xcframework
(like XCTest). That will fail at codesign but won't give anything
useful. You might think signing the framework (instead of the inner
binary) would solve it. It does, as it codesign, but then the app
crash at startup. At some point you realize some symbols are still
using XTest (not XCTest) and then you can delete several other weird
workarounds (like for `ld`) because all of it was cause by this
never identified rename.

dSYM support (and tests) to be done in a separate PR.
2020-11-30 13:44:03 -05:00
Rolf Bjarne Kvinge 87d04ac331
[src/mtouch] Put implementation assemblies in a per-platform directory (#10169)
Currently we put the implementation assemblies for all Xamarin.iOS platforms
in the same directory. This makes it impossible to have different
implementations for the same assembly in different platforms: in particular,
we're going to want a special version of Xamarin.iOS.dll for Mac Catalyst
(that will just have type forwarders into Xamarin.MacCatalyst.dll), that that
assembly will go into the Mac Catalyst-specific directory of implementation
assemblies.
2020-11-27 18:53:25 +01:00
Rolf Bjarne Kvinge 9c094ee87f
[tools] Set xamarin_executable_name in main for macOS .NET apps. (#10124)
* [tools] Set xamarin_executable_name in main for macOS .NET apps.

This regressed while macOS was disabled in main.

* Fix according to review.
2020-11-24 07:52:35 +01:00
Rolf Bjarne Kvinge 75979ca400
[tools] Disable Objective-C exception handling for macOS .NET apps due to a missing feature in the runtime. (#10123)
* [tools] Disable Objective-C exception handling for macOS .NET apps due to a missing feature in the runtime.

We need support for dllmaps, and that isn't working on macOS yet.

* Fix to only affect .NET
2020-11-23 08:05:35 +01:00
Alex Soto 72c7b1ffcc
[main][watchOS] Add x86_64 simulator support (#10059)
* [watchOS] Add x86_64 simulator support

* Build runtime/registrar x86_64 slices
* Produce a 64 bit version of Xamarin.WatchOS.dll
* Allow building x86_64 for watch simulators in mtouch
* Let xharness know about x86_64

* [tests] Add x86_64 arch to test-libraries

* Make dotnet package aware of x64

* [ObjCRuntime] Fix computing if we're calling a stret function or not in a 64-bit watchOS simulator.

* [xharness] Re-enable some watchOS tests.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-11-20 09:27:46 -05:00
Rolf Bjarne Kvinge 3174e94a17
[mlaunch] Adjust build logic to ship mlaunch with the .NET nugets when we're building mlaunch as well. (#10122)
The original implementation only worked when we used mlaunch from the
macios-binaries repository.
2020-11-20 14:41:03 +01:00
Rolf Bjarne Kvinge f4c9327fac
[dotnet] Bump to .NET 6.0.100-alpha.1.20556.2 and net6.0 (#10079)
This involves a few changes:

* Change everything to reference net6.0 instead of net5.0
* Update various variables to be NET6* instead of NET5*
* Reorder build logic to account for that our targets are imported earlier in
  the build process:

   In the latest .NET 6, our Workloads.targets is imported earlier in the
   build. This requires a few changes, because we still need to run most of
   our logic later in the process, which we do by adding targets files we
   want imported later to the AfterMicrosoftNETSdkTargets property.

   What we're loading as soon as possible:

   * Our version information (Xamarin.Shared.Sdk.Versions.targets)
   * The supported OS versions
     (Microsoft.<platform>.Sdk.SupportedTargetPlatforms.targets)
   * The default OS version
     (Xamarin.Shared.Sdk.TargetFrameworkInference.targets).

   This is all information that the .NET build require early on.

   Changes:

   * Rename all files that are loaded early to *.props.
   * Updated documentations to reflect these changes.
   * Remove Microsoft.<platform>.TargetFrameworkInference.targets, these
     files aren't used and don't contain anything useful.
   * Move the logic to calculate _ComputedTargetFrameworkMoniker has been
     delayed to later, because it needs TargetFrameworkMoniker set.

* Add a StoreAttributesStep to store attributes that are removed by the
  linker, but that the static registrar needs.

   In particular, in .NET 6 the linker removes the
   System.Runtime.CompilerServices.ExtensionAttribute, which the static
   registrar needs to handle category methods properly.

   This involved copying and slightly modifying the RemoveAttributesBase
   code.
2020-11-19 15:01:55 +01:00
Manuel de la Pena 0f7bc75e50 Merge branch 'xcode12.2' into main-xcode12.2 2020-11-17 11:09:15 -05:00
Alex Soto 1b243acbf9 Merge remote-tracking branch 'xamarin/xcode12.2' into d16-8-xcode12.2-merge 2020-11-12 18:52:53 -05:00
Rolf Bjarne Kvinge d6756f4829 Merge remote-tracking branch 'origin/main' into dotnet-6.0.100-alpha.1.20559.4 2020-11-11 16:38:15 +01:00
Rolf Bjarne Kvinge d0d0a3dd93
[dotnet-linker] Remove AssemblyResolver.cs from the project, it's not needed. (#10081) 2020-11-11 07:42:34 +01:00
Rolf Bjarne Kvinge 9ada363d10
[mmp] Fix build. (#10082)
This broke in 59bc3c16ab, and wasn't caught because the Xamarin.Mac build is disabled.
2020-11-10 17:20:23 +01:00
Rolf Bjarne Kvinge ef87ba0512 [dotnet-linker] Fix whitespace. 2020-11-10 17:17:15 +01:00
Rolf Bjarne Kvinge 59bc3c16ab
[tools] Add all our product constants to SdkVersions.cs and use them in dotnet-linker. (#10065)
Also, the correct constants to use is now determined by current platform in the Application
instance, instead of a constant value.
2020-11-10 14:21:47 +01:00
Rolf Bjarne Kvinge 831f55796e [dotnet-linker] Add a StoreAttributesStep to store attributes that are removed by the linker.
Add a StoreAttributesStep to store attributes that are removed by the linker, but
that the static registrar needs.

In particular, in .NET 6 the linker removes the System.Runtime.CompilerServices.ExtensionAttribute,
which the static registrar needs to handle category methods properly.

This involved copying and slightly modifying the RemoveAttributesBase code.
2020-11-10 11:41:30 +01:00
Rolf Bjarne Kvinge c640775699 [dotnet] Bump to .NET 6.0.100-alpha.1.20556.2. and net6.0
New commits in spouliot/Touch.Unit:

* spouliot/Touch.Unit@f8768d9 Advance into the world of net6.0

Diff: 9abe69e6f5..f8768d99ef
2020-11-10 11:41:06 +01:00
Rolf Bjarne Kvinge 90d43ab86d
[mmp] Fix link path for Stripper.cs (#10062)
This makes the file show up in the right place (together with other files from
the tools/mtouch directory) in the solution explorer in VSMac.
2020-11-10 08:27:51 +01:00
Rolf Bjarne Kvinge 390b9e4b83
[dotnet-linker] Improve error reporting (#10064)
Improve error reporting in dotnet-linker by not requiring an instance of a LinkerConfiguration
to report errors. This is accomplished by making the LinkerConfiguration.Report method
a static method.

Otherwise reporting errors before we've successfully created a LinkerConfiguration
turns out to be troublesome (we end up throwing another exception, usually a NullReferenceException,
which is just confusing).
2020-11-10 08:27:28 +01:00
Manuel de la Pena 738b237355
[VSTS] Remove the UI prompt ASAP. (#10034)
Using provisionator could result in the UI prompt being shown which will
make the pipeline hang until there is human interaction.

Move the step to be one of the first ones to ensure provisionator does
not get stuck.
2020-11-03 18:32:32 -05:00
Manuel de la Pena ffa08ac060
[VSTS] Continue even if we could not clean the HD, we might have space. (#10032) 2020-11-03 13:02:59 -05:00
Rolf Bjarne Kvinge 90bfb623ed
[compare-commits] Fix corruption in dotnet assemblies after API comparison. (#10011)
Make sure to redirect the dotnet build output to our custom output directory
when building the previous commit so that it doesn't interfere with the normal
build output.

Also add validation for this.
2020-10-30 14:36:21 +01:00
Rolf Bjarne Kvinge 42bd13cbdc
[dotnet-linker] Improve error reporting by consolidating it in the LinkerConfiguration class. (#9992)
* Continue using our own error handling logic, and print our problems to stderr.
* Also use the linker's messaging facilities to report a more generic error,
  in case stderr doesn't show up for some reason.
2020-10-29 09:04:25 +01:00
Rolf Bjarne Kvinge 64edc26cb4
[dotnet] Improve context-ful linker errors by including the underlying exception message in the output. (#9991)
Because just this is kind of useless:

    error MT2301: The linker step 'Setup' failed during processing.

now it will say:

    error MT2301: The linker step 'Setup' failed during processing: <hopefully something useful here>
2020-10-29 09:02:39 +01:00
Rolf Bjarne Kvinge f3614c86a6
[tools] Always show nested exceptions if they're our own exceptions. (#9990)
Sometimes we wrap exceptions to add more information to what's happening, but
that may end up worse if we don't print out the wrapped exceptions.

At the same time we don't want to flood the user with information if they
didn't ask for it, so only show nested exceptions if they're something we
raised ourselves.
2020-10-29 08:59:44 +01:00
Rolf Bjarne Kvinge 1770af11b1
[dotnet-linker] Catch any exceptions from our custom steps and show them using our error reporting logic. (#9954)
* [dotnet-linker] Catch any exceptions from our custom steps and show them using our error reporting logic.

* Letting the linker handle the exceptions will not result in a particularly
  good experience, because the linker will crash.

* We can also show better information, since we have more knowledge about many
  of the exceptions we raise ourselves.

* [dotnet] Make ConfigurationAwareSubStep inherit from ExceptionalSubStep.

This required a minor modification to ExceptionalSubStep to allow for custom reporting.

* [dotnet] Implement ConfigurationAwareStep's exception handling like it's done in ExceptionalSubStep.
2020-10-26 20:16:03 +01:00
Rolf Bjarne Kvinge 98c2abc72d
[tools] Localize error messages from the ExceptionSubStep linker step. (#9959)
I also changed the error message slightly to hopefully make it a bit more
comprehensible when translated (since the step name won't be translated, we'll
end up with a message that mixes English with the translated string).
2020-10-26 16:28:49 +01:00
Rolf Bjarne Kvinge b7511be48c
[tools/dotnet] Re-use the existing main generation code in our dotnet code. (#9953)
Move/refactor the code to generate the main function to make it re-usable from
our dotnet code (and then use it there as well).
2020-10-26 16:26:49 +01:00
Rolf Bjarne Kvinge 015e6407e2 Document and verify bit. 2020-10-26 11:57:44 +01:00
Rolf Bjarne Kvinge 2e77de3dcf
[tools] Renumber RemoveRejectedTypesStep's error code base to match other ExceptionalSubStep subclasses. (#9955)
Also document which numbers each subclass uses in Errors.resx. This makes it
much easier to figure out the next number to use.
2020-10-26 09:58:41 +01:00
Rolf Bjarne Kvinge b36632e7ce [tools] Pass -DDEBUG to the native compiler when compiling generated code in debug mode.
The generated main code requires this to build successfully.
2020-10-23 11:46:09 +02:00
Rolf Bjarne Kvinge 6b344e767c [tools] Store the AssemblyName in Application.RootAssemblies.
This is how it's currently done in Xamarin.iOS/Xamarin.Mac, and this makes the existing
main generation code work.
2020-10-23 11:46:09 +02:00
Rolf Bjarne Kvinge b164d9bbad [tools] Re-use Target.GenerateMain from dotnet-linker. 2020-10-23 11:46:09 +02:00
Rolf Bjarne Kvinge 1d5a6cfe79 [tools] Add support for registration methods to the mac main generation by moving iOS' implementation to shared code. 2020-10-23 11:46:09 +02:00
Rolf Bjarne Kvinge d039a8ecd3 [tools] Create a Target.GenerateMain function that wraps the iOS/macOS variants and avoids duplicating some code. 2020-10-23 11:46:09 +02:00
Rolf Bjarne Kvinge 85c473fab2 [tools] Make the Generate*Main API/signatures more similar. 2020-10-23 11:46:09 +02:00
Rolf Bjarne Kvinge 6240e848f3 [mtouch] Move mtouch's GenerateMain to shared Target code.
This means moving a lot of supporting code to shared code as well.
2020-10-23 11:46:09 +02:00
Rolf Bjarne Kvinge f513501443 [mmp] Move mmp's GenerateMain to shared Target code.
This means moving some supporting code to shared code as well.
2020-10-23 11:46:09 +02:00
Manuel de la Pena 18963f0983 [Xcode12.1] Bring Xcode12.1 support. 2020-10-20 17:27:14 -04:00
monojenkins db2d95b155
[xcode12.1] [tests] Fix sample tests to take into account when a platform has been disabled. (#9915)
* [tests] Fix sample tests to take into account when a platform has been disabled.

* [devops] The INCLUDE_MAC/INCLUDE_IOS variables might not exist.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-10-20 08:28:23 +02:00
Manuel de la Pena 5db939f329
[Tools] Remove compilation warning CS0105 (#9865) 2020-10-14 13:37:44 -04:00
Rolf Bjarne Kvinge f730014daf
[compare-commits] Ignore Publish.*.txt files when comparing generator output. Fixes #9852. (#9853)
Fixes https://github.com/xamarin/xamarin-macios/issues/9852.
2020-10-14 08:46:00 +02:00
Rolf Bjarne Kvinge 3d906e7000
[dotnet] Add support for 'dotnet build -t:run'. (#9823)
* Ship mlaunch in the iOS, tvOS and watchOS NuGets. It should probably go into
  a separate NuGet (to avoid shipping the same mlaunch executable in three different
  packages), but that can be done at a later stage.

* Add a GetMlaunchArguments task that computes the mlaunch arguments to install
  or launch an app in either the simulator or on device.

* Implement the MSBuild logic to make the Run target (provided by .NET) launch
  mlaunch (for iOS, tvOS and watchOS) or the built app (for macOS). This is done
  by setting the RunCommand and RunArguments properties (which the Run target uses)
  to the correct values.

Ideally I'd would make 'dotnet run' work too, but that runs into a different problem which
I haven't figured out yet:

    A fatal error was encountered. The library 'libhostpolicy.dylib' required to execute the application was not found in '/Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/dotnet/MySingleView/bin/Debug/net5.0-ios/ios-x64/'.
    Failed to run as a self-contained app.
      - The application was run as a self-contained app because '/Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/dotnet/MySingleView/bin/Debug/net5.0-ios/ios-x64/MySingleView.runtimeconfig.json' did not specify a framework.
      - If this should be a framework-dependent app, specify the appropriate framework in '/Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/dotnet/MySingleView/bin/Debug/net5.0-ios/ios-x64/MySingleView.runtimeconfig.json'.

That's for a different pull request though.

Ref: https://github.com/xamarin/net6-samples/issues/35.
2020-10-09 13:01:13 +02:00
Rolf Bjarne Kvinge caba0a66be
[msbuild] Move PathUtils.cs to tools/common so that other code can use it too. (#9801)
In particular the code to resolve symlinks and relative paths is useful.
2020-10-09 08:32:10 +02:00
Sebastien Pouliot c5a43ac2b7
[oslog] New framework in macOS 11 (#9820)
Fix https://github.com/xamarin/xamarin-macios/issues/9480
2020-10-08 16:33:03 -04:00
Filip Navara 1e960b8780
Update GenerateMainStep to generate code compatible with libxamarin on macOS (#9799) 2020-10-08 08:09:40 +02:00
Rolf Bjarne Kvinge 8bf4e0e5e6
[tests] Fix sample tests to take into account when a platform has been disabled. (#9774)
* [tests] Fix sample tests to take into account when a platform has been disabled.

* [devops] The INCLUDE_MAC/INCLUDE_IOS variables might not exist.
2020-10-06 17:33:03 +02:00
Rolf Bjarne Kvinge b111ce0e5c
[dotnet-linker] Add a CollectUnmarkedMembersStep that will keep linked away types around for the static registrar. (#9722)
The static registrar may need access to types that have been linked away, so
store unmarked types so that the static registrar can access them later.

This also makes all the monotouch-test variations green, so enable them all.

Fixes this monotouch-test when all optimizations are enabled:

    MonoTouchFixtures.ObjCRuntime.RegistrarTest
        [FAIL] TestProtocolRegistration :   UIApplicationDelegate/17669
            Expected: True
            But was:  False
                at MonoTouchFixtures.ObjCRuntime.RegistrarTest.TestProtocolRegistration() in xamarin-macios/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs:line 1350
2020-09-29 16:41:47 +02:00
Rolf Bjarne Kvinge a5d06f0d1e
[dotnet-linker] Add a RemoveAttributesStep that will remove some of the attributes we don't need. (#9707)
The .NET linker comes with a way to remove attributes (by passing '--link-attributes
some.xml' as a command-line argument), but this has a few problems:

* We'd need to figure out which attributes to remove before running the linker,
  but the code to figure out which optimizations have been enabled (and which attributes
  should be removed) is in our custom linker code. We'd need to refactor a big chunk
  of code to move this logic out of our custom linker code.
* We need to keep the removed attributes around, because the static registrar needs
  them. Our custom linker logic is not notified for removed attributes, which means
  we'd need to store all attributes for the attribute types we're interested in (as
  opposed to this solution, where we only store attributes that are actually removed).
* The attributes we want removed may contain references to types we don't want
  linked away. If we ask the linker to remove those attributes, then the types may
  be linked away as well, and there's no good way around this.

The end result is that a custom step is the best solution for now.

Fixes these monotouch-test tests when enabling all optimizations:

    Xamarin.BindingTests.ProtocolTest
        [FAIL] OnlyProtocol :   [Protocol] IP1
            Expected: 0
            But was:  1
                at Xamarin.BindingTests.ProtocolTest.OnlyProtocol() in /Users/rolf/work/maccore/main/xamarin-macios/tests/bindings-test/ProtocolTest.cs:line 47

        [FAIL] ProtocolWithBaseType :   [Protocol] IP2
            Expected: 0
            But was:  1
                at Xamarin.BindingTests.ProtocolTest.ProtocolWithBaseType() in /Users/rolf/work/maccore/main/xamarin-macios/tests/bindings-test/ProtocolTest.cs:line 79

        [FAIL] ProtocolWithBaseTypeAndModel :   [Protocol] IP3
            Expected: 0
            But was:  1
                at Xamarin.BindingTests.ProtocolTest.ProtocolWithBaseTypeAndModel() in /Users/rolf/work/maccore/main/xamarin-macios/tests/bindings-test/ProtocolTest.cs:line 115
2020-09-29 09:12:22 +02:00
Rolf Bjarne Kvinge 58d546f2eb
[tools] Remove unnecessary conditional code (#9705)
The conditional code was only there to make the code compile; now it compiles so
no need for the condition anymore.
2020-09-28 08:36:47 +02:00
Manuel de la Pena 764734d20a
[Main][Xcode12] Add support for Xcode 12 2020-09-25 12:58:29 -04:00
Rolf Bjarne Kvinge ac496baabb
[dotnet-linker] Make sure to preserve block-related generated code. Fixes #9562. (#9685)
Fixes https://github.com/xamarin/xamarin-macios/issues/9562.

It also fixes this monotouch-test when enabling all optimizations:

    [FAIL] BlockReturnTest : ObjCRuntime.RuntimeException : Invalid DelegateProxyAttribute for the return value for the method MonoTouchFixtures.ObjCRuntime.RegistrarTest+BlockReturnTestClass.MethodReturningBlock: DelegateType (ObjCRuntime.Trampolines+SDRegistrarTestBlock) specifies a type without a 'Handler' field.
2020-09-25 16:57:04 +02:00
Rolf Bjarne Kvinge 2e52dfdb3b [tools] Unify information about CoreNFC in the Frameworks class, and fix selecting whether a framework should be linked weakly or not in dotnet-linker.
This fixes a startup crash in the simulator with Xcode 12:

    Library not loaded: /usr/lib/libnfshared.dylib
      Referenced from: /Applications/Xcode_12.0.0-GMb.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreNFC.framework/CoreNFC
      Reason: no suitable image found.  Did find:
    	/usr/lib/libnfshared.dylib: mach-o, but not built for platform iOS-sim

Ref: https://stackoverflow.com/q/63915728/183422
2020-09-25 13:07:42 +02:00
Manuel de la Pena c962651df7 [Localizations] Update Errors.cs with the new error. 2020-09-24 13:35:14 -04:00
Rolf Bjarne Kvinge 22fe547944
[tests] Make the .NET bgen tests actually reference the .NET BCL. (#9693)
Make the bgen tests pass in the path to the attribute library, platform
assembly and all the .NET reference assemblies to bgen. This way we execute
these tests using the .NET version of everything.
2020-09-24 14:57:05 +02:00
Manuel de la Pena dcb0c93ab0 [Xcode12] Bring xcode 12 changes into main. 2020-09-23 16:05:22 -04:00
Connor Adsit 746e26f6ac
Use provisionator built-ins for custom functions (#9671) 2020-09-22 14:24:02 -04:00
Manuel de la Pena 47d93cd830 [MTouch] Fix broken compilation of extensions due to a bad merge.
libmain in watch extensions can be null. This was inside an if statement
and got removed during the merge.
2020-09-21 17:58:01 -04:00
Rolf Bjarne Kvinge 0e56df74a4
[tools] Simplify code a little bit by making DerivedLinkContext.StaticRegistrar a fetch property instead of a push property (#9677) 2020-09-21 17:54:23 +02:00
Rolf Bjarne Kvinge 3c89b80b3b
[dotnet-linker] Set the dynamic registration mode at runtime. (#9675)
This way we know at runtime what's available and what's not, which means that
the runtime won't try to register assemblies when the dynamic registrar has
been linked away.

Fixes this startup crash in monotouch-test when all optimizations have been enabled:

    Unhandled Exception:
    ObjCRuntime.RuntimeException: The runtime function register_assembly has been linked away.
2020-09-21 17:54:04 +02:00
Rolf Bjarne Kvinge 39e3184f02
[src] Build the .NET version of our product assemblies using a .NET 5 BCL. (#9637)
* [src] Build the .NET version of our product assemblies using a .NET 5 BCL.

We're not shipping the .NET product assemblies in any stable release, so we
can use a preview version of the .NET 5 BCL.

Also:

* Add all the nuget feeds we need to the top-level NuGet.config, even for .NET
  5/6, there shouldn't be any conflicts with stable feeds since we use exact
  version numbers.

* Generate a top-level global5.json which is copied to every directory that
  needs a .NET 5 global.json (overriding the .NET 3.1 global.json in the root
  directory).

* Use the expected dotnet binary during our local build.

* [tests] Fix the bgen tests to use .NET 5.

* [xharness] Set the current directory to the project directory when running .NET tests.

This way we end up using the dotnet version that's configured in global.json for the tests.
2020-09-21 13:22:44 +02:00
Manuel de la Pena eb9b690fe0 Merge xcode12 into d16-8. 2020-09-18 17:51:52 -04:00
Rolf Bjarne Kvinge 2071a13aa4
[mtouch] Refactor how we detect and avoid broken frameworks when building for the simulator. (#9647)
* Use the existing information we have in the Frameworks class to determine
  whether a particular framework works in the simulator or not.
* Show a warning (MX5223) when we run into such a framework, but only if
  the linker is enabled (otherwise we'll often get warnings for API the developer
  doesn't use).
2020-09-17 13:31:29 +02:00
Alex Soto bfc98f8059
[xcode12] Initial bump for Xcode 12 GM (#9644)
* [xcode12] Initial bump for Xcode 12 GM

* [tests][intro] We cannot load CoreNFC framework on iOS simulator anymore

* [tests][xtro] New Metal API are not abstract (before XAMCORE_4_0)

* [tests][intro] Fix crash when CSLocalizedString 'description' selector is called

* [tests][xtro] Add support for excluding platforms

Based on `Make.config` variables `INCLUDE_[IOS|TVOS|WATCH|MAC]`

This required moving some entries (common -> macOS) to keep the
sanitizer happy.

* [xtro] Ignore Intents watchOS differences since they will likely match iOS in the future

* Update to use Xcode 12 GMb instead of the old GM

* [tests][xtro] Remove OSLog for iOS and tvOS (changed in GM)

* [tests][msbuild] Disable FrameworkListTest based on the active/disabled platforms

* [tests][msbuild] Track new directory/file inside CoreML projects

* [mlaunch] Bump maccore and disable mlaunch if mac build is disabled

New commits in xamarin/maccore:

* xamarin/maccore@ba332d4d07 Disable mlaunch if Mac is not built (#2314)

Diff: 87a96d21c9..ba332d4d07

Co-authored-by: Sebastien Pouliot <sebastien.pouliot@microsoft.com>
2020-09-16 11:41:44 +02:00
Whitney Schmidt 01254a04a4
fix inconsistent use of punctuation in argument descriptions (#9621) 2020-09-15 12:33:18 -04:00
Alex Soto 8383b14382
[xcode12] Rename master to main (#9631)
* Fix links that point to master to point to main instead.
* Implement support in the sample tester for specifying the default branch for
  each sample repo.
* Fix various text / documentation to say 'main' instead of 'master.'
* Push to 'main' instead of 'master' in xamarin-macios-data.
* Fix xharness to make 'main' the special branch with regards to documentation tests as opposed to 'master'.
* Fix various CI to use 'main' instead of 'master'.

This is a backport of PR #9561
2020-09-15 07:09:29 -04:00
Rolf Bjarne Kvinge 8cc314654f
[dotnet] Add support for the static registrar. (#9615) 2020-09-11 14:08:48 +02:00
Rolf Bjarne Kvinge 37a6569aee
[registrar] Make the registrar code non-conditional. (#9609)
Some appextension mtouch code had to be moved to shared code. This code is currently
only used for iOS/tvOS/watchOS, but it will eventually be applicable to macOS as
well.

This makes it possible to re-use the registrar code in dotnet-linker.
2020-09-10 08:31:12 +02:00
Rolf Bjarne Kvinge eb5206f082
[dotnet-linker] Add OptimizeGeneratedCodeSubStep into the pipeline. (#9608)
Fixes these linkall tests:

    Linker.Shared.OptimizeGeneratedCodeTest
        [FAIL] IsARM64CallingConvention :   optimized: no ldsfld instruction
        Expected: 0
        But was:  1
            at Linker.Shared.BaseOptimizeGeneratedCodeTest.IsARM64CallingConvention() in /Users/rolf/work/maccore/main/xamarin-macios/tests/linker/BaseOptimizeGeneratedCodeTest.cs:line 527
    
    [FAIL] SetupBlockPerfTest :   At least 6x speedup
        Expected: greater than 6
        But was:  1.0876440665344851d
            at Linker.Shared.BaseOptimizeGeneratedCodeTest.SetupBlockPerfTest() in /Users/rolf/work/maccore/main/xamarin-macios/tests/linker/BaseOptimizeGeneratedCodeTest.cs:line 120

And linkall is now green for .NET/Debug.
2020-09-10 08:30:45 +02:00
Rolf Bjarne Kvinge 941d65f016
[dotnet] Pass the Optimize flags from the extra bundler arguments to the linker configuration. (#9599)
* [dotnet] Pass the Optimize flags from the extra bundler arguments to the linker configuration.

Also call Application.InitializeCommon to initialize the application instance. The
important part here is that InitializeCommon calls Optimizations.Initialize to compute
the default optimizations. It also calls Set*ExceptionMode and sets the default EnableCoopGC
value (so we don't need to call/set those anymore), and it does a few other initialization
tasks which we don't need yet, but eventually will.

And finally remember to parse the bundler arguments before using them in the dotnet
build logic. How did this not cause problems before? 🤦

* [tests] Set the verbosity using the additional args instead of an internal variable.

The internal _BundlerVerbosity variable is overwritten now (with the verbosity
value from the additional args).

* [xharness] Disable tvOS generation for the introspection/.NET test, it incorrect and needs fixing.
2020-09-09 14:52:46 +02:00
Sebastien Pouliot cf3d9f7d23
[linker] Fix warnings on type references that still exists. Fix #8814 (#9600)
The type references are not cleaned (anymore?) and what's in memory can
be different from what will be saved to disk (which is the part that
matter).

So before linking we can check for type references (in a module) but
after linking need to see if it resolve (which means the definition,
of the reference, can still be found) and, just be be thorough, check
that's it's marked (if found).
2020-09-09 03:04:35 -04:00
Rolf Bjarne Kvinge f1e22e369d
[tools] Refactor the Optimizations class to have no conditionally compiled code. (#9596)
Refactor the Optimizations class to have no conditionally compiled code, which makes
it re-usable from our dotnet-linker code.

Also return any errors or warnings instead of showing/throwing them, which makes
the caller able to show them using whatever means is easiest for the caller.

One test needed an update to the list of valid optimizations, because we now have
a per-platform map of valid optimizations, instead of just a iOS/tvOS/watchOS vs
macOS split ('remove-unsupported-il-for-bitcode' is only valid for watchOS, and now
we say so, while we previously said it was a valid optimization for iOS and tvOS
as well, even though we'd warn about it and do nothing if you tried to set it).
2020-09-08 20:26:28 +02:00
Rolf Bjarne Kvinge 9496e6db7e
[dotnet] Define and implement a 'framework' or 'sdk' assembly as an assembly that comes from the .NET BCL NuGet. (#9571)
The Assembly.IsFrameworkAssembly property is used in two places:

* In Driver.IsBoundAssembly to return early when determining if an assembly has any NSObject subclasses: c1c5b9aac6/tools/mtouch/mtouch.cs (L1155-L1168)
* In Assembly.ExtractNativeLinkInfo to return early when looking for assemblies with LinkWith attributes: c1c5b9aac6/tools/common/Assembly.cs (L150-L154)

In both cases this definition of framework assembly works today and seems likely to work in the future as well.

I also went through and looked at all the usages of Profile.IsSdkAssembly, and it's used to:

* Decide which assemblies are selected for "link sdk"
* Decide which assemblies are considered an 'sdk' assembly for creating a user framework of all the sdk assemblies
* Bail out early when deciding whether:
    * An assembly references the product assembly (Xamarin.iOS.dll, etc.)
    * An assembly can contain references to UIWebView
    * An assembly can contain user resources
    * An assembly is a binding project / has third-party native resources
    * An assembly needs the dynamic registrar
    * An assembly has FieldAttributes whose native fields must be preserved by the native linker

In all cases our .NET definition of 'SDK' seems to work both for now and in the future.

There are also a few usages which does not apply to .NET, so I've ignored them:

* When looking for a few BCL APIs that must be preserved (MobileApplyPreserveAttribute.cs): this is to be done in the upstream .NET linker now, so it doesn't apply to our own code
* When linking away parameter names (MonoTouchMarkStep.cs): this is to be done in the upstream .NET linker now, so it doesn't apply to our own code
2020-09-07 18:33:53 +02:00
monojenkins ab3839a7d6
[DevOps] As with jenkins, remove old simulators. (#9552)
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2020-08-31 18:00:53 -04:00
Manuel de la Pena 36ca984c12
[DevOps] As with jenkins, remove old simulators. (#9551) 2020-08-31 13:19:34 -04:00
Rolf Bjarne Kvinge 819f5f95e0
[mtouch/mmp] Unify OptimizeGeneratedCodeSubStep into a single class. (#9549)
This makes it easier to use this code from dotnet-linker.
2020-08-31 18:56:23 +02:00
Rolf Bjarne Kvinge 4f004e78b3
[dotnet-linker] Add MarkNSObjects into the pipeline. (#9543)
A few compat fixes were necessary to make the code compile and run correctly.

Fixes this startup crash with the linkall test:

    2020-08-27 18:15:09.648352+0200 link all[91128:1963430] *** Assertion failure in void _UIApplicationMainPreparations(int, char **, NSString *__strong, NSString *__strong)(), /Library/Caches/com.apple.xbs/Sources/UIKitCore_Sim/UIKit-3920.31.100/UIApplication.m:4765
    2020-08-27 18:15:09.697128+0200 link all[91128:1963430]
    Unhandled Exception:
    Foundation.MonoTouchException: Objective-C exception thrown.  Name: NSInternalInconsistencyException Reason: Unable to instantiate the UIApplication delegate instance. No class named AppDelegate is loaded.
    Native stack trace:
    	0   CoreFoundation                      0x00007fff23e3cf0e __exceptionPreprocess + 350
    	1   libobjc.A.dylib                     0x00007fff50ba89b2 objc_exception_throw + 48
    	2   CoreFoundation                      0x00007fff23e3cc88 +[NSException raise:format:arguments:] + 88
    	3   Foundation                          0x00007fff258b8c9b -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 166
    	4   UIKitCore                           0x00007fff48c8baed UIApplicationMain + 1862
    	5   ???                                 0x00000001087d2504 0x0 + 4437386500
    	6   ???                                 0x00000001087d237b 0x0 + 4437386107
    	7   ???                                 0x00000001087cef93 0x0 + 4437372819
    	8   ???                                 0x00000001087cedcb 0x0 + 4437372363
    	9   ???                                 0x00000001087ceec1 0x0 + 4437372609
    	10  libmonosgen-2.0.dylib               0x00000001081a2d7e mono_jit_runtime_invoke + 1911
    	11  libmonosgen-2.0.dylib               0x000000010832ee0a do_runtime_invoke + 80
    	12  libmonosgen-2.0.dylib               0x0000000108331fd0 do_exec_main_checked + 92
    	13  libmonosgen-2.0.dylib               0x00000001081f191e mono_jit_exec + 369
    	14  libxamarin-debug.dylib              0x000000010802badd xamarin_main + 2685
    	15  link all                            0x0000000107f0cced main + 45
    	16  libdyld.dylib                       0x00007fff51a231fd start + 1

       at ObjCRuntime.Runtime.ThrowNSException(IntPtr ns_exception)
       at ObjCRuntime.Runtime.throw_ns_exception(IntPtr exc)
       at UIKit.UIApplication.Main(String[] args, IntPtr principal, IntPtr delegate)
       at UIKit.UIApplication.Main(String[] args, String principalClassName, String delegateClassName)
       at LinkAll.Application.Main(String[] args) in [...]/xamarin-macios/tests/linker/ios/link all/Main.cs:line 15
    --- End of stack trace from previous location ---
       at UIKit.UIApplication.Main(String[] args, IntPtr principal, IntPtr delegate)
       at UIKit.UIApplication.Main(String[] args, String principalClassName, String delegateClassName)
       at LinkAll.Application.Main(String[] args) in [...]/xamarin-macios/tests/linker/ios/link all/Main.cs:line 15	0   CoreFoundation                      0x00007fff23e3cf0e __exceptionPreprocess + 350
    	1   libobjc.A.dylib                     0x00007fff50ba89b2 objc_exception_throw + 48
    	2   CoreFoundation                      0x00007fff23e3cc88 +[NSException raise:format:arguments:] + 88
    	3   Foundation                          0x00007fff258b8c9b -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 166
    	4   UIKitCore                           0x00007fff48c8baed UIApplicationMain + 1862
    	5   ???                                 0x00000001087d2504 0x0 + 4437386500
    	6   ???                                 0x00000001087d237b 0x0 + 4437386107
    	7   ???                                 0x00000001087cef93 0x0 + 4437372819
    	8   ???                                 0x00000001087cedcb 0x0 + 4437372363
    	9   ???                                 0x00000001087ceec1 0x0 + 4437372609
    	10  libmonosgen-2.0.dylib               0x00000001081a2d7e mono_jit_runtime_invoke + 1911
    	11  libmonosgen-2.0.dylib               0x000000010832ee0a do_runtime_invoke + 80
    	12  libmonosgen-2.0.dylib               0x0000000108331fd0 do_exec_main_checked + 92
    	13  libmonosgen-2.0.dylib               0x00000001081f191e mono_jit_exec + 369
    	14  libxamarin-debug.dylib              0x000000010802badd xamarin_main + 2685
    	15  link all                            0x0000000107f0cced main + 45
    	16  libdyld.dylib                       0x00007fff51a231fd start + 1
    2020-08-27 18:15:09.698283+0200 link all[91128:1963430] Unhandled managed exception: Objective-C exception thrown.  Name: NSInternalInconsistencyException Reason: Unable to instantiate the UIApplication delegate instance. No class named AppDelegate is loaded.
    Native stack trace:
    	0   CoreFoundation                      0x00007fff23e3cf0e __exceptionPreprocess + 350
    	1   libobjc.A.dylib                     0x00007fff50ba89b2 objc_exception_throw + 48
    	2   CoreFoundation                      0x00007fff23e3cc88 +[NSException raise:format:arguments:] + 88
    	3   Foundation                          0x00007fff258b8c9b -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 166
    	4   UIKitCore                           0x00007fff48c8baed UIApplicationMain + 1862
    	5   ???                                 0x00000001087d2504 0x0 + 4437386500
    	6   ???                                 0x00000001087d237b 0x0 + 4437386107
    	7   ???                                 0x00000001087cef93 0x0 + 4437372819
    	8   ???                                 0x00000001087cedcb 0x0 + 4437372363
    	9   ???                                 0x00000001087ceec1 0x0 + 4437372609
    	10  libmonosgen-2.0.dylib               0x00000001081a2d7e mono_jit_runtime_invoke + 1911
    	11  libmonosgen-2.0.dylib               0x000000010832ee0a do_runtime_invoke + 80
    	12  libmonosgen-2.0.dylib               0x0000000108331fd0 do_exec_main_checked + 92
    	13  libmonosgen-2.0.dylib               0x00000001081f191e mono_jit_exec + 369
    	14  libxamarin-debug.dylib              0x000000010802badd xamarin_main + 2685
    	15  link all                            0x0000000107f0cced main + 45
    	16  libdyld.dylib                       0x00007fff51a231fd start + 1
     (Foundation.MonoTouchException)
       at ObjCRuntime.Runtime.ThrowNSException(IntPtr ns_exception)
       at ObjCRuntime.Runtime.throw_ns_exception(IntPtr exc)
       at UIKit.UIApplication.Main(String[] args, IntPtr principal, IntPtr delegate)
       at UIKit.UIApplication.Main(String[] args, String principalClassName, String delegateClassName)
       at LinkAll.Application.Main(String[] args) in [...]/xamarin-macios/tests/linker/ios/link all/Main.cs:line 15
    --- End of stack trace from previous location ---
       at UIKit.UIApplication.Main(String[] args, IntPtr principal, IntPtr delegate)
       at UIKit.UIApplication.Main(String[] args, String principalClassName, String delegateClassName)
       at LinkAll.Application.Main(String[] args) in [...]/xamarin-macios/tests/linker/ios/link all/Main.cs:line 15

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

    =================================================================
    	Native stacktrace:
    =================================================================
    	0x108273f92 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_dump_native_crash_info
    	0x1082207bd - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_handle_native_crash
    	0x1082737e9 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : sigabrt_signal_handler
    	0x7fff51c005fd - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_platform.dylib : _sigtramp
    	0x0 - Unknown
    	0x7fff51af0b7c - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_c.dylib : abort
    	0x10801979f - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libxamarin-debug.dylib : xamarin_unhandled_exception_handler
    	0x1082e4980 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_invoke_unhandled_exception_hook
    	0x108220166 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_handle_exception_internal
    	0x10821ea47 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_handle_exception
    	0x10826ea06 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_amd64_throw_exception
    	0x1086105b0 - Unknown
    	0x1080194fb - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libxamarin-debug.dylib : xamarin_process_managed_exception
    	0x108019377 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libxamarin-debug.dylib : xamarin_process_managed_exception_gchandle
    	0x108019333 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libxamarin-debug.dylib : xamarin_ftnptr_exception_handler
    	0x10821feeb - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_handle_exception_internal
    	0x10821ea47 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_handle_exception
    	0x10826ea06 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_amd64_throw_exception
    	0x1086105b0 - Unknown
    	0x1087d264b - Unknown
    	0x10869439b - Unknown
    	0x108016c07 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libxamarin-debug.dylib : xamarin_throw_ns_exception
    	0x10801a1cb - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libxamarin-debug.dylib : _ZL17exception_handlerP11NSException
    	0x7fff23e3d36d - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : __handleUncaughtException
    	0x7fff50ba8c05 - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : _ZL15_objc_terminatev
    	0x7fff4f9f6c87 - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libc++abi.dylib : _ZSt11__terminatePFvvE
    	0x7fff4f9f940b - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libc++abi.dylib : __cxa_get_exception_ptr
    	0x7fff4f9f93d2 - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libc++abi.dylib : _ZN10__cxxabiv1L22exception_cleanup_funcE19_Unwind_Reason_CodeP17_Unwind_Exception
    	0x7fff50ba8ad6 - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : _ZL26_objc_exception_destructorPv
    	0x7fff23e3cc88 - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : +[NSException raise:format:arguments:]
    	0x7fff258b8c9b - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework/Foundation : -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:]
    	0x7fff48c8baed - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : UIApplicationMain
    	0x1087d2504 - Unknown
    	0x1087d237b - Unknown
    	0x1087cef93 - Unknown
    	0x1087cedcb - Unknown
    	0x1087ceec1 - Unknown
    	0x1081a2d7e - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_jit_runtime_invoke
    	0x10832ee0a - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : do_runtime_invoke
    	0x108331fd0 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : do_exec_main_checked
    	0x1081f191e - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_jit_exec
    	0x10802badd - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libxamarin-debug.dylib : xamarin_main
    	0x107f0cced - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/link all : main
    	0x7fff51a231fd - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdyld.dylib : start
2020-08-31 08:38:11 +02:00
Rolf Bjarne Kvinge 2848cbfb88
[dotnet-linker] Add PreserveSmartEnumConversionsSubStep into the pipeline. (#9537)
This also means:

* Adding the ExceptionalSubStep step to the build.
* Adding a few workarounds for missing/different linker API.

This fixes this startup crash in link all:

    2020-08-26 19:56:03.936330+0200 link all[45665:6121665] Could not register the assembly 'link all': ObjCRuntime.RuntimeException: The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the parameter 'value' in the method LinkAll.Attributes.SmartConsumer.SetSmartEnumValue.
       at Registrar.Registrar.ObjCMethod.get_NativeParameters()
       at Registrar.Registrar.ComputeSignature(Type DeclaringType, MethodBase Method, ObjCMember member, Boolean isCategoryInstance, Boolean isBlockSignature)
       at Registrar.Registrar.ObjCMethod.ComputeSignature()
       at Registrar.Registrar.ObjCMethod.get_Signature()
       at Registrar.Registrar.ObjCMethod.get_Trampoline()
       at Registrar.DynamicRegistrar.RegisterMethod(ObjCMethod method)
       at Registrar.DynamicRegistrar.OnRegisterType(ObjCType type)
       at Registrar.Registrar.RegisterTypeUnsafe(Type type, List`1& exceptions)
       at Registrar.Registrar.RegisterAssembly(Assembly assembly)
    2020-08-26 19:56:03.939327+0200 link all[45665:6121665] System.AggregateException: One or more errors occurred. (The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the return value in the method LinkAll.Attributes.SmartConsumer.GetSmartEnumValue.) (The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the return value in the method LinkAll.Attributes.SmartConsumer.GetSmartEnumValue.) (The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the parameter 'value' in the method LinkAll.Attributes.SmartConsumer.SetSmartEnumValue.)
     ---> ObjCRuntime.RuntimeException: The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the return value in the method LinkAll.Attributes.SmartConsumer.GetSmartEnumValue.
       at Registrar.Registrar.ObjCMethod.get_NativeReturnType()
       at Registrar.Registrar.ComputeSignature(Type DeclaringType, MethodBase Method, ObjCMember member, Boolean isCategoryInstance, Boolean isBlockSignature)
       at Registrar.Registrar.ObjCMethod.ComputeSignature()
       at Registrar.Registrar.ObjCMethod.ValidateSignature(List`1& exceptions)
       --- End of inner exception stack trace ---
     ---> (Inner Exception #1) ObjCRuntime.RuntimeException: The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the return value in the method LinkAll.Attributes.SmartConsumer.GetSmartEnumValue.
       at Registrar.Registrar.ObjCMethod.get_NativeReturnType()
       at Registrar.Registrar.VerifyInSdk(List`1& exceptions, ObjCMethod method)
       at Registrar.Registrar.ObjCType.Add(ObjCMethod method, List`1& exceptions)
       at Registrar.Registrar.RegisterTypeUnsafe(Type type, List`1& exceptions)<---

     ---> (Inner Exception #2) ObjCRuntime.RuntimeException: The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the parameter 'value' in the method LinkAll.Attributes.SmartConsumer.SetSmartEnumValue.
       at Registrar.Registrar.ObjCMethod.get_NativeParameters()
       at Registrar.Registrar.ComputeSignature(Type DeclaringType, MethodBase Method, ObjCMember member, Boolean isCategoryInstance, Boolean isBlockSignature)
       at Registrar.Registrar.ObjCMethod.ComputeSignature()
       at Registrar.Registrar.ObjCMethod.ValidateSignature(List`1& exceptions)<---

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

    =================================================================
      Native stacktrace:
    =================================================================
      0x10d57eb0e - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_dump_native_crash_info
      0x10d52b437 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_handle_native_crash
      0x10d57e365 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : sigabrt_signal_handler
      0x7fff51c005fd - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_platform.dylib : _sigtramp
      0x0 - Unknown
      0x7fff51af0b7c - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_c.dylib : abort
      0x10d32478f - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libxamarin-debug.dylib : xamarin_unhandled_exception_handler
      0x10d5eef68 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_invoke_unhandled_exception_hook
      0x10d52ade0 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_handle_exception_internal
      0x10d5296c1 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_handle_exception
      0x10d579582 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_amd64_throw_exception
      0x10d91b5b0 - Unknown
      0x10d3244eb - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libxamarin-debug.dylib : xamarin_process_managed_exception
      0x10d324367 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libxamarin-debug.dylib : xamarin_process_managed_exception_gchandle
      0x10d336851 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libxamarin-debug.dylib : xamarin_main
      0x10d217ced - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/link all : main
      0x7fff51a231fd - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdyld.dylib : start
2020-08-28 16:23:04 +02:00
Rolf Bjarne Kvinge 482151eea7 [dotnet-linker] Make PreserveSmartEnumConversionsStep active for type as well to work around a linker bug.
Fixes this linker crash when building the link sdk test:

    ILLink : error IL1012: IL Linker has encountered an unexpected error. Please report the issue at https://github.com/mono/linker/issues [/Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/xharness/tmp-test-dir/link sdk33/link sdk.csproj]
     Fatal error in IL Linker (TaskId:212)
     Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object. (TaskId:212)
        at Mono.Linker.Steps.SubStepsDispatcher.DispatchType(TypeDefinition type) (TaskId:212)
        at Mono.Linker.Steps.SubStepsDispatcher.BrowseTypes(Collection`1 types) (TaskId:212)
        at Mono.Linker.Steps.SubStepsDispatcher.BrowseAssemblies(IEnumerable`1 assemblies) (TaskId:212)
        at Mono.Linker.Steps.SubStepsDispatcher.Mono.Linker.Steps.IStep.Process(LinkContext context) (TaskId:212)
        at Mono.Linker.Pipeline.Process(LinkContext context) (TaskId:212)
        at Mono.Linker.Driver.Run(ILogger customLogger) (TaskId:212)
        at Mono.Linker.Driver.Main(String[] args) (TaskId:212)
     The command exited with code 134. (TaskId:212)

Ref: https://github.com/mono/linker/issues/1458
2020-08-28 12:58:43 +02:00
Rolf Bjarne Kvinge cb3c835402
[tools] Remove BaseProfile.GetNamespace, it's not used. (#9533) 2020-08-28 09:57:27 +02:00
Rolf Bjarne Kvinge e9d82a254e [dotnet-linker] Add ExceptionalSubStep to the build
PreserveSmartEnumConversionsSubStep subclasses ExceptionalSubStep, so we need it now.
2020-08-27 20:04:08 +02:00
Rolf Bjarne Kvinge c71853b3d8 [dotnet-linker] Work around the linker's lack of AnnotationStore.AddPreservedMethod API.
Ref: https://github.com/mono/linker/issues/1456
2020-08-27 20:04:08 +02:00
Rolf Bjarne Kvinge 56953b143f [dotnet-linker] Add PreserveSmartEnumConversionsSubStep into the pipeline.
Fixes this startup crash in link all:

    2020-08-26 19:56:03.936330+0200 link all[45665:6121665] Could not register the assembly 'link all': ObjCRuntime.RuntimeException: The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the parameter 'value' in the method LinkAll.Attributes.SmartConsumer.SetSmartEnumValue.
       at Registrar.Registrar.ObjCMethod.get_NativeParameters()
       at Registrar.Registrar.ComputeSignature(Type DeclaringType, MethodBase Method, ObjCMember member, Boolean isCategoryInstance, Boolean isBlockSignature)
       at Registrar.Registrar.ObjCMethod.ComputeSignature()
       at Registrar.Registrar.ObjCMethod.get_Signature()
       at Registrar.Registrar.ObjCMethod.get_Trampoline()
       at Registrar.DynamicRegistrar.RegisterMethod(ObjCMethod method)
       at Registrar.DynamicRegistrar.OnRegisterType(ObjCType type)
       at Registrar.Registrar.RegisterTypeUnsafe(Type type, List`1& exceptions)
       at Registrar.Registrar.RegisterAssembly(Assembly assembly)
    2020-08-26 19:56:03.939327+0200 link all[45665:6121665] System.AggregateException: One or more errors occurred. (The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the return value in the method LinkAll.Attributes.SmartConsumer.GetSmartEnumValue.) (The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the return value in the method LinkAll.Attributes.SmartConsumer.GetSmartEnumValue.) (The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the parameter 'value' in the method LinkAll.Attributes.SmartConsumer.SetSmartEnumValue.)
     ---> ObjCRuntime.RuntimeException: The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the return value in the method LinkAll.Attributes.SmartConsumer.GetSmartEnumValue.
       at Registrar.Registrar.ObjCMethod.get_NativeReturnType()
       at Registrar.Registrar.ComputeSignature(Type DeclaringType, MethodBase Method, ObjCMember member, Boolean isCategoryInstance, Boolean isBlockSignature)
       at Registrar.Registrar.ObjCMethod.ComputeSignature()
       at Registrar.Registrar.ObjCMethod.ValidateSignature(List`1& exceptions)
       --- End of inner exception stack trace ---
     ---> (Inner Exception #1) ObjCRuntime.RuntimeException: The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the return value in the method LinkAll.Attributes.SmartConsumer.GetSmartEnumValue.
       at Registrar.Registrar.ObjCMethod.get_NativeReturnType()
       at Registrar.Registrar.VerifyInSdk(List`1& exceptions, ObjCMethod method)
       at Registrar.Registrar.ObjCType.Add(ObjCMethod method, List`1& exceptions)
       at Registrar.Registrar.RegisterTypeUnsafe(Type type, List`1& exceptions)<---

     ---> (Inner Exception #2) ObjCRuntime.RuntimeException: The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the parameter 'value' in the method LinkAll.Attributes.SmartConsumer.SetSmartEnumValue.
       at Registrar.Registrar.ObjCMethod.get_NativeParameters()
       at Registrar.Registrar.ComputeSignature(Type DeclaringType, MethodBase Method, ObjCMember member, Boolean isCategoryInstance, Boolean isBlockSignature)
       at Registrar.Registrar.ObjCMethod.ComputeSignature()
       at Registrar.Registrar.ObjCMethod.ValidateSignature(List`1& exceptions)<---

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

    =================================================================
    	Native stacktrace:
    =================================================================
    	0x10d57eb0e - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_dump_native_crash_info
    	0x10d52b437 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_handle_native_crash
    	0x10d57e365 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : sigabrt_signal_handler
    	0x7fff51c005fd - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_platform.dylib : _sigtramp
    	0x0 - Unknown
    	0x7fff51af0b7c - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_c.dylib : abort
    	0x10d32478f - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libxamarin-debug.dylib : xamarin_unhandled_exception_handler
    	0x10d5eef68 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_invoke_unhandled_exception_hook
    	0x10d52ade0 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_handle_exception_internal
    	0x10d5296c1 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_handle_exception
    	0x10d579582 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_amd64_throw_exception
    	0x10d91b5b0 - Unknown
    	0x10d3244eb - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libxamarin-debug.dylib : xamarin_process_managed_exception
    	0x10d324367 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libxamarin-debug.dylib : xamarin_process_managed_exception_gchandle
    	0x10d336851 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libxamarin-debug.dylib : xamarin_main
    	0x10d217ced - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/link all : main
    	0x7fff51a231fd - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdyld.dylib : start
2020-08-27 20:04:08 +02:00
Rolf Bjarne Kvinge 84758616ce
[tools] Use Extensions.Is instead of Extensions.IsPlatformType. (#9530)
The latter just calls the former.
2020-08-27 20:02:30 +02:00
Rolf Bjarne Kvinge e2f7c2f64f
[dotnet-linker] Add ApplyPreserveAttribute into the pipeline. (#9529)
This means:

* Move the parts of the ApplyPreserveAttribute step that we don't need for.NET
  into a new MobileApplyPreserveAttribute step, and have mtouch and mmp use
  that step instead of the ApplyPreserveAttribute step.

* Copy ApplyPreserveAttributeBase into dotnet-linker from the upstream tuner
  source (with minor modifications) so that our ApplyPreserveAttribute step
  compiles.

* Create a DotNetSubStepDispatcher class that we're going to use as our
  substep dispatcher, create an instance of it and insert it into the list of
  linker steps.

* Also a workaround for the lack of LinkContext.GetAssemblies (): add a step
  that collects all the assemblies and stores them in a list, so that we can
  have our own GetAssemblies implementation.

  I filed a linker issue to see if we can get LinkContext.GetAssemblies ()
  exposed to us: https://github.com/mono/linker/issues/1455.

Fixes this startup crash with the linkall test:

     2020-08-26 19:47:10.219697+0200 link all[32709:6065783] Xamarin.iOS: Fatal error: failed to load the method 'ObjCRuntime.Runtime.Initialize'.

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

    =================================================================
      Native stacktrace:
    =================================================================
      0x104007b0e - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/4A5F3968-6980-4E90-88A2-2E77AE039C40/link all.app/libmonosgen-2.0.dylib : mono_dump_native_crash_info
      0x103fb4437 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/4A5F3968-6980-4E90-88A2-2E77AE039C40/link all.app/libmonosgen-2.0.dylib : mono_handle_native_crash
      0x104007365 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/4A5F3968-6980-4E90-88A2-2E77AE039C40/link all.app/libmonosgen-2.0.dylib : sigabrt_signal_handler
      0x7fff51c005fd - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_platform.dylib : _sigtramp
      0x0 - Unknown
      0x7fff51af0b7c - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_c.dylib : abort
      0x103daad98 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/4A5F3968-6980-4E90-88A2-2E77AE039C40/link all.app/libxamarin-debug.dylib : xamarin_assertion_message
      0x103dade77 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/4A5F3968-6980-4E90-88A2-2E77AE039C40/link all.app/libxamarin-debug.dylib : xamarin_initialize
      0x103dbf80b - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/4A5F3968-6980-4E90-88A2-2E77AE039C40/link all.app/libxamarin-debug.dylib : xamarin_main
      0x103cd2f0d - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/4A5F3968-6980-4E90-88A2-2E77AE039C40/link all.app/link all : main
      0x7fff51a231fd - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdyld.dylib : start

This is a partial/modified port of the initial linker support (bc88790201)

Co-authored-by: Sebastien Pouliot <sebastien@xamarin.com>
2020-08-27 18:30:19 +02:00
Rolf Bjarne Kvinge 8ebb66eca0
[dotnet-linker] Print out substeps too when printing pipeline steps. (#9528) 2020-08-27 17:11:02 +02:00
Rolf Bjarne Kvinge 15ae4595b9
[dotnet] Add support for setting the exception marshalling mode in the GenerateMain step. (#9517)
* [dotnet] Pass exception marshaling options to the linker configuration, and pass it along to the Application instance.

* [dotnet] Write the selected exception marshaling modes to the generated main file.

* [dotnet-linker] Set the default cooperative GC mode.

The code to select the default exception marshalling mode needs it.
2020-08-27 08:27:31 +02:00
Rolf Bjarne Kvinge 003dfa0db4
[linker] Fix typo in method name: MarkDefautConstructor -> MarkDefaultConstructor (#9512) 2020-08-27 08:05:28 +02:00
Rolf Bjarne Kvinge b097f7bbab
[tools] Honor the ENABLE_DOTNET variable. Fixes #9475. (#9502)
Fixes https://github.com/xamarin/xamarin-macios/issues/9475.
2020-08-26 07:59:46 +02:00
Alex Soto 561214eb07
[xcode12] Bump PR for Xcode 12 Beta 6 (#9507) 2020-08-26 00:46:10 -04:00
Rolf Bjarne Kvinge 827591eccc
[tools] Extract the code to parse, validate and process exception marshalling arguments into the Application class. (#9492)
So that it's easier to re-use it from our .NET linker code.
2020-08-25 19:55:50 +02:00
Rolf Bjarne Kvinge de8cc6bbd8
[dotnet-linker] Add Debug to the linker configuration. (#9491) 2020-08-25 18:40:59 +02:00
Rolf Bjarne Kvinge b4da54ea6d Merge remote-tracking branch 'origin/main' into dotnet-partial-static-registrar 2020-08-24 17:56:42 +02:00
Rolf Bjarne Kvinge d7ab847697
[dotnet] Implement support for our different link modes. (#9460)
* [mmp] Rename LinkMode.All to LinkMode.Full.

So that we can continue to use Enum.Parse<LinkMode> to parse 'Full' as the link mode.

* [dotnet] Implement support for our different link modes.

Tell the managed linker what to do with each input assembly depending the selected
link mode (link all, link sdk, don't link).
2020-08-24 17:50:42 +02:00
monojenkins 4526ed6110
[d16-8] [DevOps] Set the status to pending once the checks have started. (#9448)
Once we have done all the check of the bot, set the status of the commit
to pending since the next task is going to run the tests.

This way we ensure that the pending status should be cleaned at the end
rather than be left behind.


Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2020-08-24 10:57:09 -04:00
Rolf Bjarne Kvinge 92a3cd9a30
[dotnet] Bump .NET and the linker. (#9451)
* Bump .NET 5 and the linker.

The old linker run into a problem that seems fixed in the new linker, so bump.

* [tests] Add a workaround for a .NET bug in the fsharplibrary tests.

It's now the default to produce reference assemblies, but the F# compiler
doesn't support producing reference assemblies, so when there's no reference
assembly afterwards the MSBuild tasks complain. So explicitly disable
reference assemblies for our F# library.

* [tests] Skip reference assemblies when iterating over produced assemblies in the .NET unit tests.

Also simplify the code a little bit.

This happens because producing reference assemblies is now the default.
2020-08-24 08:20:46 +02:00
Manuel de la Pena db0ac65975
[DevOps] Set the status to pending once the checks have started. (#9444)
Once we have done all the check of the bot, set the status of the commit
to pending since the next task is going to run the tests.

This way we ensure that the pending status should be cleaned at the end
rather than be left behind.
2020-08-21 10:29:11 -04:00
Rolf Bjarne Kvinge 200872f99b [dotnet] Use Objective-C++ for the main file. 2020-08-21 10:32:56 +02:00
Rolf Bjarne Kvinge ffea143135 [dotnet-linker] Add a Registrar step, and implement support for the partial static registrar.
Add a Registrar step that is responsible for dealing with the registrar during the
build. Currently only supports the dynamic and partial static registrar, the full
static registrar support will come later.
2020-08-21 10:32:56 +02:00
Rolf Bjarne Kvinge 174260cb4e [dotnet-linker] Compute the path to the partial static registry library, and add it to our configuration. 2020-08-21 10:32:56 +02:00
Rolf Bjarne Kvinge 7a19a82b65 [dotnet-linker] Add LinkMode to our configuration. 2020-08-21 10:32:56 +02:00
Rolf Bjarne Kvinge 1f326e82bb [dotnet-linker] Rework Application creation to happen earlier.
Refactor Application creation to happen earlier, and to split out the cache
creation. This way we can create the Application instance before processing
the configuration, and as we process any configuration we can set properties
on the Application instance.
2020-08-21 10:32:56 +02:00
Rolf Bjarne Kvinge c0728c02cb [dotnet-linker] Add CompilerFlags (and thus AssemblyBuildTarget as well) to the build
This required stubbing out a few members to keep things building.
2020-08-21 10:32:56 +02:00
Rolf Bjarne Kvinge fef20f4984 [mtouch] Move the AssemblyBuildTarget enum to shared code 2020-08-21 10:32:56 +02:00
Rolf Bjarne Kvinge 1ddaa66167 [dotnet-linker] Refactor main-generating code to make additions easier.
Add lines one by one, instead of using a giant string, which makes it easier to add
lines in the middle of the generated output.
2020-08-21 10:32:56 +02:00
Rolf Bjarne Kvinge 97c5380acd [mtouch/mmp] Build and ship the partial static registrar for .NET. 2020-08-21 10:32:56 +02:00
Rolf Bjarne Kvinge f43316114e [mmp] Add a few guards for code that shouldn't be executed under .NET. 2020-08-21 10:32:55 +02:00
Rolf Bjarne Kvinge 43fecd6f54 [mtouch/mmp] Improve lookup of System.Void.
If we can't find the mscorlib assembly in the list of loaded assemblies, try to load
it explicitly. If we still can't find it the mscorlib assembly, look for System.Void
in any assembly. This shouldn't be a performance bottleneck, because we cache the
System.Void type, which means the lookup is only done once.

This makes System.Void lookup work when building with .NET as well, since there's
no mscorlib.dll there.

This is required when running mtouch and mmp to generate the partial static registrar
code for .NET.
2020-08-21 10:32:55 +02:00
Rolf Bjarne Kvinge f70e949a7d
[dotnet-linker] Make Driver.Verbosity the single source of truth. (#9424)
* Make Driver.Verbosity the single place where we store the verbosity level.
* Respect any default verbosity by adding to the existing verbosity instead of
  setting it directly.
* There's no need to set ErrorHelper.Verbosity, the Driver.Verbosity setter
  already does it.

This means that for the .NET linker code we'll treat
~/.xamarin-bundler-verbosity like we treat ~/.mtouch-verbosity for mtouch, and
parse it to set the verbosity.
2020-08-21 10:15:52 +02:00
Alex Soto 236936c035
[xcode12] Xcode 12 Beta 5 Initial bump (#9406) 2020-08-20 08:39:46 -04:00
Rolf Bjarne Kvinge 558af9612a [dotnet] Add support for consuming binding projects. (#9376)
* Port the interdependent-binding-projects test to .NET (it's the simplest
  test project we have with binding projects).
* Add a lot of the shared source code for mtouch/mmp to dotnet-linker, and
  make it compile. Most issues were fixed by adding a few stubbed out classes,
  since there are large chunks of the mtouch/mmp code we're not using yet, so
  stubbing out while things are being implemented works fine.
* Add a step in dotnet-linker for loading the linker output (the linked
  assemblies) into our bundler code.
* Add another step in dotnet-linker to extract native resources from binding
  libraries.
* Augment the build process to take into account the native resources we found
  in any binding libraries.
2020-08-20 08:35:12 +02:00
monojenkins 0ad3c4757c
[d16-8] [DevOps] Report the correct bot used. (#9404)
The tests are not executed in the same agent that sets the github
status, for that reason, the github comment is not giving the correct
bot name, but the name of the bot that executed the commit message and
not the tests.

Add an output var in the runTests step to set the bot name and pass it
to the comment job in a different bot.


Co-authored-by: Whitney Schmidt <whschm@microsoft.com>
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2020-08-19 17:46:24 -04:00
Dorothy Tam 3dad70a503
[AppTrackingTransparency] Add support for Xcode 12 beta 4 (#9385)
Co-authored-by: Dorothy Tam <dtam@switch.tv>
2020-08-19 15:54:04 +02:00
monojenkins e2fc755347
[DevOps] Just clean the xamarin-macios dir to ensure we do not delete maccore creds. (#9397)
The credentials for maccore are downloaded to a pat file (to be found).
When we call make git-clean, because we do use the -x options, all
files are deleted, including the pat file.

We move to call git clean -xdf inside xamarin-macios, which will delete
the test result files.

Once we find the exact path pattern, we can update the make git-clean to
not remove them but this commit unblocks the failing CI builds.

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2020-08-18 17:40:40 -04:00
Manuel de la Pena c20cbfe301
[DevOps] Just clean the xamarin-macios dir to ensure we do not delete maccore creds. (#9396)
The credentials for maccore are downloaded to a pat file (to be found).
When we call make git-clean, because we do use the -x options, all
files are deleted, including the pat file.

We move to call git clean -xdf inside xamarin-macios, which will delete
the test result files.

Once we find the exact path pattern, we can update the make git-clean to
not remove them but this commit unblocks the failing CI builds.
2020-08-18 15:11:59 -04:00
Sebastien Pouliot e7d605c128
[passkit] Update for Xcode 12 beta 4 (#9218) 2020-08-17 20:01:41 -04:00
Rolf Bjarne Kvinge d577bf7446
[mtouch] Don't validate the --target-framework argument if we're just calling mlaunch. (#9374)
This fixes an issue where mtouch would complain about a missing --target-framework argument when it's not actually needed:

    /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch  --launchsim bin/iPhoneSimulator/Release/MyApp.app [...]
  	error MT0086: A target framework (--target-framework) must be specified.

what makes this worse is that passing --target-framework to mtouch makes
mlaunch fail, because mlaunch doesn't accept a --target-framework argument.
2020-08-17 08:37:29 +02:00
Manuel de la Pena 09fa8266be
[ScreenTime] New framework for Xcode 12 up to beta 4. (#9379) 2020-08-15 11:04:23 -04:00
Rolf Bjarne Kvinge 184114ee3c [dotnet-linker] Propagate the verbosity elsewhere. 2020-08-14 18:33:29 +02:00
Rolf Bjarne Kvinge 1d303fe856 [dotnet-linker] Add an ExtractBindingLibrariesStep.
This step will extract native libraries from binding assemblies, and adjust the native
linker flags to link with those native libraries.
2020-08-14 18:33:29 +02:00
Rolf Bjarne Kvinge d630495a5d [dotnet-linker] Add error reporting to ConfigurationAwareStep 2020-08-14 18:33:29 +02:00
Rolf Bjarne Kvinge 6f1b1c62bb [mtouch/mmp] Make it possible to compute assembly identity even if an assembly doesn't have a filename.
In .NET AssemblyDefinitions don't have MainModule.FileName set, because they're not
loaded using FileStreams.

Ref: https://github.com/mono/linker/issues/1313
2020-08-14 18:33:29 +02:00
Rolf Bjarne Kvinge e83dd1071b [bundlers] Refactor code to cope with not knowing whether a particular assembly is a framework assembly or not.
Turns out we don't actually _need_ to know, in every case we use this knowledge it's
a performance improvement to not process the framework assemblies, so skip this for
now, since there's no harm done (except to the planet) to do some extra processing
by processing all assemblies in these cases.
2020-08-14 18:33:29 +02:00
Rolf Bjarne Kvinge dd3967bfaf [dotnet-linker] Work around a linker bug where the linker won't tell us the original path of an assembly.
We need the path for several reasons, so poke into the linker using reflection to
find the information we need.
2020-08-14 18:33:29 +02:00
Rolf Bjarne Kvinge 7a446f6531 [dotnet-linker] Add a LoadNonSkippedAssembliesStep.
This step is used to load the result of the linker into our Application/Target/Assembly
instances.
2020-08-14 18:33:29 +02:00