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

11373 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge f1d8c760cc [tools] Disable direct-pinvoke for AOT-compiled code on Mac Catalyst.
Using 'direct-pinvoke' will tell the AOT compiler to emit a direct call to the
native function declared in the DllImport, which doesn't work when we want to
redirect to a different native funcion (in our xamarin_pinvoke_override/PINVOKE_OVERRIDE
implementation).

This fixes our exception marshalling tests in monotouch-test.
2021-07-22 10:37:28 +02:00
Rolf Bjarne Kvinge 676a8bb90d [monotouch-test] Fix some formatting and add assert messages 2021-07-22 10:36:21 +02:00
Rolf Bjarne Kvinge 79c96753f8 [dotnet-linker] Add native references to libSystem.Security.Cryptography.Native.Apple for Mac Catalyst.
Fixes these test failures:

    Ctor_Trust: System.DllNotFoundException : libSystem.Security.Cryptography.Native.Apple
    MailX1: System.DllNotFoundException : libSystem.Security.Cryptography.Native.Apple
    Encrypt_Empty: System.DllNotFoundException : libSystem.Security.Cryptography.Native.Apple
    KeyRecordTest: System.DllNotFoundException : libSystem.Security.Cryptography.Native.Apple
    Basic_Leaf_Only: System.DllNotFoundException : libSystem.Security.Cryptography.Native.Apple

which are all because of

    Xamarin.MacCatalyst: Unable to resolve P/Invoke 'AppleCryptoNative_X509GetContentType' in the library 'libSystem.Security.Cryptography.Native.Apple'

which happens because without this change we're not linking with the static version
of libSystem.Security.Cryptography.Native.Apple.
2021-07-22 10:36:21 +02:00
Rolf Bjarne Kvinge 09e6c0329f [dotnet] Only list linker flags for assemblies after we've computed them.
This means not listing per-assembly linker flags for only binding projects, but delay
it until we've computed the linker flags for all assemblies (and reflect this in
variable names as well).
2021-07-22 10:36:21 +02:00
Rolf Bjarne Kvinge d26bdf97bf [dotnet] Parse --dlsym and pass it to the dotnet-linker tasks. 2021-07-22 10:36:21 +02:00
Rolf Bjarne Kvinge bdbf642b6f [tests] Add a MyInterpretedApp test solution 2021-07-22 10:36:21 +02:00
Rolf Bjarne Kvinge b341fc3551 [tools] Implement interpreter + AOT compilation for simulator + Mac Catalyst.
The interpreter requires running the AOT compiler for System.Private.CoreLib.dll,
so the first step in implementing the interpreter is to implement support for the
AOT compiler as well.

For .NET the logic is now as follows:

* If the interpreter is enabled, AOT compile System.Private.CoreLib.dll.
* If the interpreter is disabled, AOT everything on device + Mac Catalyst on ARM64.
2021-07-22 10:36:21 +02:00
Rolf Bjarne Kvinge 24351db16c [runtime/tools] Implement finding native mono lib for Mac Catalyst.
This also meant propagating how libmono is linked from the MSBuild code to the Application
class so that our existing logic is able to correctly determine which native mono
lib to use.
2021-07-22 10:36:21 +02:00
Rolf Bjarne Kvinge eddf7b6c8d [runtime] AOT is no longer limited to device builds. 2021-07-22 10:36:21 +02:00
Rolf Bjarne Kvinge 1dacea4d8c [dotnet] Refactor and extend the logic to determine whether we should run the AOT compiler or not.
We also can't link dynamically with libmonosgen-2.0.dylib if we AOT compile anything,
so make sure we don't do that.
2021-07-22 10:36:20 +02:00
Rolf Bjarne Kvinge 76c8461764
[main] Update dependencies from dotnet/installer (#12064)
This pull request updates the following dependencies

## From https://github.com/dotnet/installer

- **Subscription**: df3e6147-3e41-4928-6775-08d8f479343c
- **Build**: 20210720.12
- **Date Produced**: 7/21/2021 6:57 AM
- **Commit**: d7279fc09fcfb108c5fb97fa290dbbb11c4c441b
- **Branch**: refs/heads/main

- **Updates**:
  - **Microsoft.Dotnet.Sdk.Internal**: [from 6.0.100-preview.7.21330.1 to 6.0.100-rc.1.21370.12][1]
  - **Microsoft.NET.ILLink.Tasks**: [from 6.0.100-preview.6.21329.2 to 6.0.100-preview.6.21370.1][2]

[1]: 823ff33...d7279fc
[2]: f549b4e...6eae019

## Coherency Updates

The following updates ensure that dependencies with a *CoherentParentDependency*
attribute were produced in a build used as input to the parent dependency's build.
See [Dependency Description Format](https://github.com/dotnet/arcade/blob/master/Documentation/DependencyDescriptionFormat.md#dependency-description-overview)

- **Coherency Updates**:
  - **Microsoft.NET.ILLink.Tasks**: from 6.0.100-preview.6.21329.2 to 6.0.100-preview.6.21370.1 (parent: Microsoft.Dotnet.Sdk.Internal)
2021-07-22 10:32:32 +02:00
VS MobileTools Engineering Service 2 042cd714fe
Localized file check-in by OneLocBuild Task: Build definition ID 14411: Build ID 4945304 (#12079)
First group of translated resx files coming from OneLocBuild!
2021-07-21 17:34:51 -05:00
Rachel Kang e40dc09a36
Update based on feedback 2021-07-21 16:22:29 -04:00
Peter Collins 2af23dbdfc
[CI] Add Prepare Release and VS Insertion stages (again) (#12157)
Context: xamarin/yaml-templates#117

Updates the .NET 6 NuGet packaging steps to exclude package metadata,
as the .msi conversion tooling does not process .nupkg file names with
the +sha.commit metadata.

Two new stages have been added to facilitate the Visual Studio setup
authoring process.

The first stage named "Prepare Release" will sign the .NET 6 NuGet
package content (inside and out), convert relevant packages to .msi
installers, generate Visual Studio manifests for the .msi installers,
and push the signed packages to the xamarin-impl feed.

The new SignList.xml file is required for our NuGet signing templates.

The new xamarin-workload.props file contains version information
and other metadata required to generate a Visual Studio manifest.

The second stage starts with a manual validation task. This task
will pause and wait for someone to click a "Resume" or "Reject" button
that will appear on the pipeline UI. This task is configured to be
rejected after waiting for two days, but it can be manually re-ran at a
later date if we want to trigger VS insertion for an older build.

If the manual validation task is approved, a VS Drop will be created
containing all .NET 6 .msi files. This Drop URL can then be used to
update our component versions in Visual Studio. This last piece is
currently manual as we will initially be introducing new components,
however we should be able to automate VS PR creation in the future.

Commit 09f911b missed adding the
PR build check condition to a step in sign-and-notarized.yml, causing
PR builds from forks to fail. We can fix this by adding in the missing
condition.
2021-07-21 13:09:29 -04:00
Manuel de la Pena adc002be4c
[CHIP] Add support fox Xcode 13 beta 3. (#12143) 2021-07-21 13:04:49 -04:00
Manuel de la Pena cd050316cc
[CoreBluetooth] Add Xcode 13 beta 3 support. (#12153) 2021-07-21 13:03:05 -04:00
Rolf Bjarne Kvinge de7f08d642
[tests/dotnet] Add .NET/Mac Catalyst test projects for dont link, link sdk and link all. (#12154)
* Add proper .NET project files for dont link, link sdk and link all. This
  includes a Mac Catalyst variant, and adding helpful Makefile targets for
  simple execution.

* Adjust various tests to work with Mac Catalyst.

* Add the new Mac Catalyst variants to xharness.

This is a partial fix for #10833.
2021-07-21 17:16:03 +02:00
Sebastien Pouliot fccd43f0c2
[dotnet][linker] Remove unused backing fields (#12001)
Problems:

* `Dispose` set the generated backing fields to `null` which means
  the linker will mark every backing fields, even if not used
  elsewhere (generally properties) inside the class

* Backing fields increase the memory footprint of the managed peer
  instance (for the type and all it's subclasses)

* Backing fields also increase the app size. Not a huge problem as
  they are all declared _weakly_ as `NSObject` but still...

Solution:

* When the linker process a `Dispose` method of an `NSObject`
  subclass with the _optimizable_ attribute then we remove the
  method body. This way the linker cannot mark the fields.

* Before saving back the assemblies we replace the cached method
  body and NOP every field that were not marked by something else
  than the `Dispose` method.

```diff
--- a.cs	2021-06-22 16:56:57.000000000 -0400
+++ b.cs	2021-06-22 16:57:00.000000000 -0400
@@ -3107,8 +3107,6 @@

 		private static readonly IntPtr class_ptr = Class.GetHandle("UIApplication");

-		private object __mt_WeakDelegate_var;
-
 		public override IntPtr ClassHandle => class_ptr;

 		[DllImport("__Internal")]
@@ -3141,9 +3139,8 @@
 		protected override void Dispose(bool P_0)
 		{
 			base.Dispose(P_0);
-			if (base.Handle == IntPtr.Zero)
+			if (!(base.Handle == IntPtr.Zero))
 			{
-				__mt_WeakDelegate_var = null;
 			}
 		}
 	}
@@ -3209,10 +3206,6 @@
 	{
 		private static readonly IntPtr class_ptr = Class.GetHandle("UIScreen");

-		private object __mt_FocusedItem_var;
-
-		private object __mt_FocusedView_var;
-
 		public override IntPtr ClassHandle => class_ptr;

 		public virtual CGRect Bounds
@@ -3242,10 +3235,8 @@
 		protected override void Dispose(bool P_0)
 		{
 			base.Dispose(P_0);
-			if (base.Handle == IntPtr.Zero)
+			if (!(base.Handle == IntPtr.Zero))
 			{
-				__mt_FocusedItem_var = null;
-				__mt_FocusedView_var = null;
 			}
 		}
 	}
@@ -3254,10 +3245,6 @@
 	{
 		private static readonly IntPtr class_ptr = Class.GetHandle("UIView");

-		private object __mt_ParentFocusEnvironment_var;
-
-		private object __mt_PreferredFocusedView_var;
-
 		public override IntPtr ClassHandle => class_ptr;

 		public virtual CGRect Bounds
@@ -3303,10 +3290,8 @@
 		protected override void Dispose(bool P_0)
 		{
 			base.Dispose(P_0);
-			if (base.Handle == IntPtr.Zero)
+			if (!(base.Handle == IntPtr.Zero))
 			{
-				__mt_ParentFocusEnvironment_var = null;
-				__mt_PreferredFocusedView_var = null;
 			}
 		}
 	}
@@ -3315,12 +3300,6 @@
 	{
 		private static readonly IntPtr class_ptr = Class.GetHandle("UIViewController");

-		private object __mt_ParentFocusEnvironment_var;
-
-		private object __mt_PreferredFocusedView_var;
-
-		private object __mt_WeakTransitioningDelegate_var;
-
 		public override IntPtr ClassHandle => class_ptr;

 		public virtual UIView View
@@ -3363,11 +3342,8 @@
 		protected override void Dispose(bool P_0)
 		{
 			base.Dispose(P_0);
-			if (base.Handle == IntPtr.Zero)
+			if (!(base.Handle == IntPtr.Zero))
 			{
-				__mt_ParentFocusEnvironment_var = null;
-				__mt_PreferredFocusedView_var = null;
-				__mt_WeakTransitioningDelegate_var = null;
 			}
 		}
 	}
@@ -3376,8 +3352,6 @@
 	{
 		private static readonly IntPtr class_ptr = Class.GetHandle("UIWindow");

-		private object __mt_WindowScene_var;
-
 		public override IntPtr ClassHandle => class_ptr;

 		public virtual UIViewController RootViewController
@@ -3411,9 +3385,8 @@
 		protected override void Dispose(bool P_0)
 		{
 			base.Dispose(P_0);
-			if (base.Handle == IntPtr.Zero)
+			if (!(base.Handle == IntPtr.Zero))
 			{
-				__mt_WindowScene_var = null;
 			}
 		}
 	}
```

* Do not consider bindings with `[Dispose (...)]` as optimizable

Injected code makes it impossible for `bgen` to decide if it's optimizable (or not)
Filed https://github.com/xamarin/xamarin-macios/issues/12150 with more details (and for other similar attributes)
2021-07-21 09:03:25 -04:00
Rolf Bjarne Kvinge f521537e0a
[AppKit/UIKit] Share the implementation of some classes between AppKit and UIKit. (#12161)
* [AppKit/UIKit] Merge the definitions of NSTextLayoutOrientationProvider.

It looks like this might be a breaking change for macOS, but the macOS
definition had only a [Model] attribute, which won't make the generator
generate any public API.

* [AppKit/UIKit] Merge the definitions of NSTextContainer.

* [AppKit/UIKit] Merge the definitions of NSExtendedStringDrawing.
2021-07-21 14:52:19 +02:00
dotnet-maestro[bot] 6b911ee652 Update dependencies from https://github.com/dotnet/installer build 20210720.12
Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.7.21330.1 -> To Version 6.0.100-rc.1.21370.12

Dependency coherency updates

Microsoft.NET.ILLink.Tasks
 From Version 6.0.100-preview.6.21329.2 -> To Version 6.0.100-preview.6.21370.1 (parent: Microsoft.Dotnet.Sdk.Internal
2021-07-21 12:24:52 +00:00
Rolf Bjarne Kvinge 5c30c015c3 Merge remote-tracking branch 'origin/main' into darc-main-2c3dc6cd-c245-4d20-9461-75a98d067b3b 2021-07-21 10:12:01 +02:00
Rolf Bjarne Kvinge b082e6b8aa
[AppKit/UIKit] Share the implementation of some classes between AppKit and UIKit. (#12146)
* [src] Share the NSTextStorage[Delegate] implementations between AppKit and UIKit.

* [AppKit/UIKit] Merge the definitions of NSCollectionLayoutAnchor.

* [AppKit/UIKit] Merge the definitions of the NSCollectionLayout* classes.

* [AppKit/UIKit] Merge the definitions of NSDataAsset.

* [AppKit/UIKit] Merge the definitions of NSShadow.

* [AppKit/UIKit] Merge the definitions of NSTextTab.

* Update xtro.
2021-07-21 10:08:17 +02:00
Rolf Bjarne Kvinge c0e9ca9673 [dotnet] Remove workaround for missing bits in the Mono runtime workload. 2021-07-21 09:33:33 +02:00
Rolf Bjarne Kvinge b4dd54bbce [dont link] Ignore the Calendar tests on Mac Catalyst. 2021-07-21 09:32:12 +02:00
Rolf Bjarne Kvinge 5072961d84
Bump maccore. (#12155)
New commits in xamarin/maccore:

* xamarin/maccore@536fd9a01b [Xamarin.Hosting] Add support to write output to a tty. (#2468)

Diff: 99ad0341f4..536fd9a01b

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-07-21 09:19:24 +02:00
Manuel de la Pena eec8246603
Merge branch 'main' into xcode13.0-storekit-b1 2021-07-20 13:18:27 -07:00
Manuel de la Pena 1bdf96d422
Merge branch 'main' into dotnet-linker-tests 2021-07-20 13:17:47 -07:00
Manuel de la Pena eea8142e6b
Revert "[CI] Add Prepare Release and VS Insertion stages (#12015)" (#12156)
This reverts commit 09f911b504. The comit
made changes in the logic that is used to build the PRs in public bots
meaning that all PRs fail.
2021-07-20 16:17:13 -04:00
Manuel de la Pena c138cce7ba
[ImageIO] Add support for Xcode 13 beta 3. (#12145) 2021-07-20 15:42:56 -04:00
Manuel de la Pena 4d329df138
[GameController] Add support for xcode 13 beta3. (#12144)
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-07-20 15:39:39 -04:00
Rolf Bjarne Kvinge d30bdc9809 [dotnet-linker] Enable some optimizations on Mac Catalyst.
Fixes this link all test:

    SetupBlockPerfTest: At least 6x speedup
        Expected: greater than 6
        But was: 0.81771070682913238d
2021-07-20 17:57:03 +02:00
Rachel Kang bd4c627746
[StoreKit] Update bindings for Xcode 13.0 beta 1 2021-07-20 11:36:36 -04:00
Peter Collins 09f911b504
[CI] Add Prepare Release and VS Insertion stages (#12015)
Context: https://github.com/xamarin/yaml-templates/pull/117

Updates the .NET 6 NuGet packaging steps to exclude package metadata,
as the .msi conversion tooling does not process .nupkg file names with
the `+sha.commit` metadata.

Two new stages have been added to facilitate the Visual Studio setup
authoring process.

The first stage named "Prepare Release" will sign the .NET 6 NuGet
package content (inside and out), convert relevant packages to .msi
installers, generate Visual Studio manifests for the .msi installers,
and push the signed packages to the `xamarin-impl` feed.

The new `SignList.xml` file is required for our NuGet signing templates.

The new `xamarin-workload.props` file contains version information
and other metadata required to generate a Visual Studio manifest.

The second stage starts with a [manual validation task][0].  This task
will pause and wait for someone to click a "Resume" or "Reject" button
that will appear on the pipeline UI.  This task is configured to be
rejected after waiting for two days, but it can be manually re-ran at a
later date if we want to trigger VS insertion for an older build.

If the manual validation task is approved, a VS Drop will be created
containing all .NET 6 .msi files.  This Drop URL can then be used to
update our component versions in Visual Studio.  This last piece is
currently manual as we will initially be introducing new components,
however we should be able to automate VS PR creation in the future.

[0]: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/manual-validation?view=azure-devops&tabs=yaml
2021-07-20 17:32:43 +02:00
Rolf Bjarne Kvinge 28989758ba [link sdk] The SpecialFolder.ProgramFiles path may or may not exist. 2021-07-20 15:54:48 +02:00
Rolf Bjarne Kvinge c7fe2fefd5 [link sdk] Adjust the Bug2000_NSPersistentStoreCoordinator test to create file in a temporary directory.
It would create a file in the current directory, which is the root directory of the app bundle.

This would work in the simulator (because the directory is read-write), fail
on device (because the directory is read-only), and cause rebuilds to fail
with Mac Catalyst (because the directory is read-write the test would succeed,
but it would write files in the root directory of the app bundle, which is not
allowed for macOS apps, and thus codesign would fail when rebuilding the app).

So change the test to create any files in a temporary directory, and adjust it
to always expect the file to be created.

And just in case also delete the file at the end of the test.
2021-07-20 15:54:48 +02:00
Rolf Bjarne Kvinge b890b2b248 [xharness] Add .NET/Mac Catalyst versions of dont link, link sdk and link all. 2021-07-20 15:54:48 +02:00
Rolf Bjarne Kvinge 82b1331210 [xharness] Rewrite the 'RootTestsDirectory' property when cloning a project. 2021-07-20 15:54:48 +02:00
Rolf Bjarne Kvinge 56baf35c79 [tests] Adjust 'link all' to work on Mac Catalyst. 2021-07-20 15:54:48 +02:00
Rolf Bjarne Kvinge ad50c76a88 [tests] Add proper .NET project files for dont link, link sdk and link all tests.
This includes adding a Mac Catalyst variation as well, and adding helpful Makefile
targets for simple execution.

This is a partial fix for #10833.
2021-07-20 15:54:48 +02:00
Rolf Bjarne Kvinge 3f3698253b [dotnet] Quote the path to the app when launching it. 2021-07-20 15:54:47 +02:00
Rolf Bjarne Kvinge 813b47c5f6 [tests] Make the copy-dotnet-config rule work with paths with spaces, and copy to the linker test directories as well. 2021-07-20 15:54:47 +02:00
Rolf Bjarne Kvinge 7e37fe622e [monotouch-test] Adjust HttpClientHandler tests.
Adjust HttpClientHandler tests to cope with
https://github.com/dotnet/runtime/issues/50859 and
https://github.com/xamarin/xamarin-macios/issues/11392.
2021-07-20 14:54:02 +02:00
Rolf Bjarne Kvinge f90a2f5c75 [monotouch-test] Adjust HttpClientHandler tests to cope with https://github.com/dotnet/runtime/issues/55986. 2021-07-20 14:54:02 +02:00
Rolf Bjarne Kvinge 793b7bb706 [monotouch-test] Make HttpClientTest.EnsureModifiabilityPostSend accept a InvalidOperationException inside a TargetInvocationException for .NET. 2021-07-20 14:54:02 +02:00
Rolf Bjarne Kvinge ab10456117 [monotouch-test] Ignore NSTimeZoneTest.All_28300 on Mac Catalyst.
Due to https://github.com/dotnet/runtime/issues/55941.
2021-07-20 14:54:02 +02:00
Rolf Bjarne Kvinge a3f9519ed1 Merge remote-tracking branch 'origin/main' into HEAD 2021-07-20 14:53:57 +02:00
Rolf Bjarne Kvinge 3c38f8ccd6
[dotnet] Enable autorelease pools for threadpools. Fixes #11750. (#12060)
Fixes https://github.com/xamarin/xamarin-macios/issues/11750.
2021-07-20 14:34:37 +02:00
dotnet-maestro[bot] bb7556c95e Update dependencies from https://github.com/dotnet/installer build 20210719.20
Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.7.21330.1 -> To Version 6.0.100-rc.1.21369.20

Dependency coherency updates

Microsoft.NET.ILLink.Tasks
 From Version 6.0.100-preview.6.21329.2 -> To Version 6.0.100-preview.6.21369.3 (parent: Microsoft.Dotnet.Sdk.Internal
2021-07-20 12:25:54 +00:00
Rolf Bjarne Kvinge e9c8b50e53
[xharness] Handle exceptions that occur while listing device candidates gracefully. (#12133)
This fixes a problem where the html report wouldn't be re-generated if there
was a problem loading a device (which for instance could happen if xharness
was unable to create a required simulator).
2021-07-20 12:19:31 +02:00
Rolf Bjarne Kvinge 80d2bfa252
[src] Share the NSTextAttachment[Container] implementations between AppKit and UIKit. (#12135)
* [src] Share the NSTextAttachment[Container] implementations between AppKit and UIKit.

* Use shared definition of UIImage/NSImage.
2021-07-20 08:00:35 +02:00