From c90d41884409aedf631eaef8ca86968c3d9a5a71 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Tue, 8 Oct 2019 09:57:17 -0400 Subject: [PATCH 01/66] Bump to mono:2019-10 --- .external | 2 +- Configuration.props | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.external b/.external index 3effd92cbbf..309b245b314 100644 --- a/.external +++ b/.external @@ -1,2 +1,2 @@ xamarin/monodroid:master@28ffbd3d031e96d8dc5d4d201ee41dabc261d471 -mono/mono:2019-08@528103728fc2aedb7b6062e11255d39a0ed3f31c +mono/mono:2019-10@af8d610864cacb842c6976a6ac1d14f99b56b6e6 diff --git a/Configuration.props b/Configuration.props index c1b52183fd2..17ab9aa4a51 100644 --- a/Configuration.props +++ b/Configuration.props @@ -78,10 +78,10 @@ armeabi-v7a:arm64-v8a:x86 $(MSBuildThisFileDirectory)external\Java.Interop $(MSBuildThisFileDirectory)external\mono - 6.6.0 - 6.7.0 + 6.8.0 + 6.9.0 True - $(MonoRequiredMinimumVersion).54 + $(MonoRequiredMinimumVersion).0 $(MSBuildThisFileDirectory)external\mono\sdks\out\android-sources\external\linker\src $(MSBuildThisFileDirectory)external\opentk \usr From fd0929c1125345bc25cc815e9fd1b2e9da485217 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Tue, 8 Oct 2019 10:26:22 -0400 Subject: [PATCH 02/66] Add new Mono Linker file to Xamarin.Android.Build.Tasks.csproj --- .../Xamarin.Android.Build.Tasks.csproj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj index 8ef1c4b5052..5cb8b3ea883 100644 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj @@ -330,6 +330,9 @@ Linker\Linker\MethodReferenceExtensions.cs + + Linker\Linker\OutputException.cs + Linker\Linker\OverrideInformation.cs From 1539594bef20a5e626dd57c6325f1a21b63d91b8 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Wed, 9 Oct 2019 09:39:35 -0400 Subject: [PATCH 03/66] Bump Mono to 6.8.0.3 --- .external | 2 +- Configuration.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.external b/.external index 309b245b314..bf756418fc5 100644 --- a/.external +++ b/.external @@ -1,2 +1,2 @@ xamarin/monodroid:master@28ffbd3d031e96d8dc5d4d201ee41dabc261d471 -mono/mono:2019-10@af8d610864cacb842c6976a6ac1d14f99b56b6e6 +mono/mono:2019-10@140dcdb7a3972c478276113d26a5e39d29b44818 diff --git a/Configuration.props b/Configuration.props index 17ab9aa4a51..6f4acb0dd35 100644 --- a/Configuration.props +++ b/Configuration.props @@ -81,7 +81,7 @@ 6.8.0 6.9.0 True - $(MonoRequiredMinimumVersion).0 + $(MonoRequiredMinimumVersion).3 $(MSBuildThisFileDirectory)external\mono\sdks\out\android-sources\external\linker\src $(MSBuildThisFileDirectory)external\opentk \usr From 6723759127747e61c9e3c9a85a704f1d51bd30ce Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Fri, 11 Oct 2019 09:45:15 -0400 Subject: [PATCH 04/66] Bumped Mono again --- .external | 2 +- Configuration.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.external b/.external index bf756418fc5..6192edef3be 100644 --- a/.external +++ b/.external @@ -1,2 +1,2 @@ xamarin/monodroid:master@28ffbd3d031e96d8dc5d4d201ee41dabc261d471 -mono/mono:2019-10@140dcdb7a3972c478276113d26a5e39d29b44818 +mono/mono:2019-10@4c611593aca6de583ea6137c9813363669af768b diff --git a/Configuration.props b/Configuration.props index 6f4acb0dd35..1f0e125af26 100644 --- a/Configuration.props +++ b/Configuration.props @@ -81,7 +81,7 @@ 6.8.0 6.9.0 True - $(MonoRequiredMinimumVersion).3 + $(MonoRequiredMinimumVersion).5 $(MSBuildThisFileDirectory)external\mono\sdks\out\android-sources\external\linker\src $(MSBuildThisFileDirectory)external\opentk \usr From dff180b88b622b2522d858011c68318fc616e83b Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Mon, 14 Oct 2019 15:38:07 -0400 Subject: [PATCH 05/66] Bump Mono again --- .external | 2 +- Configuration.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.external b/.external index 0c0a1e4a0e6..b0299df4a31 100644 --- a/.external +++ b/.external @@ -1,2 +1,2 @@ xamarin/monodroid:master@e803e0d701146e2266324912c7d6066fa62caeb1 -mono/mono:2019-10@4c611593aca6de583ea6137c9813363669af768b +mono/mono:2019-10@fa2ee06b70795571322024886e409d0a4f21d6ee diff --git a/Configuration.props b/Configuration.props index 1f0e125af26..ae23cde19d9 100644 --- a/Configuration.props +++ b/Configuration.props @@ -81,7 +81,7 @@ 6.8.0 6.9.0 True - $(MonoRequiredMinimumVersion).5 + $(MonoRequiredMinimumVersion).10 $(MSBuildThisFileDirectory)external\mono\sdks\out\android-sources\external\linker\src $(MSBuildThisFileDirectory)external\opentk \usr From 51bace48cb8c60ba7067e3883cc234a351f3c9ae Mon Sep 17 00:00:00 2001 From: Joseph Shields Date: Tue, 15 Oct 2019 08:36:47 -0400 Subject: [PATCH 06/66] Bump Mono again --- .external | 2 +- Configuration.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.external b/.external index b0299df4a31..c613d1e37b0 100644 --- a/.external +++ b/.external @@ -1,2 +1,2 @@ xamarin/monodroid:master@e803e0d701146e2266324912c7d6066fa62caeb1 -mono/mono:2019-10@fa2ee06b70795571322024886e409d0a4f21d6ee +mono/mono:2019-10@e53a3041c02f9792d1494c74087cffa4db560a3d diff --git a/Configuration.props b/Configuration.props index ae23cde19d9..cec7fa7b69b 100644 --- a/Configuration.props +++ b/Configuration.props @@ -81,7 +81,7 @@ 6.8.0 6.9.0 True - $(MonoRequiredMinimumVersion).10 + $(MonoRequiredMinimumVersion).14 $(MSBuildThisFileDirectory)external\mono\sdks\out\android-sources\external\linker\src $(MSBuildThisFileDirectory)external\opentk \usr From 10b542c639690731cc669e8a28b1d6852762d1fb Mon Sep 17 00:00:00 2001 From: Joseph Shields Date: Thu, 17 Oct 2019 08:59:46 -0400 Subject: [PATCH 07/66] Bump Mono again. MSBuild seems flakey, Forms instrumentation is broken for real --- .external | 2 +- Configuration.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.external b/.external index 8f7f38775f3..f285fcb3192 100644 --- a/.external +++ b/.external @@ -1,2 +1,2 @@ xamarin/monodroid:master@ab054acc3fef6ae979c8dd447fb9723eee83c9de -mono/mono:2019-10@e53a3041c02f9792d1494c74087cffa4db560a3d +mono/mono:2019-10@893cf3ae31e6138e792f4ebc73f3756bf3fbd53d diff --git a/Configuration.props b/Configuration.props index cec7fa7b69b..0c5e3a03295 100644 --- a/Configuration.props +++ b/Configuration.props @@ -81,7 +81,7 @@ 6.8.0 6.9.0 True - $(MonoRequiredMinimumVersion).14 + $(MonoRequiredMinimumVersion).19 $(MSBuildThisFileDirectory)external\mono\sdks\out\android-sources\external\linker\src $(MSBuildThisFileDirectory)external\opentk \usr From ce9c43a53ef92e01e58e229ff7059741808607fe Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Tue, 22 Oct 2019 12:59:20 -0400 Subject: [PATCH 08/66] Routine Mono bump --- .external | 2 +- Configuration.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.external b/.external index ea39db55920..d25e90c8afe 100644 --- a/.external +++ b/.external @@ -1,2 +1,2 @@ xamarin/monodroid:master@dceaee4ed2a49a81c86bc52b47f07faaf7e4fc13 -mono/mono:2019-10@893cf3ae31e6138e792f4ebc73f3756bf3fbd53d +mono/mono:2019-10@2783f7c2e6974bce48336fb9147abd88a4cd81f5 diff --git a/Configuration.props b/Configuration.props index 0c5e3a03295..9028883c7f4 100644 --- a/Configuration.props +++ b/Configuration.props @@ -81,7 +81,7 @@ 6.8.0 6.9.0 True - $(MonoRequiredMinimumVersion).19 + $(MonoRequiredMinimumVersion).25 $(MSBuildThisFileDirectory)external\mono\sdks\out\android-sources\external\linker\src $(MSBuildThisFileDirectory)external\opentk \usr From 032f4d2c2bd082bca52751ea58fc01077bbfb8c8 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Tue, 22 Oct 2019 16:17:28 -0400 Subject: [PATCH 09/66] "default" and "legacy" TLS providers now aliases for "btls" --- .../Tests/Xamarin.Android.Build.Tests/BuildTest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs index c3b82e50b35..a0bbaada8f9 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs @@ -2740,8 +2740,8 @@ public void BuildWithResolveAssembliesFailure ([Values (true, false)] bool usePa { // androidTlsProvider, isRelease, extpected new object[] { "", true, true, }, - new object[] { "default", true, false, }, - new object[] { "legacy", true, false, }, + new object[] { "default", true, true, }, + new object[] { "legacy", true, true, }, new object[] { "btls", true, true, } }; From b5f27977e73848540ea93f2f6b545944c7b58cac Mon Sep 17 00:00:00 2001 From: Joseph Shields Date: Wed, 23 Oct 2019 09:28:59 -0400 Subject: [PATCH 10/66] Be more aggressive with TLS provider changes I guess? --- .../Tests/Xamarin.Android.Build.Tests/BuildTest.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs index a0bbaada8f9..049282bceb7 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs @@ -2740,8 +2740,6 @@ public void BuildWithResolveAssembliesFailure ([Values (true, false)] bool usePa { // androidTlsProvider, isRelease, extpected new object[] { "", true, true, }, - new object[] { "default", true, true, }, - new object[] { "legacy", true, true, }, new object[] { "btls", true, true, } }; From 95b40e35510f0cf300db5bf141e68b21f6c5fba9 Mon Sep 17 00:00:00 2001 From: Joseph Shields Date: Wed, 23 Oct 2019 10:20:11 -0400 Subject: [PATCH 11/66] Revert "Be more aggressive with TLS provider changes I guess?" This reverts commit b5f27977e73848540ea93f2f6b545944c7b58cac. --- .../Tests/Xamarin.Android.Build.Tests/BuildTest.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs index 049282bceb7..a0bbaada8f9 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs @@ -2740,6 +2740,8 @@ public void BuildWithResolveAssembliesFailure ([Values (true, false)] bool usePa { // androidTlsProvider, isRelease, extpected new object[] { "", true, true, }, + new object[] { "default", true, true, }, + new object[] { "legacy", true, true, }, new object[] { "btls", true, true, } }; From 6aab944b99b4f70c46606412898d099b808fb53a Mon Sep 17 00:00:00 2001 From: Joseph Shields Date: Wed, 23 Oct 2019 10:21:42 -0400 Subject: [PATCH 12/66] Let's try this again. Not only tests need to reflect BTLS-or-bust --- .../Linker/MonoDroid.Tuner/PreserveTlsProvider.cs | 6 ++---- src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs | 6 +----- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Linker/MonoDroid.Tuner/PreserveTlsProvider.cs b/src/Xamarin.Android.Build.Tasks/Linker/MonoDroid.Tuner/PreserveTlsProvider.cs index 0f1961e2fc0..043b47805d3 100644 --- a/src/Xamarin.Android.Build.Tasks/Linker/MonoDroid.Tuner/PreserveTlsProvider.cs +++ b/src/Xamarin.Android.Build.Tasks/Linker/MonoDroid.Tuner/PreserveTlsProvider.cs @@ -34,12 +34,10 @@ TypeDefinition GetTlsProvider (ModuleDefinition module) TypeDefinition type; switch (provider) { - case "btls": - type = module.GetType ("Mono.Btls.MonoBtlsProvider"); - break; case "legacy": case "default": - type = module.GetType ("Mono.Net.Security.LegacyTlsProvider"); + case "btls": + type = module.GetType ("Mono.Btls.MonoBtlsProvider"); break; default: throw new InvalidOperationException (string.Format ("Unknown TlsProvider `{0}`.", provider)); diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs b/src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs index 1a1cb2becd3..2e7d331689e 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs @@ -409,13 +409,9 @@ void AddProfilers (ZipArchiveEx apk, string abi) void AddBtlsLibs (ZipArchiveEx apk, string abi) { - if (string.IsNullOrEmpty (TlsProvider) || - string.Compare ("btls", TlsProvider, StringComparison.OrdinalIgnoreCase) == 0) { + if (string.IsNullOrEmpty (TlsProvider) { AddNativeLibrary (apk, abi, "libmono-btls-shared.so"); } - // These are the other supported values - // * "default": - // * "legacy": } void AddRuntimeLibraries (ZipArchiveEx apk, string [] supportedAbis) From ab6d99910442828391067d24527342479b2515f9 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Wed, 23 Oct 2019 12:51:20 -0400 Subject: [PATCH 13/66] Fix typo --- src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs b/src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs index 2e7d331689e..a1771963f6e 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs @@ -409,7 +409,7 @@ void AddProfilers (ZipArchiveEx apk, string abi) void AddBtlsLibs (ZipArchiveEx apk, string abi) { - if (string.IsNullOrEmpty (TlsProvider) { + if (string.IsNullOrEmpty (TlsProvider)) { AddNativeLibrary (apk, abi, "libmono-btls-shared.so"); } } From 35ea6cdff7793b327248f9536d30390311f57c00 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Wed, 23 Oct 2019 13:27:44 -0400 Subject: [PATCH 14/66] Force BTLS to be installed on Linux --- build-tools/automation/build.linux.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/build-tools/automation/build.linux.groovy b/build-tools/automation/build.linux.groovy index 1501261fcb4..41798d79bff 100644 --- a/build-tools/automation/build.linux.groovy +++ b/build-tools/automation/build.linux.groovy @@ -27,6 +27,7 @@ def chRootPackages = ''' lib32z1 libc++-dev libgdk-pixbuf2.0-dev + libmono-btls-interface4.0-cil libncurses5-dev libsqlite3-dev libtinfo-dev:i386 From 42282b74d91727d5a696a3479ca120d18746e399 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Wed, 23 Oct 2019 15:45:21 -0400 Subject: [PATCH 15/66] Bump external/xamarin-android-api-compatibility to include Legacy TLS removal --- .gitmodules | 2 +- external/xamarin-android-api-compatibility | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index c132937ae72..2ea169eb905 100644 --- a/.gitmodules +++ b/.gitmodules @@ -37,7 +37,7 @@ [submodule "external/xamarin-android-api-compatibility"] path = external/xamarin-android-api-compatibility url = https://github.com/xamarin/xamarin-android-api-compatibility.git - branch = master + branch = mono-2019-10 [submodule "external/xamarin-android-tools"] path = external/xamarin-android-tools url = https://github.com/xamarin/xamarin-android-tools diff --git a/external/xamarin-android-api-compatibility b/external/xamarin-android-api-compatibility index a61271e046d..dc03ce4d3af 160000 --- a/external/xamarin-android-api-compatibility +++ b/external/xamarin-android-api-compatibility @@ -1 +1 @@ -Subproject commit a61271e046db989b4c9ec9f4d00c4358e07a2930 +Subproject commit dc03ce4d3afdf237799a14a028c1b3d80ac962cd From a1963396e5362922f8976dded305cecccb0ca248 Mon Sep 17 00:00:00 2001 From: Joseph Shields Date: Thu, 24 Oct 2019 09:18:02 -0400 Subject: [PATCH 16/66] Why was that even a conditional? --- src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs b/src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs index a1771963f6e..d9b5fcee43e 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs @@ -409,9 +409,7 @@ void AddProfilers (ZipArchiveEx apk, string abi) void AddBtlsLibs (ZipArchiveEx apk, string abi) { - if (string.IsNullOrEmpty (TlsProvider)) { - AddNativeLibrary (apk, abi, "libmono-btls-shared.so"); - } + AddNativeLibrary (apk, abi, "libmono-btls-shared.so"); } void AddRuntimeLibraries (ZipArchiveEx apk, string [] supportedAbis) From 12577b507d8093886dde21464fa1b445fe3ff647 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Fri, 25 Oct 2019 09:27:31 -0400 Subject: [PATCH 17/66] Bump Mono --- .external | 2 +- Configuration.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.external b/.external index f7460115a67..f89d99eca08 100644 --- a/.external +++ b/.external @@ -1,2 +1,2 @@ xamarin/monodroid:master@7f40abfa6f55a801619973af0cb875bf5a58c0c9 -mono/mono:2019-10@2783f7c2e6974bce48336fb9147abd88a4cd81f5 +mono/mono:2019-10@1553db019d96f6b28bce1e02149de572566b2607 diff --git a/Configuration.props b/Configuration.props index 9028883c7f4..a8f8b15cc4c 100644 --- a/Configuration.props +++ b/Configuration.props @@ -81,7 +81,7 @@ 6.8.0 6.9.0 True - $(MonoRequiredMinimumVersion).25 + $(MonoRequiredMinimumVersion).32 $(MSBuildThisFileDirectory)external\mono\sdks\out\android-sources\external\linker\src $(MSBuildThisFileDirectory)external\opentk \usr From 416fd7dfc36ebff435d5dd7e7383559da18cdcf4 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Fri, 25 Oct 2019 13:02:11 -0400 Subject: [PATCH 18/66] Bump for more major SSL changes --- .external | 2 +- Configuration.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.external b/.external index f89d99eca08..0521c56def4 100644 --- a/.external +++ b/.external @@ -1,2 +1,2 @@ xamarin/monodroid:master@7f40abfa6f55a801619973af0cb875bf5a58c0c9 -mono/mono:2019-10@1553db019d96f6b28bce1e02149de572566b2607 +mono/mono:2019-10@098d12c616e63073dcba4e4186bda213a9a3da54 diff --git a/Configuration.props b/Configuration.props index a8f8b15cc4c..b1db5fd1e04 100644 --- a/Configuration.props +++ b/Configuration.props @@ -81,7 +81,7 @@ 6.8.0 6.9.0 True - $(MonoRequiredMinimumVersion).32 + $(MonoRequiredMinimumVersion).33 $(MSBuildThisFileDirectory)external\mono\sdks\out\android-sources\external\linker\src $(MSBuildThisFileDirectory)external\opentk \usr From ce069001341522fece5379483a624ae37b7f4a41 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Fri, 25 Oct 2019 16:30:27 -0400 Subject: [PATCH 19/66] Add gref debugging --- build-tools/scripts/TestApks.targets | 1 + .../Tests/Xamarin.ProjectTools/Environment.txt | 1 + .../Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj | 3 +++ 3 files changed, 5 insertions(+) create mode 100644 src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Environment.txt diff --git a/build-tools/scripts/TestApks.targets b/build-tools/scripts/TestApks.targets index 34bb4f66614..6b11831e5b8 100644 --- a/build-tools/scripts/TestApks.targets +++ b/build-tools/scripts/TestApks.targets @@ -273,6 +273,7 @@ AddResults="true" LabelSuffix="-$(Configuration)$(TestsFlavor)" Activity="%(_AllArchives.Activity)" /> + + + + From 4cd008ae927c665e8eef5b9d3ca960ec38951da9 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Mon, 28 Oct 2019 09:22:50 -0400 Subject: [PATCH 20/66] Bump again --- .external | 2 +- Configuration.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.external b/.external index 0521c56def4..27005d77d74 100644 --- a/.external +++ b/.external @@ -1,2 +1,2 @@ xamarin/monodroid:master@7f40abfa6f55a801619973af0cb875bf5a58c0c9 -mono/mono:2019-10@098d12c616e63073dcba4e4186bda213a9a3da54 +mono/mono:2019-10@c45cf8ede2c262398b8067486bee567dc311d26d diff --git a/Configuration.props b/Configuration.props index b1db5fd1e04..9008b70fadd 100644 --- a/Configuration.props +++ b/Configuration.props @@ -81,7 +81,7 @@ 6.8.0 6.9.0 True - $(MonoRequiredMinimumVersion).33 + $(MonoRequiredMinimumVersion).34 $(MSBuildThisFileDirectory)external\mono\sdks\out\android-sources\external\linker\src $(MSBuildThisFileDirectory)external\opentk \usr From 3cb7187e4fe5c2196b17d0a331182e3a5f24d5a5 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Mon, 28 Oct 2019 09:25:04 -0400 Subject: [PATCH 21/66] Make Mono.Android debuggable --- src/Mono.Android/Test/Properties/AndroidManifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mono.Android/Test/Properties/AndroidManifest.xml b/src/Mono.Android/Test/Properties/AndroidManifest.xml index d15674daf9a..86648bca6c4 100644 --- a/src/Mono.Android/Test/Properties/AndroidManifest.xml +++ b/src/Mono.Android/Test/Properties/AndroidManifest.xml @@ -1,7 +1,7 @@  - + From 6e5478fcbba276ac83083441882be7e19645ff4e Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Mon, 28 Oct 2019 11:08:00 -0400 Subject: [PATCH 22/66] Bump API checks --- external/xamarin-android-api-compatibility | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/xamarin-android-api-compatibility b/external/xamarin-android-api-compatibility index dc03ce4d3af..6b40592e609 160000 --- a/external/xamarin-android-api-compatibility +++ b/external/xamarin-android-api-compatibility @@ -1 +1 @@ -Subproject commit dc03ce4d3afdf237799a14a028c1b3d80ac962cd +Subproject commit 6b40592e609a9dfa0c3a5d30f9edb14ded0a6dea From e26c792d6b16c5aab824225e193d6be164435e2b Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Tue, 29 Oct 2019 09:58:34 -0400 Subject: [PATCH 23/66] Try to fix grefs logcat not working on Xamarin.Forms_Performance_Integration --- build-tools/scripts/TestApks.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-tools/scripts/TestApks.targets b/build-tools/scripts/TestApks.targets index 6b11831e5b8..3f3408c4584 100644 --- a/build-tools/scripts/TestApks.targets +++ b/build-tools/scripts/TestApks.targets @@ -273,7 +273,7 @@ AddResults="true" LabelSuffix="-$(Configuration)$(TestsFlavor)" Activity="%(_AllArchives.Activity)" /> - + Date: Tue, 29 Oct 2019 12:43:34 -0400 Subject: [PATCH 24/66] Make Forms test debuggable? --- .../Droid/Properties/AndroidManifest.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Xamarin.Forms-Performance-Integration/Droid/Properties/AndroidManifest.xml b/tests/Xamarin.Forms-Performance-Integration/Droid/Properties/AndroidManifest.xml index c9182a70c56..54d8ff31215 100644 --- a/tests/Xamarin.Forms-Performance-Integration/Droid/Properties/AndroidManifest.xml +++ b/tests/Xamarin.Forms-Performance-Integration/Droid/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@  - - \ No newline at end of file + + From e20d8b01890a79b65c17e6b6dfb97a2bd931956a Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Tue, 29 Oct 2019 15:01:38 -0400 Subject: [PATCH 25/66] Still tryign to make grefs work --- .../Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj | 6 +++--- tests/Xamarin.Forms-Performance-Integration/Environment.txt | 1 + .../Xamarin.Forms.Performance.Integration.csproj | 5 ++++- 3 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 tests/Xamarin.Forms-Performance-Integration/Environment.txt diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj index bbd0f89b94d..1a08c7daf36 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj @@ -91,6 +91,9 @@ + + + Xamarin.ProjectTools.Resources.Wear.LayoutMain.axml @@ -169,7 +172,4 @@ - - - diff --git a/tests/Xamarin.Forms-Performance-Integration/Environment.txt b/tests/Xamarin.Forms-Performance-Integration/Environment.txt new file mode 100644 index 00000000000..37c063decc9 --- /dev/null +++ b/tests/Xamarin.Forms-Performance-Integration/Environment.txt @@ -0,0 +1 @@ +debug.mono.log gref diff --git a/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj b/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj index e2e6ca7a2ee..53184adc252 100644 --- a/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj +++ b/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj @@ -12,4 +12,7 @@ - \ No newline at end of file + + + + From ccbe30cd13a08def06c81786422b179a1a3cd1d9 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Wed, 30 Oct 2019 10:00:06 -0400 Subject: [PATCH 26/66] ignore exit code for gref grab --- build-tools/scripts/TestApks.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-tools/scripts/TestApks.targets b/build-tools/scripts/TestApks.targets index 3f3408c4584..7814150aa0e 100644 --- a/build-tools/scripts/TestApks.targets +++ b/build-tools/scripts/TestApks.targets @@ -273,7 +273,7 @@ AddResults="true" LabelSuffix="-$(Configuration)$(TestsFlavor)" Activity="%(_AllArchives.Activity)" /> - + Date: Wed, 30 Oct 2019 10:01:57 -0400 Subject: [PATCH 27/66] Bump mono --- .external | 2 +- Configuration.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.external b/.external index 27005d77d74..8db944991a8 100644 --- a/.external +++ b/.external @@ -1,2 +1,2 @@ xamarin/monodroid:master@7f40abfa6f55a801619973af0cb875bf5a58c0c9 -mono/mono:2019-10@c45cf8ede2c262398b8067486bee567dc311d26d +mono/mono:2019-10@010050adc8f463519db2c22cfea947cef530de97 diff --git a/Configuration.props b/Configuration.props index 9008b70fadd..2814fc4aa4e 100644 --- a/Configuration.props +++ b/Configuration.props @@ -81,7 +81,7 @@ 6.8.0 6.9.0 True - $(MonoRequiredMinimumVersion).34 + $(MonoRequiredMinimumVersion).37 $(MSBuildThisFileDirectory)external\mono\sdks\out\android-sources\external\linker\src $(MSBuildThisFileDirectory)external\opentk \usr From 9c01759c98185adcae507f1268aa16a3f45894bf Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Wed, 30 Oct 2019 10:08:47 -0400 Subject: [PATCH 28/66] Let's see if grefs behave now --- .../Tests/Xamarin.ProjectTools/Environment.txt | 2 +- tests/Xamarin.Forms-Performance-Integration/Environment.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Environment.txt b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Environment.txt index 37c063decc9..566f3839478 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Environment.txt +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Environment.txt @@ -1 +1 @@ -debug.mono.log gref +debug.mono.log=gref diff --git a/tests/Xamarin.Forms-Performance-Integration/Environment.txt b/tests/Xamarin.Forms-Performance-Integration/Environment.txt index 37c063decc9..566f3839478 100644 --- a/tests/Xamarin.Forms-Performance-Integration/Environment.txt +++ b/tests/Xamarin.Forms-Performance-Integration/Environment.txt @@ -1 +1 @@ -debug.mono.log gref +debug.mono.log=gref From c4d805f8e7f140838d286aeec0929edfc44dfe53 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Wed, 30 Oct 2019 13:57:38 -0400 Subject: [PATCH 29/66] Move grefs to right project --- .../{ => Droid}/Environment.txt | 0 .../Droid/Xamarin.Forms.Performance.Integration.Droid.csproj | 3 +++ .../Xamarin.Forms.Performance.Integration.csproj | 3 --- 3 files changed, 3 insertions(+), 3 deletions(-) rename tests/Xamarin.Forms-Performance-Integration/{ => Droid}/Environment.txt (100%) diff --git a/tests/Xamarin.Forms-Performance-Integration/Environment.txt b/tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt similarity index 100% rename from tests/Xamarin.Forms-Performance-Integration/Environment.txt rename to tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt diff --git a/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj b/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj index fbc0cc88240..e2e58731f4c 100644 --- a/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj +++ b/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj @@ -262,6 +262,9 @@ + + + diff --git a/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj b/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj index 53184adc252..c78bcb59194 100644 --- a/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj +++ b/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj @@ -12,7 +12,4 @@ - - - From eb6b8dbb0e4a570f9fabc735c367ef8bfa0e7af8 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Thu, 31 Oct 2019 10:08:43 -0400 Subject: [PATCH 30/66] GREF GREF GREF --- build-tools/scripts/TestApks.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-tools/scripts/TestApks.targets b/build-tools/scripts/TestApks.targets index 7814150aa0e..eb8a002b78a 100644 --- a/build-tools/scripts/TestApks.targets +++ b/build-tools/scripts/TestApks.targets @@ -83,7 +83,7 @@ WriteOutputAsMessage="True" /> Date: Thu, 31 Oct 2019 13:10:32 -0400 Subject: [PATCH 31/66] Does it hurt if I do this? --- .../Droid/Xamarin.Forms.Performance.Integration.Droid.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj b/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj index e2e58731f4c..c70d7ef31c9 100644 --- a/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj +++ b/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj @@ -44,7 +44,6 @@ true false r8 - True From fa561c3bbbc7b4f6624d2d8f1a1681563089fd5b Mon Sep 17 00:00:00 2001 From: Jonathan Pryor Date: Thu, 31 Oct 2019 17:51:44 -0400 Subject: [PATCH 32/66] MOAR LOGGING Context: good! https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=3201349&view=logs&j=8556562a-ae5f-5bd1-7c4d-bf1af4b6f1e1&t=a4d74fbf-7b8e-51d6-b189-8c80ca04a74a Context: Bad! https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=3201349&view=logs&j=8556562a-ae5f-5bd1-7c4d-bf1af4b6f1e1&t=1ce93f75-3079-5716-18de-288761bcb886 LOGGING FOR THE LOGGING GODS! The story so far: now we have GREF logs (yay), and can thus see their creation & destruction. Conspicuously MISSING, however, is the handle in the exception message! System.NotSupportedException: Unable to activate instance of type Xamarin.Forms.Performance.Integration.Droid.MainActivity from native handle 0xff88ad3c (key_handle 0x2629e85). The GREF logs we have DO NOT MENTION 0xff88ad3c nor 0x2629e85. Compare to the working (JIT-only) iteration, which has a `handle` statement: handle 0x2786; key_handle 0x2629e85: Java Type: `xamarin/forms/performance/integration/MainActivity`; MCW type: `Xamarin.Forms.Performance.Integration.Droid.MainActivity` This leaves one current scary hypothesis (good for Halloween!): what if the instance isn't being *activated*? When a Java Callable Wrapper constructor is executed, the Java side invokes `mono.android.TypeManager.Activate()`, which is `Java.Interop.TypeManager.n_Activate()`, which will NOT activate an instance for a variety of reasons. Is `TypeManager.n_Activate()` being executed? If it *is* executed, does it *do* anything? LOG THE HELL OUT OF IT. Ditto `TypeManager.CreateInstance()`. Additionally, update `OSBridge::_monodroid_gref_log()` so that the message is written to *both* `grefs.txt` AND `adb logcat`, to make it easier to reason about things when only one or the other is around. (This should allow the `handle` statement to appear in `adb logcat`.) --- src/Mono.Android/Java.Interop/TypeManager.cs | 11 +++++++++++ src/monodroid/jni/osbridge.cc | 1 + 2 files changed, 12 insertions(+) diff --git a/src/Mono.Android/Java.Interop/TypeManager.cs b/src/Mono.Android/Java.Interop/TypeManager.cs index 98efa0c5a09..7bb2ee7e00b 100644 --- a/src/Mono.Android/Java.Interop/TypeManager.cs +++ b/src/Mono.Android/Java.Interop/TypeManager.cs @@ -133,6 +133,9 @@ static Type[] GetParameterTypes (string signature) static void n_Activate (IntPtr jnienv, IntPtr jclass, IntPtr typename_ptr, IntPtr signature_ptr, IntPtr jobject, IntPtr parameters_ptr) { + JNIEnv._monodroid_gref_log ( + string.Format ("# jonp: n_Activate: Activating handle 0x{0} (key_handle 0x{1}).", + jobject.ToString ("x"), JNIEnv.IdentityHash (jobject).ToString ("x"))); var o = Java.Lang.Object.PeekObject (jobject); var ex = o as IJavaObjectEx; if (ex != null) { @@ -140,6 +143,7 @@ static void n_Activate (IntPtr jnienv, IntPtr jclass, IntPtr typename_ptr, IntPt return; } if (!ActivationEnabled) { + JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: Activation not enabled. Bailing!"); if (Logger.LogGlobalRef) { Logger.Log (LogLevel.Info, "monodroid-gref", string.Format ("warning: Skipping managed constructor invocation for handle 0x{0} (key_handle 0x{1}). " + @@ -151,22 +155,26 @@ static void n_Activate (IntPtr jnienv, IntPtr jclass, IntPtr typename_ptr, IntPt } Type type = Type.GetType (JNIEnv.GetString (typename_ptr, JniHandleOwnership.DoNotTransfer), throwOnError:true); + JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: type={type}"); if (type.IsGenericTypeDefinition) { throw new NotSupportedException ( "Constructing instances of generic types from Java is not supported, as the type parameters cannot be determined.", CreateJavaLocationException ()); } Type[] ptypes = GetParameterTypes (JNIEnv.GetString (signature_ptr, JniHandleOwnership.DoNotTransfer)); + JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: constructor parameter types: {string.Join (", ", (object[]) ptypes)}"); object[] parms = JNIEnv.GetObjectArray (parameters_ptr, ptypes); ConstructorInfo cinfo = type.GetConstructor (ptypes); if (cinfo == null) { throw CreateMissingConstructorException (type, ptypes); } if (o != null) { + JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: invoking ctor on already created instance"); cinfo.Invoke (o, parms); return; } try { + JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: creating new instance"); var activator = ConstructorBuilder.CreateDelegate (type, cinfo, ptypes); activator (jobject, parms); } catch (Exception e) { @@ -243,6 +251,7 @@ internal static IJavaObject CreateInstance (IntPtr handle, JniHandleOwnership tr internal static IJavaObject CreateInstance (IntPtr handle, JniHandleOwnership transfer, Type targetType) { + JNIEnv._monodroid_gref_log ($"# jonp: CreateInstance: handle=0x{handle.ToString ("x2")}, key_handle=0x{JNIEnv.IdentityHash (handle)}"); Type type = null; IntPtr class_ptr = JNIEnv.GetObjectClass (handle); string class_name = GetClassName (class_ptr); @@ -283,6 +292,8 @@ internal static IJavaObject CreateInstance (IntPtr handle, JniHandleOwnership tr type = invokerType; } + JNIEnv._monodroid_gref_log ($"# jonp: CreateInstance: type={type}"); + IJavaObject result = null; diff --git a/src/monodroid/jni/osbridge.cc b/src/monodroid/jni/osbridge.cc index b3b72c45d92..173b692725b 100644 --- a/src/monodroid/jni/osbridge.cc +++ b/src/monodroid/jni/osbridge.cc @@ -222,6 +222,7 @@ OSBridge::_write_stack_trace (FILE *to, const char *from) void OSBridge::_monodroid_gref_log (const char *message) { + log_info (LOG_GREF, "%s", message); if (!gref_log) return; fprintf (gref_log, "%s", message); From 4a075cd63d9766eab06c260f3115ae2bfe91a659 Mon Sep 17 00:00:00 2001 From: Jonathan Pryor Date: Thu, 31 Oct 2019 21:30:35 -0400 Subject: [PATCH 33/66] Even more logging? MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Context: Good! https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=3202797&view=logs&j=8556562a-ae5f-5bd1-7c4d-bf1af4b6f1e1&t=a4d74fbf-7b8e-51d6-b189-8c80ca04a74a Context: Bad! https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=3202797&view=logs&j=8556562a-ae5f-5bd1-7c4d-bf1af4b6f1e1&t=1ce93f75-3079-5716-18de-288761bcb886 fa561c3b was moderately successful, in that it's helping narrow down where things are going. Current theory? AOT + System.Reflection.Emit == WTF? The story so far: in the Good log, we see a handle for a `MainActivity` enter managed code, we hit `n_Activate()`, and a GREF is created around that handle: monodroid-gref: # jonp: n_Activate: Activating handle 0xff9f35b8 (key_handle 0x33318d). monodroid-gref: # jonp: n_Activate: type=Xamarin.Forms.Performance.Integration.Droid.MainActivity monodroid-gref: # jonp: n_Activate: constructor parameter types: monodroid-gref: # jonp: n_Activate: creating new instance monodroid-gref: +g+ grefc 13 gwrefc 0 obj-handle 0xff9f35b8/I -> new-handle 0x2786/G from thread '(null)'(1) monodroid-gref: handle 0x2786; key_handle 0x33318d: Java Type: `xamarin/forms/performance/integration/MainActivity`; MCW type: `Xamarin.Forms.Performance.Integration.Droid.MainActivity` The Bad log is notably different: we hit `n_Activate()`, as expected: monodroid-gref: # jonp: n_Activate: Activating handle 0xff9f35b8 (key_handle 0x33318d). monodroid-gref: # jonp: n_Activate: type=Xamarin.Forms.Performance.Integration.Droid.MainActivity monodroid-gref: # jonp: n_Activate: constructor parameter types: monodroid-gref: # jonp: n_Activate: creating new instance but then we take a turn into `CreateInstance()` (?!): monodroid-gref: # jonp: CreateInstance: handle=0xff9f3c2c, key_handle=0x3355021 monodroid-gref: # jonp: CreateInstance: type=Xamarin.Forms.Performance.Integration.Droid.MainActivity Note that we have a DIFFERENT HANDLE here. Then we go all explodey: MonoDroid: System.NotSupportedException: Unable to activate instance of type Xamarin.Forms.Performance.Integration.Droid.MainActivity from native handle 0xff9f3c2c (key_handle 0x33318d). Why are we hitting `CreateInstance()`? ¯\_(ツ)_/¯ So, EVEN MORE LOGGING: * Update `ConstructorBuilder.CreateDelegate()` so that we `Console.WriteLine()` when the "activation constructor" is being executed. The activation constructor is generated via System.Reflection.Emit + DynamicMethod, and is responsible for setting `Java.lang.Object.handle` *before* the specified constructor is executed. * Update the `CreateInstance()` log to have `new StackTrace()`, so we can better understand HOW WE GOT HERE. Additionally, update calls to `JNIEnv._monodroid_gref_log()` so that a `\n` is consistently used, so that `grefs.txt` is readable. (Above snippets are from `adb logcat`.) Finally, BACKGROUND: The default `Java.Lang.Object` constructor is generated by `generator`, and is: [Register (".ctor", "()V", "")] protected unsafe Object () : this (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) { const string __id = "()V"; if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) return; try { var __r = _members.InstanceMethods.StartCreateInstance (__id, ((object) this).GetType (), null); SetHandle (__r.Handle, JniHandleOwnership.TransferLocalRef); _members.InstanceMethods.FinishCreateInstance (__id, this, null); } finally { } } Note the following: * `Java.Lang.Object.handle` is checked BEFORE doing anything else, and if it isn't IntPtr.Zero, it returns without doing anything. * `_members.InstanceMethods.StartCreateInstance()` is responsible for, eventually, constructing a *new* Java-side instance. This is *probably* where that new handle value in the `CreateInstance()` log is coming from. Note that `Object:.ctor()` is generated, so updating it to have MORE LOGGING is not trivial. However, it calls `Object:.ctor(IntPtr, JniHandleOwnership)`, so we've added logging there. Also note that the Object constructors would be AOT'd. My ***ENTIRELY UNSUBSTANTIATED GUESS*** is that when `Mono.Android.dll` is AOT'd, `Object:.ctor()` is "optimized" so that the read of the handle property is omitted. This would also explain why we only see this crash when AOT is used. --- .../Android.Runtime/ConstructorBuilder.cs | 4 ++++ src/Mono.Android/Java.Interop/TypeManager.cs | 18 ++++++++++-------- src/Mono.Android/Java.Lang/Object.cs | 2 ++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/Mono.Android/Android.Runtime/ConstructorBuilder.cs b/src/Mono.Android/Android.Runtime/ConstructorBuilder.cs index 7cbe4700c62..e6971e11d4b 100644 --- a/src/Mono.Android/Android.Runtime/ConstructorBuilder.cs +++ b/src/Mono.Android/Android.Runtime/ConstructorBuilder.cs @@ -38,8 +38,12 @@ internal class ConstructorBuilder { il.Emit (OpCodes.Ldc_I4, i); il.Emit (OpCodes.Ldelem_Ref); } + il.EmitWriteLine("# jonp: Inside activation constructor for type `{type}`: before invoke!!"); + il.Emit (OpCodes.Call, cinfo); + il.EmitWriteLine("# jonp: Inside activation constructor for type `{type}`: after invoke!!"); + il.Emit (OpCodes.Ret); return (Action) method.CreateDelegate (typeof (Action )); diff --git a/src/Mono.Android/Java.Interop/TypeManager.cs b/src/Mono.Android/Java.Interop/TypeManager.cs index 7bb2ee7e00b..eac39589f9c 100644 --- a/src/Mono.Android/Java.Interop/TypeManager.cs +++ b/src/Mono.Android/Java.Interop/TypeManager.cs @@ -134,7 +134,7 @@ static Type[] GetParameterTypes (string signature) static void n_Activate (IntPtr jnienv, IntPtr jclass, IntPtr typename_ptr, IntPtr signature_ptr, IntPtr jobject, IntPtr parameters_ptr) { JNIEnv._monodroid_gref_log ( - string.Format ("# jonp: n_Activate: Activating handle 0x{0} (key_handle 0x{1}).", + string.Format ("# jonp: n_Activate: Activating handle 0x{0} (key_handle 0x{1}).\n", jobject.ToString ("x"), JNIEnv.IdentityHash (jobject).ToString ("x"))); var o = Java.Lang.Object.PeekObject (jobject); var ex = o as IJavaObjectEx; @@ -143,7 +143,7 @@ static void n_Activate (IntPtr jnienv, IntPtr jclass, IntPtr typename_ptr, IntPt return; } if (!ActivationEnabled) { - JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: Activation not enabled. Bailing!"); + JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: Activation not enabled. Bailing!\n"); if (Logger.LogGlobalRef) { Logger.Log (LogLevel.Info, "monodroid-gref", string.Format ("warning: Skipping managed constructor invocation for handle 0x{0} (key_handle 0x{1}). " + @@ -155,27 +155,28 @@ static void n_Activate (IntPtr jnienv, IntPtr jclass, IntPtr typename_ptr, IntPt } Type type = Type.GetType (JNIEnv.GetString (typename_ptr, JniHandleOwnership.DoNotTransfer), throwOnError:true); - JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: type={type}"); + JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: type={type}\n"); if (type.IsGenericTypeDefinition) { throw new NotSupportedException ( "Constructing instances of generic types from Java is not supported, as the type parameters cannot be determined.", CreateJavaLocationException ()); } Type[] ptypes = GetParameterTypes (JNIEnv.GetString (signature_ptr, JniHandleOwnership.DoNotTransfer)); - JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: constructor parameter types: {string.Join (", ", (object[]) ptypes)}"); + JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: constructor parameter types: {string.Join (", ", (object[]) ptypes)}\n"); object[] parms = JNIEnv.GetObjectArray (parameters_ptr, ptypes); ConstructorInfo cinfo = type.GetConstructor (ptypes); if (cinfo == null) { throw CreateMissingConstructorException (type, ptypes); } if (o != null) { - JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: invoking ctor on already created instance"); + JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: invoking ctor on already created instance\n"); cinfo.Invoke (o, parms); return; } try { - JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: creating new instance"); + JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: creating new instance\n"); var activator = ConstructorBuilder.CreateDelegate (type, cinfo, ptypes); + JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: activator={activator.Method.DeclaringType} :: {activator.Method}\n"); activator (jobject, parms); } catch (Exception e) { var m = string.Format ("Could not activate JNI Handle 0x{0} (key_handle 0x{1}) of Java type '{2}' as managed type '{3}'.", @@ -251,7 +252,8 @@ internal static IJavaObject CreateInstance (IntPtr handle, JniHandleOwnership tr internal static IJavaObject CreateInstance (IntPtr handle, JniHandleOwnership transfer, Type targetType) { - JNIEnv._monodroid_gref_log ($"# jonp: CreateInstance: handle=0x{handle.ToString ("x2")}, key_handle=0x{JNIEnv.IdentityHash (handle)}"); + JNIEnv._monodroid_gref_log ($"# jonp: CreateInstance: handle=0x{handle.ToString ("x2")}, key_handle=0x{JNIEnv.IdentityHash (handle)}\n"); + JNIEnv._monodroid_gref_log ($"{new System.Diagnostics.StackTrace (true)}\n"); Type type = null; IntPtr class_ptr = JNIEnv.GetObjectClass (handle); string class_name = GetClassName (class_ptr); @@ -292,7 +294,7 @@ internal static IJavaObject CreateInstance (IntPtr handle, JniHandleOwnership tr type = invokerType; } - JNIEnv._monodroid_gref_log ($"# jonp: CreateInstance: type={type}"); + JNIEnv._monodroid_gref_log ($"# jonp: CreateInstance: type={type}\n"); IJavaObject result = null; diff --git a/src/Mono.Android/Java.Lang/Object.cs b/src/Mono.Android/Java.Lang/Object.cs index 496a235b1ce..4f8748271b3 100644 --- a/src/Mono.Android/Java.Lang/Object.cs +++ b/src/Mono.Android/Java.Lang/Object.cs @@ -72,7 +72,9 @@ IntPtr IJavaObjectEx.ToLocalJniHandle () public Object (IntPtr handle, JniHandleOwnership transfer) { // Check if handle was preset by our java activation mechanism + JNIEnv._monodroid_gref_log ($"# jonp: Object:.ctor: this.handle=0x{this.handle.ToString("x2")}; handle=0x{handle.ToString("x2")}; transfer={transfer}\n"); if (this.handle != IntPtr.Zero) { + JNIEnv._monodroid_gref_log ($"# jonp: Object:.ctor: ACTIVATION SCENARIO\n"); needsActivation = true; handle = this.handle; if (handle_type != 0) From 36def2be78abca09d2bbaa5cbe64fdcca7605c86 Mon Sep 17 00:00:00 2001 From: Joseph Shields Date: Sat, 2 Nov 2019 17:50:08 -0400 Subject: [PATCH 34/66] bump for fix --- .external | 2 +- Configuration.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.external b/.external index 8db944991a8..b6544772077 100644 --- a/.external +++ b/.external @@ -1,2 +1,2 @@ xamarin/monodroid:master@7f40abfa6f55a801619973af0cb875bf5a58c0c9 -mono/mono:2019-10@010050adc8f463519db2c22cfea947cef530de97 +mono/mono:2019-10@e1f916ed1e988531a70b61d61a9aff1b23036802 diff --git a/Configuration.props b/Configuration.props index f8943ac5d50..0483c555332 100644 --- a/Configuration.props +++ b/Configuration.props @@ -83,7 +83,7 @@ 6.8.0 6.9.0 True - $(MonoRequiredMinimumVersion).37 + $(MonoRequiredMinimumVersion).41 $(MSBuildThisFileDirectory)external\mono\sdks\out\android-sources\external\linker\src $(MSBuildThisFileDirectory)external\opentk \usr From ea1b429bcb4c469be0a056886ce681e1befe2a9b Mon Sep 17 00:00:00 2001 From: Joseph Shields Date: Sat, 2 Nov 2019 17:56:49 -0400 Subject: [PATCH 35/66] Disable obsolete changes --- build-tools/automation/build.linux.groovy | 1 - build-tools/scripts/TestApks.targets | 3 +-- .../Android.Runtime/ConstructorBuilder.cs | 4 ---- src/Mono.Android/Java.Interop/TypeManager.cs | 13 ------------- src/Mono.Android/Java.Lang/Object.cs | 2 -- .../Test/Properties/AndroidManifest.xml | 2 +- .../Tests/Xamarin.ProjectTools/Environment.txt | 1 - .../Xamarin.ProjectTools.csproj | 3 --- src/monodroid/jni/osbridge.cc | 1 - .../Droid/Environment.txt | 1 - .../Droid/Properties/AndroidManifest.xml | 4 ++-- ...marin.Forms.Performance.Integration.Droid.csproj | 4 +--- .../Xamarin.Forms.Performance.Integration.csproj | 2 +- 13 files changed, 6 insertions(+), 35 deletions(-) delete mode 100644 src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Environment.txt delete mode 100644 tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt diff --git a/build-tools/automation/build.linux.groovy b/build-tools/automation/build.linux.groovy index 41798d79bff..1501261fcb4 100644 --- a/build-tools/automation/build.linux.groovy +++ b/build-tools/automation/build.linux.groovy @@ -27,7 +27,6 @@ def chRootPackages = ''' lib32z1 libc++-dev libgdk-pixbuf2.0-dev - libmono-btls-interface4.0-cil libncurses5-dev libsqlite3-dev libtinfo-dev:i386 diff --git a/build-tools/scripts/TestApks.targets b/build-tools/scripts/TestApks.targets index eb8a002b78a..34bb4f66614 100644 --- a/build-tools/scripts/TestApks.targets +++ b/build-tools/scripts/TestApks.targets @@ -83,7 +83,7 @@ WriteOutputAsMessage="True" /> - ) method.CreateDelegate (typeof (Action )); diff --git a/src/Mono.Android/Java.Interop/TypeManager.cs b/src/Mono.Android/Java.Interop/TypeManager.cs index eac39589f9c..98efa0c5a09 100644 --- a/src/Mono.Android/Java.Interop/TypeManager.cs +++ b/src/Mono.Android/Java.Interop/TypeManager.cs @@ -133,9 +133,6 @@ static Type[] GetParameterTypes (string signature) static void n_Activate (IntPtr jnienv, IntPtr jclass, IntPtr typename_ptr, IntPtr signature_ptr, IntPtr jobject, IntPtr parameters_ptr) { - JNIEnv._monodroid_gref_log ( - string.Format ("# jonp: n_Activate: Activating handle 0x{0} (key_handle 0x{1}).\n", - jobject.ToString ("x"), JNIEnv.IdentityHash (jobject).ToString ("x"))); var o = Java.Lang.Object.PeekObject (jobject); var ex = o as IJavaObjectEx; if (ex != null) { @@ -143,7 +140,6 @@ static void n_Activate (IntPtr jnienv, IntPtr jclass, IntPtr typename_ptr, IntPt return; } if (!ActivationEnabled) { - JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: Activation not enabled. Bailing!\n"); if (Logger.LogGlobalRef) { Logger.Log (LogLevel.Info, "monodroid-gref", string.Format ("warning: Skipping managed constructor invocation for handle 0x{0} (key_handle 0x{1}). " + @@ -155,28 +151,23 @@ static void n_Activate (IntPtr jnienv, IntPtr jclass, IntPtr typename_ptr, IntPt } Type type = Type.GetType (JNIEnv.GetString (typename_ptr, JniHandleOwnership.DoNotTransfer), throwOnError:true); - JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: type={type}\n"); if (type.IsGenericTypeDefinition) { throw new NotSupportedException ( "Constructing instances of generic types from Java is not supported, as the type parameters cannot be determined.", CreateJavaLocationException ()); } Type[] ptypes = GetParameterTypes (JNIEnv.GetString (signature_ptr, JniHandleOwnership.DoNotTransfer)); - JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: constructor parameter types: {string.Join (", ", (object[]) ptypes)}\n"); object[] parms = JNIEnv.GetObjectArray (parameters_ptr, ptypes); ConstructorInfo cinfo = type.GetConstructor (ptypes); if (cinfo == null) { throw CreateMissingConstructorException (type, ptypes); } if (o != null) { - JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: invoking ctor on already created instance\n"); cinfo.Invoke (o, parms); return; } try { - JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: creating new instance\n"); var activator = ConstructorBuilder.CreateDelegate (type, cinfo, ptypes); - JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: activator={activator.Method.DeclaringType} :: {activator.Method}\n"); activator (jobject, parms); } catch (Exception e) { var m = string.Format ("Could not activate JNI Handle 0x{0} (key_handle 0x{1}) of Java type '{2}' as managed type '{3}'.", @@ -252,8 +243,6 @@ internal static IJavaObject CreateInstance (IntPtr handle, JniHandleOwnership tr internal static IJavaObject CreateInstance (IntPtr handle, JniHandleOwnership transfer, Type targetType) { - JNIEnv._monodroid_gref_log ($"# jonp: CreateInstance: handle=0x{handle.ToString ("x2")}, key_handle=0x{JNIEnv.IdentityHash (handle)}\n"); - JNIEnv._monodroid_gref_log ($"{new System.Diagnostics.StackTrace (true)}\n"); Type type = null; IntPtr class_ptr = JNIEnv.GetObjectClass (handle); string class_name = GetClassName (class_ptr); @@ -294,8 +283,6 @@ internal static IJavaObject CreateInstance (IntPtr handle, JniHandleOwnership tr type = invokerType; } - JNIEnv._monodroid_gref_log ($"# jonp: CreateInstance: type={type}\n"); - IJavaObject result = null; diff --git a/src/Mono.Android/Java.Lang/Object.cs b/src/Mono.Android/Java.Lang/Object.cs index 4f8748271b3..496a235b1ce 100644 --- a/src/Mono.Android/Java.Lang/Object.cs +++ b/src/Mono.Android/Java.Lang/Object.cs @@ -72,9 +72,7 @@ IntPtr IJavaObjectEx.ToLocalJniHandle () public Object (IntPtr handle, JniHandleOwnership transfer) { // Check if handle was preset by our java activation mechanism - JNIEnv._monodroid_gref_log ($"# jonp: Object:.ctor: this.handle=0x{this.handle.ToString("x2")}; handle=0x{handle.ToString("x2")}; transfer={transfer}\n"); if (this.handle != IntPtr.Zero) { - JNIEnv._monodroid_gref_log ($"# jonp: Object:.ctor: ACTIVATION SCENARIO\n"); needsActivation = true; handle = this.handle; if (handle_type != 0) diff --git a/src/Mono.Android/Test/Properties/AndroidManifest.xml b/src/Mono.Android/Test/Properties/AndroidManifest.xml index 86648bca6c4..d15674daf9a 100644 --- a/src/Mono.Android/Test/Properties/AndroidManifest.xml +++ b/src/Mono.Android/Test/Properties/AndroidManifest.xml @@ -1,7 +1,7 @@  - + diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Environment.txt b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Environment.txt deleted file mode 100644 index 566f3839478..00000000000 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Environment.txt +++ /dev/null @@ -1 +0,0 @@ -debug.mono.log=gref diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj index 1a08c7daf36..9103b7ef49f 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj @@ -91,9 +91,6 @@ - - - Xamarin.ProjectTools.Resources.Wear.LayoutMain.axml diff --git a/src/monodroid/jni/osbridge.cc b/src/monodroid/jni/osbridge.cc index 173b692725b..b3b72c45d92 100644 --- a/src/monodroid/jni/osbridge.cc +++ b/src/monodroid/jni/osbridge.cc @@ -222,7 +222,6 @@ OSBridge::_write_stack_trace (FILE *to, const char *from) void OSBridge::_monodroid_gref_log (const char *message) { - log_info (LOG_GREF, "%s", message); if (!gref_log) return; fprintf (gref_log, "%s", message); diff --git a/tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt b/tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt deleted file mode 100644 index 566f3839478..00000000000 --- a/tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt +++ /dev/null @@ -1 +0,0 @@ -debug.mono.log=gref diff --git a/tests/Xamarin.Forms-Performance-Integration/Droid/Properties/AndroidManifest.xml b/tests/Xamarin.Forms-Performance-Integration/Droid/Properties/AndroidManifest.xml index 54d8ff31215..c9182a70c56 100644 --- a/tests/Xamarin.Forms-Performance-Integration/Droid/Properties/AndroidManifest.xml +++ b/tests/Xamarin.Forms-Performance-Integration/Droid/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@  - - + + \ No newline at end of file diff --git a/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj b/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj index c70d7ef31c9..fbc0cc88240 100644 --- a/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj +++ b/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj @@ -44,6 +44,7 @@ true false r8 + True @@ -261,9 +262,6 @@ - - - diff --git a/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj b/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj index c78bcb59194..e2e6ca7a2ee 100644 --- a/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj +++ b/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj @@ -12,4 +12,4 @@ - + \ No newline at end of file From f491948d48ef333d89991b839fb08770f090bfc0 Mon Sep 17 00:00:00 2001 From: Joseph Shields Date: Sat, 2 Nov 2019 20:01:47 -0400 Subject: [PATCH 36/66] Revert "Disable obsolete changes" This reverts commit ea1b429bcb4c469be0a056886ce681e1befe2a9b. --- build-tools/automation/build.linux.groovy | 1 + build-tools/scripts/TestApks.targets | 3 ++- .../Android.Runtime/ConstructorBuilder.cs | 4 ++++ src/Mono.Android/Java.Interop/TypeManager.cs | 13 +++++++++++++ src/Mono.Android/Java.Lang/Object.cs | 2 ++ .../Test/Properties/AndroidManifest.xml | 2 +- .../Tests/Xamarin.ProjectTools/Environment.txt | 1 + .../Xamarin.ProjectTools.csproj | 3 +++ src/monodroid/jni/osbridge.cc | 1 + .../Droid/Environment.txt | 1 + .../Droid/Properties/AndroidManifest.xml | 4 ++-- ...marin.Forms.Performance.Integration.Droid.csproj | 4 +++- .../Xamarin.Forms.Performance.Integration.csproj | 2 +- 13 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Environment.txt create mode 100644 tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt diff --git a/build-tools/automation/build.linux.groovy b/build-tools/automation/build.linux.groovy index 1501261fcb4..41798d79bff 100644 --- a/build-tools/automation/build.linux.groovy +++ b/build-tools/automation/build.linux.groovy @@ -27,6 +27,7 @@ def chRootPackages = ''' lib32z1 libc++-dev libgdk-pixbuf2.0-dev + libmono-btls-interface4.0-cil libncurses5-dev libsqlite3-dev libtinfo-dev:i386 diff --git a/build-tools/scripts/TestApks.targets b/build-tools/scripts/TestApks.targets index 34bb4f66614..eb8a002b78a 100644 --- a/build-tools/scripts/TestApks.targets +++ b/build-tools/scripts/TestApks.targets @@ -83,7 +83,7 @@ WriteOutputAsMessage="True" /> + ) method.CreateDelegate (typeof (Action )); diff --git a/src/Mono.Android/Java.Interop/TypeManager.cs b/src/Mono.Android/Java.Interop/TypeManager.cs index 98efa0c5a09..eac39589f9c 100644 --- a/src/Mono.Android/Java.Interop/TypeManager.cs +++ b/src/Mono.Android/Java.Interop/TypeManager.cs @@ -133,6 +133,9 @@ static Type[] GetParameterTypes (string signature) static void n_Activate (IntPtr jnienv, IntPtr jclass, IntPtr typename_ptr, IntPtr signature_ptr, IntPtr jobject, IntPtr parameters_ptr) { + JNIEnv._monodroid_gref_log ( + string.Format ("# jonp: n_Activate: Activating handle 0x{0} (key_handle 0x{1}).\n", + jobject.ToString ("x"), JNIEnv.IdentityHash (jobject).ToString ("x"))); var o = Java.Lang.Object.PeekObject (jobject); var ex = o as IJavaObjectEx; if (ex != null) { @@ -140,6 +143,7 @@ static void n_Activate (IntPtr jnienv, IntPtr jclass, IntPtr typename_ptr, IntPt return; } if (!ActivationEnabled) { + JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: Activation not enabled. Bailing!\n"); if (Logger.LogGlobalRef) { Logger.Log (LogLevel.Info, "monodroid-gref", string.Format ("warning: Skipping managed constructor invocation for handle 0x{0} (key_handle 0x{1}). " + @@ -151,23 +155,28 @@ static void n_Activate (IntPtr jnienv, IntPtr jclass, IntPtr typename_ptr, IntPt } Type type = Type.GetType (JNIEnv.GetString (typename_ptr, JniHandleOwnership.DoNotTransfer), throwOnError:true); + JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: type={type}\n"); if (type.IsGenericTypeDefinition) { throw new NotSupportedException ( "Constructing instances of generic types from Java is not supported, as the type parameters cannot be determined.", CreateJavaLocationException ()); } Type[] ptypes = GetParameterTypes (JNIEnv.GetString (signature_ptr, JniHandleOwnership.DoNotTransfer)); + JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: constructor parameter types: {string.Join (", ", (object[]) ptypes)}\n"); object[] parms = JNIEnv.GetObjectArray (parameters_ptr, ptypes); ConstructorInfo cinfo = type.GetConstructor (ptypes); if (cinfo == null) { throw CreateMissingConstructorException (type, ptypes); } if (o != null) { + JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: invoking ctor on already created instance\n"); cinfo.Invoke (o, parms); return; } try { + JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: creating new instance\n"); var activator = ConstructorBuilder.CreateDelegate (type, cinfo, ptypes); + JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: activator={activator.Method.DeclaringType} :: {activator.Method}\n"); activator (jobject, parms); } catch (Exception e) { var m = string.Format ("Could not activate JNI Handle 0x{0} (key_handle 0x{1}) of Java type '{2}' as managed type '{3}'.", @@ -243,6 +252,8 @@ internal static IJavaObject CreateInstance (IntPtr handle, JniHandleOwnership tr internal static IJavaObject CreateInstance (IntPtr handle, JniHandleOwnership transfer, Type targetType) { + JNIEnv._monodroid_gref_log ($"# jonp: CreateInstance: handle=0x{handle.ToString ("x2")}, key_handle=0x{JNIEnv.IdentityHash (handle)}\n"); + JNIEnv._monodroid_gref_log ($"{new System.Diagnostics.StackTrace (true)}\n"); Type type = null; IntPtr class_ptr = JNIEnv.GetObjectClass (handle); string class_name = GetClassName (class_ptr); @@ -283,6 +294,8 @@ internal static IJavaObject CreateInstance (IntPtr handle, JniHandleOwnership tr type = invokerType; } + JNIEnv._monodroid_gref_log ($"# jonp: CreateInstance: type={type}\n"); + IJavaObject result = null; diff --git a/src/Mono.Android/Java.Lang/Object.cs b/src/Mono.Android/Java.Lang/Object.cs index 496a235b1ce..4f8748271b3 100644 --- a/src/Mono.Android/Java.Lang/Object.cs +++ b/src/Mono.Android/Java.Lang/Object.cs @@ -72,7 +72,9 @@ IntPtr IJavaObjectEx.ToLocalJniHandle () public Object (IntPtr handle, JniHandleOwnership transfer) { // Check if handle was preset by our java activation mechanism + JNIEnv._monodroid_gref_log ($"# jonp: Object:.ctor: this.handle=0x{this.handle.ToString("x2")}; handle=0x{handle.ToString("x2")}; transfer={transfer}\n"); if (this.handle != IntPtr.Zero) { + JNIEnv._monodroid_gref_log ($"# jonp: Object:.ctor: ACTIVATION SCENARIO\n"); needsActivation = true; handle = this.handle; if (handle_type != 0) diff --git a/src/Mono.Android/Test/Properties/AndroidManifest.xml b/src/Mono.Android/Test/Properties/AndroidManifest.xml index d15674daf9a..86648bca6c4 100644 --- a/src/Mono.Android/Test/Properties/AndroidManifest.xml +++ b/src/Mono.Android/Test/Properties/AndroidManifest.xml @@ -1,7 +1,7 @@  - + diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Environment.txt b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Environment.txt new file mode 100644 index 00000000000..566f3839478 --- /dev/null +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Environment.txt @@ -0,0 +1 @@ +debug.mono.log=gref diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj index 9103b7ef49f..1a08c7daf36 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj @@ -91,6 +91,9 @@ + + + Xamarin.ProjectTools.Resources.Wear.LayoutMain.axml diff --git a/src/monodroid/jni/osbridge.cc b/src/monodroid/jni/osbridge.cc index b3b72c45d92..173b692725b 100644 --- a/src/monodroid/jni/osbridge.cc +++ b/src/monodroid/jni/osbridge.cc @@ -222,6 +222,7 @@ OSBridge::_write_stack_trace (FILE *to, const char *from) void OSBridge::_monodroid_gref_log (const char *message) { + log_info (LOG_GREF, "%s", message); if (!gref_log) return; fprintf (gref_log, "%s", message); diff --git a/tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt b/tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt new file mode 100644 index 00000000000..566f3839478 --- /dev/null +++ b/tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt @@ -0,0 +1 @@ +debug.mono.log=gref diff --git a/tests/Xamarin.Forms-Performance-Integration/Droid/Properties/AndroidManifest.xml b/tests/Xamarin.Forms-Performance-Integration/Droid/Properties/AndroidManifest.xml index c9182a70c56..54d8ff31215 100644 --- a/tests/Xamarin.Forms-Performance-Integration/Droid/Properties/AndroidManifest.xml +++ b/tests/Xamarin.Forms-Performance-Integration/Droid/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@  - - \ No newline at end of file + + diff --git a/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj b/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj index fbc0cc88240..c70d7ef31c9 100644 --- a/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj +++ b/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj @@ -44,7 +44,6 @@ true false r8 - True @@ -262,6 +261,9 @@ + + + diff --git a/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj b/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj index e2e6ca7a2ee..c78bcb59194 100644 --- a/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj +++ b/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj @@ -12,4 +12,4 @@ - \ No newline at end of file + From 41444749939053f5791f13b3fee9ab5e1f590124 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Mon, 4 Nov 2019 10:37:38 -0500 Subject: [PATCH 37/66] Force Mono 6.8.0.41, with AOT fix --- .../xaprepare/xaprepare/ConfigAndData/Configurables.MacOS.cs | 2 +- .../xaprepare/xaprepare/ConfigAndData/Dependencies/MacOS.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.MacOS.cs b/build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.MacOS.cs index 4930eb13df0..a9af2122c76 100644 --- a/build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.MacOS.cs +++ b/build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.MacOS.cs @@ -7,7 +7,7 @@ partial class Configurables partial class Urls { public static readonly Uri Corretto = new Uri ($"{Corretto_BaseUri}{CorrettoUrlPathVersion}/amazon-corretto-{CorrettoDistVersion}-macosx-x64.tar.gz"); - public static readonly Uri MonoPackage = new Uri ("https://download.mono-project.com/archive/6.4.0/macos-10-universal/MonoFramework-MDK-6.4.0.198.macos10.xamarin.universal.pkg"); + public static readonly Uri MonoPackage = new Uri ("https://xamjenkinsartifact.azureedge.net/build-package-osx-mono/2019-10/45/e1f916ed1e988531a70b61d61a9aff1b23036802/MonoFramework-MDK-6.8.0.41.macos10.xamarin.universal.pkg"); } partial class Defaults diff --git a/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/MacOS.cs b/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/MacOS.cs index fa220ad5e2e..ec14dd4f0bd 100644 --- a/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/MacOS.cs +++ b/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/MacOS.cs @@ -33,7 +33,7 @@ partial class MacOS // If you change the minimum Mono version here, please change the URL as well new MonoPkgProgram ("Mono", "com.xamarin.mono-MDK.pkg", Configurables.Urls.MonoPackage) { - MinimumVersion = "6.0.0.313", + MinimumVersion = "6.8.0.41", MaximumVersion = "6.99.0.0", }, }; From aa16b5800345bf8b41f13145634ab2741ab636f7 Mon Sep 17 00:00:00 2001 From: Jonathan Pryor Date: Tue, 5 Nov 2019 16:14:30 -0500 Subject: [PATCH 38/66] [Mono.Android] Print out the `Object.handle` field. Context https://xamarinhq.slack.com/archives/C5P3G23NG/p1572987971143400 Context: https://gist.github.com/vargaz/cfed2304cc8c6d7286a247e0b6a7c26c Thanks to @vargaz for the code. --- .../Android.Runtime/ConstructorBuilder.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Mono.Android/Android.Runtime/ConstructorBuilder.cs b/src/Mono.Android/Android.Runtime/ConstructorBuilder.cs index e6971e11d4b..e42a40d4e4a 100644 --- a/src/Mono.Android/Android.Runtime/ConstructorBuilder.cs +++ b/src/Mono.Android/Android.Runtime/ConstructorBuilder.cs @@ -38,11 +38,19 @@ internal class ConstructorBuilder { il.Emit (OpCodes.Ldc_I4, i); il.Emit (OpCodes.Ldelem_Ref); } - il.EmitWriteLine("# jonp: Inside activation constructor for type `{type}`: before invoke!!"); + il.EmitWriteLine($"# jonp: Inside activation constructor for type `{type}`: before invoke!!"); + + Console.WriteLine ("CTOR: " + typeof (Console).GetMethod ("WriteLine", new Type [] { typeof (object) })); + il.Emit (OpCodes.Ldloc_0); + il.Emit (OpCodes.Ldfld, handle); + il.Emit (OpCodes.Box, typeof (IntPtr)); + il.Emit (OpCodes.Call, typeof (Console).GetMethod ("WriteLine", new Type [] { typeof (object) })); + il.Emit (OpCodes.Ldloc_0); + il.Emit (OpCodes.Call, typeof (Console).GetMethod ("WriteLine", new Type [] { typeof (object) })); il.Emit (OpCodes.Call, cinfo); - il.EmitWriteLine("# jonp: Inside activation constructor for type `{type}`: after invoke!!"); + il.EmitWriteLine($"# jonp: Inside activation constructor for type `{type}`: after invoke!!"); il.Emit (OpCodes.Ret); From 5fe900a8597a1de40d18d2088b83b0819d1f54cc Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Wed, 6 Nov 2019 03:56:55 -0500 Subject: [PATCH 39/66] Add more testing code. --- .../Android.Runtime/ConstructorBuilder.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Mono.Android/Android.Runtime/ConstructorBuilder.cs b/src/Mono.Android/Android.Runtime/ConstructorBuilder.cs index e42a40d4e4a..a2da089a10b 100644 --- a/src/Mono.Android/Android.Runtime/ConstructorBuilder.cs +++ b/src/Mono.Android/Android.Runtime/ConstructorBuilder.cs @@ -32,15 +32,8 @@ internal class ConstructorBuilder { il.Emit (OpCodes.Ldarg_0); il.Emit (OpCodes.Stfld, handle); - il.Emit (OpCodes.Ldloc_0); - for (int i = 0; i < parameter_types.Length; i++) { - il.Emit (OpCodes.Ldarg, 1); - il.Emit (OpCodes.Ldc_I4, i); - il.Emit (OpCodes.Ldelem_Ref); - } - il.EmitWriteLine($"# jonp: Inside activation constructor for type `{type}`: before invoke!!"); - Console.WriteLine ("CTOR: " + typeof (Console).GetMethod ("WriteLine", new Type [] { typeof (object) })); + Console.WriteLine ("CTOR2: " + cinfo); il.Emit (OpCodes.Ldloc_0); il.Emit (OpCodes.Ldfld, handle); il.Emit (OpCodes.Box, typeof (IntPtr)); @@ -48,6 +41,15 @@ internal class ConstructorBuilder { il.Emit (OpCodes.Ldloc_0); il.Emit (OpCodes.Call, typeof (Console).GetMethod ("WriteLine", new Type [] { typeof (object) })); + il.EmitWriteLine($"# jonp: Inside activation constructor for type `{type}`: before invoke!!"); + + il.Emit (OpCodes.Ldloc_0); + for (int i = 0; i < parameter_types.Length; i++) { + il.Emit (OpCodes.Ldarg, 1); + il.Emit (OpCodes.Ldc_I4, i); + il.Emit (OpCodes.Ldelem_Ref); + } + il.Emit (OpCodes.Call, cinfo); il.EmitWriteLine($"# jonp: Inside activation constructor for type `{type}`: after invoke!!"); From f09e81cd857578dc7894f2dd1b914a3fa44e622f Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Wed, 6 Nov 2019 10:19:13 -0500 Subject: [PATCH 40/66] Add more testing code. --- src/Mono.Android/Android.Runtime/ConstructorBuilder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mono.Android/Android.Runtime/ConstructorBuilder.cs b/src/Mono.Android/Android.Runtime/ConstructorBuilder.cs index a2da089a10b..7518176f687 100644 --- a/src/Mono.Android/Android.Runtime/ConstructorBuilder.cs +++ b/src/Mono.Android/Android.Runtime/ConstructorBuilder.cs @@ -33,7 +33,7 @@ internal class ConstructorBuilder { il.Emit (OpCodes.Stfld, handle); Console.WriteLine ("CTOR: " + typeof (Console).GetMethod ("WriteLine", new Type [] { typeof (object) })); - Console.WriteLine ("CTOR2: " + cinfo); + Console.WriteLine ("CTOR2: " + cinfo.FullName + " " + parameter_Types.Length); il.Emit (OpCodes.Ldloc_0); il.Emit (OpCodes.Ldfld, handle); il.Emit (OpCodes.Box, typeof (IntPtr)); From 79252728aa6d1e9ce52e3e7a28b03be36bc6002e Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Wed, 6 Nov 2019 11:16:19 -0500 Subject: [PATCH 41/66] Fix the build. --- src/Mono.Android/Android.Runtime/ConstructorBuilder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mono.Android/Android.Runtime/ConstructorBuilder.cs b/src/Mono.Android/Android.Runtime/ConstructorBuilder.cs index 7518176f687..9e21fc8fff1 100644 --- a/src/Mono.Android/Android.Runtime/ConstructorBuilder.cs +++ b/src/Mono.Android/Android.Runtime/ConstructorBuilder.cs @@ -33,7 +33,7 @@ internal class ConstructorBuilder { il.Emit (OpCodes.Stfld, handle); Console.WriteLine ("CTOR: " + typeof (Console).GetMethod ("WriteLine", new Type [] { typeof (object) })); - Console.WriteLine ("CTOR2: " + cinfo.FullName + " " + parameter_Types.Length); + Console.WriteLine ("CTOR2: " + cinfo.FullName + " " + parameter_types.Length); il.Emit (OpCodes.Ldloc_0); il.Emit (OpCodes.Ldfld, handle); il.Emit (OpCodes.Box, typeof (IntPtr)); From 576d2ba1a73ed85874757f802c2c4449475fbaef Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Wed, 6 Nov 2019 11:53:40 -0500 Subject: [PATCH 42/66] Fix the build. --- src/Mono.Android/Android.Runtime/ConstructorBuilder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mono.Android/Android.Runtime/ConstructorBuilder.cs b/src/Mono.Android/Android.Runtime/ConstructorBuilder.cs index 9e21fc8fff1..a1df85c938c 100644 --- a/src/Mono.Android/Android.Runtime/ConstructorBuilder.cs +++ b/src/Mono.Android/Android.Runtime/ConstructorBuilder.cs @@ -33,7 +33,7 @@ internal class ConstructorBuilder { il.Emit (OpCodes.Stfld, handle); Console.WriteLine ("CTOR: " + typeof (Console).GetMethod ("WriteLine", new Type [] { typeof (object) })); - Console.WriteLine ("CTOR2: " + cinfo.FullName + " " + parameter_types.Length); + Console.WriteLine ("CTOR2: " + cinfo.DeclaringType.FullName + " " + parameter_types.Length); il.Emit (OpCodes.Ldloc_0); il.Emit (OpCodes.Ldfld, handle); il.Emit (OpCodes.Box, typeof (IntPtr)); From 87d724a38aaf6915f76e6113c84d41711d13412e Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Wed, 6 Nov 2019 16:27:37 -0500 Subject: [PATCH 43/66] Add more testing code. --- .../Droid/MainActivity.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/Xamarin.Forms-Performance-Integration/Droid/MainActivity.cs b/tests/Xamarin.Forms-Performance-Integration/Droid/MainActivity.cs index 708d8d8c158..d05c0cab654 100644 --- a/tests/Xamarin.Forms-Performance-Integration/Droid/MainActivity.cs +++ b/tests/Xamarin.Forms-Performance-Integration/Droid/MainActivity.cs @@ -17,6 +17,10 @@ public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompa bool firstOnStart = true; bool firstOnResume = true; + public MainActivity () : base () { + Console.WriteLine ("MAIN ACTIVITY."); + } + protected override void OnCreate (Bundle bundle) { TimingLogger timing = null; From 43736193e971376d9ff7cffc7da13e048a1569d3 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Tue, 19 Nov 2019 11:45:40 -0600 Subject: [PATCH 44/66] Force to always regenerate MVIDs Context: https://xamarinhq.slack.com/archives/C5P3G23NG/p1574015984217800 Context: https://github.com/jonathanpeppers/CecilDeterministicMvid/blob/master/CecilDeterministicMvid/Program.cs There was an issue pointed out where the AOT compiler is seeing two different `Mono.Android.dll`'s: one in `android\assets` and one in `android\assets\shrunk` with the same MVID. In a sample project, I tested this and it seems Mono.Cecil doesn't change the MVID when `WriterParameters.DeterministicMvid` is set to `false`. But this is the default? Let's try setting `DeterministicMvid` to `true` always. --- .../Tasks/RemoveRegisterAttribute.cs | 4 +--- .../Xamarin.Android.Common.targets | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/RemoveRegisterAttribute.cs b/src/Xamarin.Android.Build.Tasks/Tasks/RemoveRegisterAttribute.cs index e2883f77e7c..32b160b7f4c 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/RemoveRegisterAttribute.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/RemoveRegisterAttribute.cs @@ -19,14 +19,12 @@ public class RemoveRegisterAttribute : AndroidTask [Required] public ITaskItem[] ShrunkFrameworkAssemblies { get; set; } - public bool Deterministic { get; set; } - public override bool RunTask () { // Find Mono.Android.dll var mono_android = ShrunkFrameworkAssemblies.First (f => Path.GetFileNameWithoutExtension (f.ItemSpec) == "Mono.Android").ItemSpec; var writerParameters = new WriterParameters { - DeterministicMvid = Deterministic, + DeterministicMvid = true, }; using (var assembly = AssemblyDefinition.ReadAssembly (mono_android, new ReaderParameters { ReadWrite = true })) { // Strip out [Register] attributes diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets index 6e4954beacc..da99c607658 100644 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets @@ -2670,7 +2670,6 @@ because xbuild doesn't support framework reference assemblies. From a440e7de326db09ee5002114bed2aa8f4c2d85ff Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Wed, 20 Nov 2019 12:11:32 -0600 Subject: [PATCH 45/66] Revert "Force to always regenerate MVIDs" This reverts commit 43736193e971376d9ff7cffc7da13e048a1569d3. --- .../Tasks/RemoveRegisterAttribute.cs | 4 +++- .../Xamarin.Android.Common.targets | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/RemoveRegisterAttribute.cs b/src/Xamarin.Android.Build.Tasks/Tasks/RemoveRegisterAttribute.cs index 32b160b7f4c..e2883f77e7c 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/RemoveRegisterAttribute.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/RemoveRegisterAttribute.cs @@ -19,12 +19,14 @@ public class RemoveRegisterAttribute : AndroidTask [Required] public ITaskItem[] ShrunkFrameworkAssemblies { get; set; } + public bool Deterministic { get; set; } + public override bool RunTask () { // Find Mono.Android.dll var mono_android = ShrunkFrameworkAssemblies.First (f => Path.GetFileNameWithoutExtension (f.ItemSpec) == "Mono.Android").ItemSpec; var writerParameters = new WriterParameters { - DeterministicMvid = true, + DeterministicMvid = Deterministic, }; using (var assembly = AssemblyDefinition.ReadAssembly (mono_android, new ReaderParameters { ReadWrite = true })) { // Strip out [Register] attributes diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets index 2fa2cbd98f8..fa622766688 100644 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets @@ -2528,6 +2528,7 @@ because xbuild doesn't support framework reference assemblies. From 5bd362647732b65f629c736dd7b81ad0b21c02fa Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Mon, 18 Nov 2019 12:01:06 -0600 Subject: [PATCH 46/66] [Xamarin.Android.Build.Tasks] remove the android\assets\shrunk directory Context: https://github.com/xamarin/xamarin-android/pull/3753 Context: https://github.com/xamarin/monodroid/pull/1053 There appears to be an issue with mono:2019-10 when the Xamarin.Forms integration project is built with AOT in `Release` mode. The issue somehow stems from two `Mono.Android.dll` existing: * `obj\Debug\android\assets\Mono.Android.dll` * `obj\Debug\android\assets\shrunk\Mono.Android.dll` Looking at how AOT is invoked, it seems like either `Mono.Android.dll` could be picked up by the parameters being passed in. We might be AOT'ing a user's `Foo.dll`, and both directories are in `$MONO_PATH` or passed via other arguments. How would we know which is picked up? The `shrunk` directory is used by the `` MSBuild task that: * Runs after the linker & `` * Removes all the `[RegisterAttribute]` from types, to further shrink `Mono.Android.dll`. It looks like we copy all `@(_ResolvedFrameworkAssemblies)` to the `shrunk` directory and fix up item groups. Why don't we just get rid of this `shrunk` directory and not copy anything? We can edit `Mono.Android.dll` in place, and incremental builds should be fine due to the use of stamp files. I also moved the flag file to: $(_AndroidStampDirectory)_RemoveRegisterAttribute.stamp To match our new MSBuild conventions. There is also usage of `@(_ShrunkFrameworkAssemblies)` that needs to be updated in monodroid. --- .external | 4 +- .../Tasks/RemoveRegisterAttribute.cs | 4 +- .../Xamarin.Android.Common.targets | 41 ++++--------------- 3 files changed, 12 insertions(+), 37 deletions(-) diff --git a/.external b/.external index badd188fafd..fa40d2c4768 100644 --- a/.external +++ b/.external @@ -1,2 +1,2 @@ -xamarin/monodroid:master@1b907d680cc6561dcfaddc6f997d2f6ff5456644 -mono/mono:2019-10@e1f916ed1e988531a70b61d61a9aff1b23036802 \ No newline at end of file +xamarin/monodroid:shrunkframeworkassemblies@326b7fc28ebfc0e630e3383ea5061a3337efe986 +mono/mono:2019-10@e1f916ed1e988531a70b61d61a9aff1b23036802 diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/RemoveRegisterAttribute.cs b/src/Xamarin.Android.Build.Tasks/Tasks/RemoveRegisterAttribute.cs index e2883f77e7c..f98c96abd28 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/RemoveRegisterAttribute.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/RemoveRegisterAttribute.cs @@ -17,14 +17,14 @@ public class RemoveRegisterAttribute : AndroidTask const string RegisterAttribute = "Android.Runtime.RegisterAttribute"; [Required] - public ITaskItem[] ShrunkFrameworkAssemblies { get; set; } + public ITaskItem[] FrameworkAssemblies { get; set; } public bool Deterministic { get; set; } public override bool RunTask () { // Find Mono.Android.dll - var mono_android = ShrunkFrameworkAssemblies.First (f => Path.GetFileNameWithoutExtension (f.ItemSpec) == "Mono.Android").ItemSpec; + var mono_android = FrameworkAssemblies.First (f => Path.GetFileNameWithoutExtension (f.ItemSpec) == "Mono.Android").ItemSpec; var writerParameters = new WriterParameters { DeterministicMvid = Deterministic, }; diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets index fa622766688..4d93c96a59d 100644 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets @@ -1155,7 +1155,6 @@ because xbuild doesn't support framework reference assemblies. <_AndroidLinkFlag>$(IntermediateOutputPath)link.flag <_AndroidApkPerAbiFlagFile>$(IntermediateOutputPath)android\bin\apk_per_abi.flag <_AndroidDebugKeyStoreFlag>$(IntermediateOutputPath)android_debug_keystore.flag - <_RemoveRegisterFlag>$(MonoAndroidIntermediateAssemblyDir)shrunk\shrunk.flag <_AcwMapFile>$(IntermediateOutputPath)acw-map.txt <_CustomViewMapFile>$(IntermediateOutputPath)customview-map.txt <_AndroidTypeMappingJavaToManaged>$(IntermediateOutputPath)android\typemap.jm @@ -2038,18 +2037,6 @@ because xbuild doesn't support framework reference assemblies. - - - - - - - - @@ -2512,27 +2499,16 @@ because xbuild doesn't support framework reference assemblies. - - - - - + FrameworkAssemblies="@(_ResolvedFrameworkAssemblies)" /> - - + $(MSBuildAllProjects) ;$(_PackagedResources) - ;@(_ResolvedUserAssemblies) - ;@(_ShrunkFrameworkAssemblies) + ;@(_ResolvedAssemblies) ;@(AndroidNativeLibrary) ;@(_DexFile) ;$(_AndroidBuildPropertiesCache) @@ -2712,7 +2687,7 @@ because xbuild doesn't support framework reference assemblies. SupportedAbis="@(_BuildTargetAbis)" AndroidSequencePointsMode="$(_SequencePointsMode)" AotAdditionalArguments="$(AndroidAotAdditionalArguments)" - ResolvedAssemblies="@(_ResolvedUserAssemblies);@(_ShrunkFrameworkAssemblies)" + ResolvedAssemblies="@(_ResolvedAssemblies)" AotOutputDirectory="$(_AndroidAotBinDirectory)" IntermediateAssemblyDir="$(MonoAndroidIntermediateAssemblyDir)" LinkMode="$(AndroidLinkMode)" @@ -2737,7 +2712,7 @@ because xbuild doesn't support framework reference assemblies. Condition="'$(BundleAssemblies)' == 'True'" KeepTemp="$(AndroidMakeBundleKeepTemporaryFiles)" AndroidNdkDirectory="$(_AndroidNdkDirectory)" - Assemblies="@(_ResolvedUserAssemblies);@(_AndroidResolvedSatellitePaths);@(_ShrunkFrameworkAssemblies)" + Assemblies="@(_ResolvedAssemblies);@(_AndroidResolvedSatellitePaths)" IncludePath="$(MonoAndroidIncludeDirectory)" SupportedAbis="@(_BuildTargetAbis)" TempOutputPath="$(IntermediateOutputPath)" @@ -2755,7 +2730,7 @@ because xbuild doesn't support framework reference assemblies. BundleNativeLibraries="$(_BundleResultNativeLibraries)" EmbedAssemblies="$(EmbedAssembliesIntoApk)" ResolvedUserAssemblies="@(_ResolvedUserAssemblies);@(_AndroidResolvedSatellitePaths)" - ResolvedFrameworkAssemblies="@(_ShrunkFrameworkAssemblies)" + ResolvedFrameworkAssemblies="@(_ResolvedFrameworkAssemblies)" NativeLibraries="@(AndroidNativeLibrary)" ApplicationSharedLibraries="@(_ApplicationSharedLibrary)" AdditionalNativeLibraryReferences="@(_AdditionalNativeLibraryReferences)" @@ -2784,7 +2759,7 @@ because xbuild doesn't support framework reference assemblies. BundleNativeLibraries="$(_BundleResultNativeLibraries)" EmbedAssemblies="$(EmbedAssembliesIntoApk)" ResolvedUserAssemblies="@(_ResolvedUserAssemblies);@(_AndroidResolvedSatellitePaths)" - ResolvedFrameworkAssemblies="@(_ShrunkFrameworkAssemblies)" + ResolvedFrameworkAssemblies="@(_ResolvedFrameworkAssemblies)" NativeLibraries="@(AndroidNativeLibrary)" ApplicationSharedLibraries="@(_ApplicationSharedLibrary)" AdditionalNativeLibraryReferences="@(_AdditionalNativeLibraryReferences)" From 28be95a4446a3331350c58863395f4848d1d0176 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Wed, 20 Nov 2019 20:09:51 -0600 Subject: [PATCH 47/66] Bump to xamarin/java.interop/master@7558ca1 Changes: https://github.com/xamarin/java.interop/compare/166a6c9...7558ca1 Bumps to mono/cecil/master@a6a7f5c0 --- external/Java.Interop | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/Java.Interop b/external/Java.Interop index 166a6c95260..7558ca18695 160000 --- a/external/Java.Interop +++ b/external/Java.Interop @@ -1 +1 @@ -Subproject commit 166a6c95260330114174a91e8cf0b68cc0e14479 +Subproject commit 7558ca18695ed8d5a41293a140c95a20ed30f4e6 From 6e265972f746db53ae7c301168763a9d85346c99 Mon Sep 17 00:00:00 2001 From: Steve Pfister Date: Thu, 21 Nov 2019 12:55:45 -0500 Subject: [PATCH 48/66] Bump to mono/mono@e9b5aec --- .external | 2 +- Configuration.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.external b/.external index fa40d2c4768..ac7650810af 100644 --- a/.external +++ b/.external @@ -1,2 +1,2 @@ xamarin/monodroid:shrunkframeworkassemblies@326b7fc28ebfc0e630e3383ea5061a3337efe986 -mono/mono:2019-10@e1f916ed1e988531a70b61d61a9aff1b23036802 +mono/mono:2019-10@e9b5aec5ec7801df66117f2da730672ede15dcc6 diff --git a/Configuration.props b/Configuration.props index be0ccdea919..190d441e91c 100644 --- a/Configuration.props +++ b/Configuration.props @@ -84,7 +84,7 @@ 6.8.0 6.9.0 True - $(MonoRequiredMinimumVersion).41 + $(MonoRequiredMinimumVersion).53 $(MSBuildThisFileDirectory)external\mono\sdks\out\android-sources\external\linker\src $(MSBuildThisFileDirectory)external\opentk \usr From 7c1e48cfffe811705d506af073b0f090942e469e Mon Sep 17 00:00:00 2001 From: Jonathan Pryor Date: Thu, 21 Nov 2019 20:37:49 -0500 Subject: [PATCH 49/66] Remoove printf-debug messages Let's try to get back to a reasonably small diff size. "Reverts": * aa16b5800345bf8b41f13145634ab2741ab636f7 * 4a075cd63d9766eab06c260f3115ae2bfe91a659 * fa561c3bbbc7b4f6624d2d8f1a1681563089fd5b * 87d724a38aaf6915f76e6113c84d41711d13412e --- .../Android.Runtime/ConstructorBuilder.cs | 13 ------------- src/Mono.Android/Java.Interop/TypeManager.cs | 13 ------------- src/Mono.Android/Java.Lang/Object.cs | 2 -- .../Droid/MainActivity.cs | 4 ---- 4 files changed, 32 deletions(-) diff --git a/src/Mono.Android/Android.Runtime/ConstructorBuilder.cs b/src/Mono.Android/Android.Runtime/ConstructorBuilder.cs index a1df85c938c..95ff0d0b949 100644 --- a/src/Mono.Android/Android.Runtime/ConstructorBuilder.cs +++ b/src/Mono.Android/Android.Runtime/ConstructorBuilder.cs @@ -32,17 +32,6 @@ internal class ConstructorBuilder { il.Emit (OpCodes.Ldarg_0); il.Emit (OpCodes.Stfld, handle); - Console.WriteLine ("CTOR: " + typeof (Console).GetMethod ("WriteLine", new Type [] { typeof (object) })); - Console.WriteLine ("CTOR2: " + cinfo.DeclaringType.FullName + " " + parameter_types.Length); - il.Emit (OpCodes.Ldloc_0); - il.Emit (OpCodes.Ldfld, handle); - il.Emit (OpCodes.Box, typeof (IntPtr)); - il.Emit (OpCodes.Call, typeof (Console).GetMethod ("WriteLine", new Type [] { typeof (object) })); - il.Emit (OpCodes.Ldloc_0); - il.Emit (OpCodes.Call, typeof (Console).GetMethod ("WriteLine", new Type [] { typeof (object) })); - - il.EmitWriteLine($"# jonp: Inside activation constructor for type `{type}`: before invoke!!"); - il.Emit (OpCodes.Ldloc_0); for (int i = 0; i < parameter_types.Length; i++) { il.Emit (OpCodes.Ldarg, 1); @@ -52,8 +41,6 @@ internal class ConstructorBuilder { il.Emit (OpCodes.Call, cinfo); - il.EmitWriteLine($"# jonp: Inside activation constructor for type `{type}`: after invoke!!"); - il.Emit (OpCodes.Ret); return (Action) method.CreateDelegate (typeof (Action )); diff --git a/src/Mono.Android/Java.Interop/TypeManager.cs b/src/Mono.Android/Java.Interop/TypeManager.cs index eac39589f9c..98efa0c5a09 100644 --- a/src/Mono.Android/Java.Interop/TypeManager.cs +++ b/src/Mono.Android/Java.Interop/TypeManager.cs @@ -133,9 +133,6 @@ static Type[] GetParameterTypes (string signature) static void n_Activate (IntPtr jnienv, IntPtr jclass, IntPtr typename_ptr, IntPtr signature_ptr, IntPtr jobject, IntPtr parameters_ptr) { - JNIEnv._monodroid_gref_log ( - string.Format ("# jonp: n_Activate: Activating handle 0x{0} (key_handle 0x{1}).\n", - jobject.ToString ("x"), JNIEnv.IdentityHash (jobject).ToString ("x"))); var o = Java.Lang.Object.PeekObject (jobject); var ex = o as IJavaObjectEx; if (ex != null) { @@ -143,7 +140,6 @@ static void n_Activate (IntPtr jnienv, IntPtr jclass, IntPtr typename_ptr, IntPt return; } if (!ActivationEnabled) { - JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: Activation not enabled. Bailing!\n"); if (Logger.LogGlobalRef) { Logger.Log (LogLevel.Info, "monodroid-gref", string.Format ("warning: Skipping managed constructor invocation for handle 0x{0} (key_handle 0x{1}). " + @@ -155,28 +151,23 @@ static void n_Activate (IntPtr jnienv, IntPtr jclass, IntPtr typename_ptr, IntPt } Type type = Type.GetType (JNIEnv.GetString (typename_ptr, JniHandleOwnership.DoNotTransfer), throwOnError:true); - JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: type={type}\n"); if (type.IsGenericTypeDefinition) { throw new NotSupportedException ( "Constructing instances of generic types from Java is not supported, as the type parameters cannot be determined.", CreateJavaLocationException ()); } Type[] ptypes = GetParameterTypes (JNIEnv.GetString (signature_ptr, JniHandleOwnership.DoNotTransfer)); - JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: constructor parameter types: {string.Join (", ", (object[]) ptypes)}\n"); object[] parms = JNIEnv.GetObjectArray (parameters_ptr, ptypes); ConstructorInfo cinfo = type.GetConstructor (ptypes); if (cinfo == null) { throw CreateMissingConstructorException (type, ptypes); } if (o != null) { - JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: invoking ctor on already created instance\n"); cinfo.Invoke (o, parms); return; } try { - JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: creating new instance\n"); var activator = ConstructorBuilder.CreateDelegate (type, cinfo, ptypes); - JNIEnv._monodroid_gref_log ($"# jonp: n_Activate: activator={activator.Method.DeclaringType} :: {activator.Method}\n"); activator (jobject, parms); } catch (Exception e) { var m = string.Format ("Could not activate JNI Handle 0x{0} (key_handle 0x{1}) of Java type '{2}' as managed type '{3}'.", @@ -252,8 +243,6 @@ internal static IJavaObject CreateInstance (IntPtr handle, JniHandleOwnership tr internal static IJavaObject CreateInstance (IntPtr handle, JniHandleOwnership transfer, Type targetType) { - JNIEnv._monodroid_gref_log ($"# jonp: CreateInstance: handle=0x{handle.ToString ("x2")}, key_handle=0x{JNIEnv.IdentityHash (handle)}\n"); - JNIEnv._monodroid_gref_log ($"{new System.Diagnostics.StackTrace (true)}\n"); Type type = null; IntPtr class_ptr = JNIEnv.GetObjectClass (handle); string class_name = GetClassName (class_ptr); @@ -294,8 +283,6 @@ internal static IJavaObject CreateInstance (IntPtr handle, JniHandleOwnership tr type = invokerType; } - JNIEnv._monodroid_gref_log ($"# jonp: CreateInstance: type={type}\n"); - IJavaObject result = null; diff --git a/src/Mono.Android/Java.Lang/Object.cs b/src/Mono.Android/Java.Lang/Object.cs index 4f8748271b3..496a235b1ce 100644 --- a/src/Mono.Android/Java.Lang/Object.cs +++ b/src/Mono.Android/Java.Lang/Object.cs @@ -72,9 +72,7 @@ IntPtr IJavaObjectEx.ToLocalJniHandle () public Object (IntPtr handle, JniHandleOwnership transfer) { // Check if handle was preset by our java activation mechanism - JNIEnv._monodroid_gref_log ($"# jonp: Object:.ctor: this.handle=0x{this.handle.ToString("x2")}; handle=0x{handle.ToString("x2")}; transfer={transfer}\n"); if (this.handle != IntPtr.Zero) { - JNIEnv._monodroid_gref_log ($"# jonp: Object:.ctor: ACTIVATION SCENARIO\n"); needsActivation = true; handle = this.handle; if (handle_type != 0) diff --git a/tests/Xamarin.Forms-Performance-Integration/Droid/MainActivity.cs b/tests/Xamarin.Forms-Performance-Integration/Droid/MainActivity.cs index d05c0cab654..708d8d8c158 100644 --- a/tests/Xamarin.Forms-Performance-Integration/Droid/MainActivity.cs +++ b/tests/Xamarin.Forms-Performance-Integration/Droid/MainActivity.cs @@ -17,10 +17,6 @@ public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompa bool firstOnStart = true; bool firstOnResume = true; - public MainActivity () : base () { - Console.WriteLine ("MAIN ACTIVITY."); - } - protected override void OnCreate (Bundle bundle) { TimingLogger timing = null; From 18c823c6cee3bd760439f2adbd2cc7672c1a760f Mon Sep 17 00:00:00 2001 From: Jonathan Pryor Date: Thu, 21 Nov 2019 20:42:18 -0500 Subject: [PATCH 50/66] Fix indentation --- build-tools/scripts/TestApks.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-tools/scripts/TestApks.targets b/build-tools/scripts/TestApks.targets index eb8a002b78a..15d8bbade9f 100644 --- a/build-tools/scripts/TestApks.targets +++ b/build-tools/scripts/TestApks.targets @@ -273,7 +273,7 @@ AddResults="true" LabelSuffix="-$(Configuration)$(TestsFlavor)" Activity="%(_AllArchives.Activity)" /> - + Date: Fri, 22 Nov 2019 08:58:45 -0600 Subject: [PATCH 51/66] Revert "[Xamarin.Android.Build.Tasks] remove the android\assets\shrunk directory" This reverts commit 5bd362647732b65f629c736dd7b81ad0b21c02fa. Will will get this change in separately at: https://github.com/xamarin/xamarin-android/pull/3925 --- .external | 2 +- .../Tasks/RemoveRegisterAttribute.cs | 4 +- .../Xamarin.Android.Common.targets | 39 +++++++++++++++---- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/.external b/.external index ac7650810af..fef7f45b2fc 100644 --- a/.external +++ b/.external @@ -1,2 +1,2 @@ -xamarin/monodroid:shrunkframeworkassemblies@326b7fc28ebfc0e630e3383ea5061a3337efe986 +xamarin/monodroid:master@1b907d680cc6561dcfaddc6f997d2f6ff5456644 mono/mono:2019-10@e9b5aec5ec7801df66117f2da730672ede15dcc6 diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/RemoveRegisterAttribute.cs b/src/Xamarin.Android.Build.Tasks/Tasks/RemoveRegisterAttribute.cs index f98c96abd28..e2883f77e7c 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/RemoveRegisterAttribute.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/RemoveRegisterAttribute.cs @@ -17,14 +17,14 @@ public class RemoveRegisterAttribute : AndroidTask const string RegisterAttribute = "Android.Runtime.RegisterAttribute"; [Required] - public ITaskItem[] FrameworkAssemblies { get; set; } + public ITaskItem[] ShrunkFrameworkAssemblies { get; set; } public bool Deterministic { get; set; } public override bool RunTask () { // Find Mono.Android.dll - var mono_android = FrameworkAssemblies.First (f => Path.GetFileNameWithoutExtension (f.ItemSpec) == "Mono.Android").ItemSpec; + var mono_android = ShrunkFrameworkAssemblies.First (f => Path.GetFileNameWithoutExtension (f.ItemSpec) == "Mono.Android").ItemSpec; var writerParameters = new WriterParameters { DeterministicMvid = Deterministic, }; diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets index 3c35832d8f0..d8d84ba676d 100644 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets @@ -1158,6 +1158,7 @@ because xbuild doesn't support framework reference assemblies. <_AndroidLinkFlag>$(IntermediateOutputPath)link.flag <_AndroidApkPerAbiFlagFile>$(IntermediateOutputPath)android\bin\apk_per_abi.flag <_AndroidDebugKeyStoreFlag>$(IntermediateOutputPath)android_debug_keystore.flag + <_RemoveRegisterFlag>$(MonoAndroidIntermediateAssemblyDir)shrunk\shrunk.flag <_AcwMapFile>$(IntermediateOutputPath)acw-map.txt <_CustomViewMapFile>$(IntermediateOutputPath)customview-map.txt <_AndroidTypeMappingJavaToManaged>$(IntermediateOutputPath)android\typemap.jm @@ -2040,6 +2041,18 @@ because xbuild doesn't support framework reference assemblies. + + + + + + + + @@ -2503,16 +2516,27 @@ because xbuild doesn't support framework reference assemblies. + + + + + + ShrunkFrameworkAssemblies="@(_ShrunkFrameworkAssemblies)" /> - + + $(MSBuildAllProjects) ;$(_PackagedResources) - ;@(_ResolvedAssemblies) + ;@(_ResolvedUserAssemblies) + ;@(_ShrunkFrameworkAssemblies) ;@(AndroidNativeLibrary) ;@(_DexFile) ;$(_AndroidBuildPropertiesCache) @@ -2717,7 +2742,7 @@ because xbuild doesn't support framework reference assemblies. Condition="'$(BundleAssemblies)' == 'True'" KeepTemp="$(AndroidMakeBundleKeepTemporaryFiles)" AndroidNdkDirectory="$(_AndroidNdkDirectory)" - Assemblies="@(_ResolvedAssemblies);@(_AndroidResolvedSatellitePaths)" + Assemblies="@(_ResolvedUserAssemblies);@(_AndroidResolvedSatellitePaths);@(_ShrunkFrameworkAssemblies)" IncludePath="$(MonoAndroidIncludeDirectory)" SupportedAbis="@(_BuildTargetAbis)" TempOutputPath="$(IntermediateOutputPath)" @@ -2735,7 +2760,7 @@ because xbuild doesn't support framework reference assemblies. BundleNativeLibraries="$(_BundleResultNativeLibraries)" EmbedAssemblies="$(EmbedAssembliesIntoApk)" ResolvedUserAssemblies="@(_ResolvedUserAssemblies);@(_AndroidResolvedSatellitePaths)" - ResolvedFrameworkAssemblies="@(_ResolvedFrameworkAssemblies)" + ResolvedFrameworkAssemblies="@(_ShrunkFrameworkAssemblies)" NativeLibraries="@(AndroidNativeLibrary)" ApplicationSharedLibraries="@(_ApplicationSharedLibrary)" AdditionalNativeLibraryReferences="@(_AdditionalNativeLibraryReferences)" @@ -2764,7 +2789,7 @@ because xbuild doesn't support framework reference assemblies. BundleNativeLibraries="$(_BundleResultNativeLibraries)" EmbedAssemblies="$(EmbedAssembliesIntoApk)" ResolvedUserAssemblies="@(_ResolvedUserAssemblies);@(_AndroidResolvedSatellitePaths)" - ResolvedFrameworkAssemblies="@(_ResolvedFrameworkAssemblies)" + ResolvedFrameworkAssemblies="@(_ShrunkFrameworkAssemblies)" NativeLibraries="@(AndroidNativeLibrary)" ApplicationSharedLibraries="@(_ApplicationSharedLibrary)" AdditionalNativeLibraryReferences="@(_AdditionalNativeLibraryReferences)" From d5978f795e33d94c24e88e72226f221acaac2448 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Fri, 22 Nov 2019 11:16:18 -0500 Subject: [PATCH 52/66] Remove the last month and a half of debug spew --- build-tools/scripts/TestApks.targets | 3 +-- src/Mono.Android/Android.Runtime/ConstructorBuilder.cs | 1 - src/Mono.Android/Test/Properties/AndroidManifest.xml | 2 +- .../Tests/Xamarin.ProjectTools/Environment.txt | 1 - .../Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj | 3 --- src/monodroid/jni/osbridge.cc | 1 - .../Droid/Environment.txt | 1 - .../Droid/Properties/AndroidManifest.xml | 4 ++-- .../Droid/Xamarin.Forms.Performance.Integration.Droid.csproj | 4 +--- .../Xamarin.Forms.Performance.Integration.csproj | 2 +- 10 files changed, 6 insertions(+), 16 deletions(-) delete mode 100644 src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Environment.txt delete mode 100644 tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt diff --git a/build-tools/scripts/TestApks.targets b/build-tools/scripts/TestApks.targets index 15d8bbade9f..34bb4f66614 100644 --- a/build-tools/scripts/TestApks.targets +++ b/build-tools/scripts/TestApks.targets @@ -83,7 +83,7 @@ WriteOutputAsMessage="True" /> - - + diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Environment.txt b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Environment.txt deleted file mode 100644 index 566f3839478..00000000000 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Environment.txt +++ /dev/null @@ -1 +0,0 @@ -debug.mono.log=gref diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj index 7cd42319b6d..645a22ec58d 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj @@ -91,9 +91,6 @@ - - - Xamarin.ProjectTools.Resources.Wear.LayoutMain.axml diff --git a/src/monodroid/jni/osbridge.cc b/src/monodroid/jni/osbridge.cc index 173b692725b..b3b72c45d92 100644 --- a/src/monodroid/jni/osbridge.cc +++ b/src/monodroid/jni/osbridge.cc @@ -222,7 +222,6 @@ OSBridge::_write_stack_trace (FILE *to, const char *from) void OSBridge::_monodroid_gref_log (const char *message) { - log_info (LOG_GREF, "%s", message); if (!gref_log) return; fprintf (gref_log, "%s", message); diff --git a/tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt b/tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt deleted file mode 100644 index 566f3839478..00000000000 --- a/tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt +++ /dev/null @@ -1 +0,0 @@ -debug.mono.log=gref diff --git a/tests/Xamarin.Forms-Performance-Integration/Droid/Properties/AndroidManifest.xml b/tests/Xamarin.Forms-Performance-Integration/Droid/Properties/AndroidManifest.xml index 54d8ff31215..c9182a70c56 100644 --- a/tests/Xamarin.Forms-Performance-Integration/Droid/Properties/AndroidManifest.xml +++ b/tests/Xamarin.Forms-Performance-Integration/Droid/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@  - - + + \ No newline at end of file diff --git a/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj b/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj index c70d7ef31c9..fbc0cc88240 100644 --- a/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj +++ b/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj @@ -44,6 +44,7 @@ true false r8 + True @@ -261,9 +262,6 @@ - - - diff --git a/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj b/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj index c78bcb59194..e2e6ca7a2ee 100644 --- a/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj +++ b/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj @@ -12,4 +12,4 @@ - + \ No newline at end of file From dc0ceec220270e033fb2076eb3ec3d51cf3ca75d Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Fri, 22 Nov 2019 13:33:07 -0500 Subject: [PATCH 53/66] Revert "Remove the last month and a half of debug spew" This reverts commit d5978f795e33d94c24e88e72226f221acaac2448. --- build-tools/scripts/TestApks.targets | 3 ++- src/Mono.Android/Android.Runtime/ConstructorBuilder.cs | 1 + src/Mono.Android/Test/Properties/AndroidManifest.xml | 2 +- .../Tests/Xamarin.ProjectTools/Environment.txt | 1 + .../Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj | 3 +++ src/monodroid/jni/osbridge.cc | 1 + .../Droid/Environment.txt | 1 + .../Droid/Properties/AndroidManifest.xml | 4 ++-- .../Droid/Xamarin.Forms.Performance.Integration.Droid.csproj | 4 +++- .../Xamarin.Forms.Performance.Integration.csproj | 2 +- 10 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Environment.txt create mode 100644 tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt diff --git a/build-tools/scripts/TestApks.targets b/build-tools/scripts/TestApks.targets index 34bb4f66614..15d8bbade9f 100644 --- a/build-tools/scripts/TestApks.targets +++ b/build-tools/scripts/TestApks.targets @@ -83,7 +83,7 @@ WriteOutputAsMessage="True" /> + - + diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Environment.txt b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Environment.txt new file mode 100644 index 00000000000..566f3839478 --- /dev/null +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Environment.txt @@ -0,0 +1 @@ +debug.mono.log=gref diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj index 645a22ec58d..7cd42319b6d 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj @@ -91,6 +91,9 @@ + + + Xamarin.ProjectTools.Resources.Wear.LayoutMain.axml diff --git a/src/monodroid/jni/osbridge.cc b/src/monodroid/jni/osbridge.cc index b3b72c45d92..173b692725b 100644 --- a/src/monodroid/jni/osbridge.cc +++ b/src/monodroid/jni/osbridge.cc @@ -222,6 +222,7 @@ OSBridge::_write_stack_trace (FILE *to, const char *from) void OSBridge::_monodroid_gref_log (const char *message) { + log_info (LOG_GREF, "%s", message); if (!gref_log) return; fprintf (gref_log, "%s", message); diff --git a/tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt b/tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt new file mode 100644 index 00000000000..566f3839478 --- /dev/null +++ b/tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt @@ -0,0 +1 @@ +debug.mono.log=gref diff --git a/tests/Xamarin.Forms-Performance-Integration/Droid/Properties/AndroidManifest.xml b/tests/Xamarin.Forms-Performance-Integration/Droid/Properties/AndroidManifest.xml index c9182a70c56..54d8ff31215 100644 --- a/tests/Xamarin.Forms-Performance-Integration/Droid/Properties/AndroidManifest.xml +++ b/tests/Xamarin.Forms-Performance-Integration/Droid/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@  - - \ No newline at end of file + + diff --git a/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj b/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj index fbc0cc88240..c70d7ef31c9 100644 --- a/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj +++ b/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj @@ -44,7 +44,6 @@ true false r8 - True @@ -262,6 +261,9 @@ + + + diff --git a/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj b/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj index e2e6ca7a2ee..c78bcb59194 100644 --- a/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj +++ b/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj @@ -12,4 +12,4 @@ - \ No newline at end of file + From d71d7fe50810bd9d8d8cddd4de5700beb2d50c4b Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Fri, 22 Nov 2019 15:49:03 -0500 Subject: [PATCH 54/66] Bump deployed system Mono to match build mono --- .../xaprepare/xaprepare/ConfigAndData/Configurables.MacOS.cs | 2 +- .../xaprepare/xaprepare/ConfigAndData/Dependencies/MacOS.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.MacOS.cs b/build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.MacOS.cs index a9af2122c76..0642ea9a328 100644 --- a/build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.MacOS.cs +++ b/build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.MacOS.cs @@ -7,7 +7,7 @@ partial class Configurables partial class Urls { public static readonly Uri Corretto = new Uri ($"{Corretto_BaseUri}{CorrettoUrlPathVersion}/amazon-corretto-{CorrettoDistVersion}-macosx-x64.tar.gz"); - public static readonly Uri MonoPackage = new Uri ("https://xamjenkinsartifact.azureedge.net/build-package-osx-mono/2019-10/45/e1f916ed1e988531a70b61d61a9aff1b23036802/MonoFramework-MDK-6.8.0.41.macos10.xamarin.universal.pkg"); + public static readonly Uri MonoPackage = new Uri ("https://xamjenkinsartifact.azureedge.net/build-package-osx-mono/2019-10/57/e9b5aec5ec7801df66117f2da730672ede15dcc6/MonoFramework-MDK-6.8.0.53.macos10.xamarin.universal.pkg"); } partial class Defaults diff --git a/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/MacOS.cs b/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/MacOS.cs index 2f7c44462bb..a5625783be5 100644 --- a/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/MacOS.cs +++ b/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/MacOS.cs @@ -33,7 +33,7 @@ partial class MacOS // If you change the minimum Mono version here, please change the URL as well new MonoPkgProgram ("Mono", "com.xamarin.mono-MDK.pkg", Configurables.Urls.MonoPackage) { - MinimumVersion = "6.8.0.41", + MinimumVersion = "6.8.0.53", MaximumVersion = "6.99.0.0", }, }; From 4aa81c97648417fa07e9237dc37526ebc155af1d Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Mon, 25 Nov 2019 11:37:18 -0500 Subject: [PATCH 55/66] Let's see if we can get more debug output from Mono, to see why it's unhappy --- .../Xamarin.Forms-Performance-Integration/Droid/Environment.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt b/tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt index 566f3839478..d725fedab3b 100644 --- a/tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt +++ b/tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt @@ -1 +1,2 @@ debug.mono.log=gref +debug.mono.env=MONO_LOG_LEVEL=debug From 447afa5b56da006dd398e01a924b89bbfd3f8f1a Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Mon, 25 Nov 2019 11:44:12 -0500 Subject: [PATCH 56/66] Enable debug features in release build --- src/monodroid/jni/monodroid-glue-internal.hh | 2 -- src/monodroid/jni/monodroid-glue.cc | 6 ------ 2 files changed, 8 deletions(-) diff --git a/src/monodroid/jni/monodroid-glue-internal.hh b/src/monodroid/jni/monodroid-glue-internal.hh index 942426640b3..6bf765a473e 100644 --- a/src/monodroid/jni/monodroid-glue-internal.hh +++ b/src/monodroid/jni/monodroid-glue-internal.hh @@ -177,7 +177,6 @@ namespace xamarin::android::internal static void thread_start (MonoProfiler *prof, uintptr_t tid); static void thread_end (MonoProfiler *prof, uintptr_t tid); -#if defined (DEBUG) void set_debug_env_vars (void); #if !defined (WINDOWS) @@ -185,7 +184,6 @@ namespace xamarin::android::internal int monodroid_debug_connect (int sock, struct sockaddr_in addr); int monodroid_debug_accept (int sock, struct sockaddr_in addr); #endif // !WINDOWS -#endif // DEBUG #if !defined (RELEASE) static MonoAssembly* open_from_update_dir (MonoAssemblyName *aname, char **assemblies_path, void *user_data); diff --git a/src/monodroid/jni/monodroid-glue.cc b/src/monodroid/jni/monodroid-glue.cc index 3ea880878cd..7699b38c601 100644 --- a/src/monodroid/jni/monodroid-glue.cc +++ b/src/monodroid/jni/monodroid-glue.cc @@ -1019,7 +1019,6 @@ MonodroidRuntime::propagate_uncaught_exception (MonoDomain *domain, JNIEnv *env, utils.monodroid_runtime_invoke (domain, method, nullptr, args, nullptr); } -#if DEBUG static void setup_gc_logging (void) { @@ -1028,7 +1027,6 @@ setup_gc_logging (void) log_categories |= LOG_GC; } } -#endif inline int MonodroidRuntime::convert_dl_flags (int flags) @@ -1142,7 +1140,6 @@ MonodroidRuntime::create_xdg_directories_and_environment (JNIEnv *env, jstring_w create_xdg_directory (homeDir, ".config", "XDG_CONFIG_HOME"); } -#if DEBUG void MonodroidRuntime::set_debug_env_vars (void) { @@ -1169,7 +1166,6 @@ MonodroidRuntime::set_debug_env_vars (void) } utils.monodroid_strfreev (args); } -#endif /* DEBUG */ inline void MonodroidRuntime::set_trace_options (void) @@ -1422,10 +1418,8 @@ MonodroidRuntime::Java_mono_android_Runtime_initInternal (JNIEnv *env, jclass kl init_reference_logging (androidSystem.get_primary_override_dir ()); androidSystem.create_update_dir (androidSystem.get_primary_override_dir ()); -#if DEBUG setup_gc_logging (); set_debug_env_vars (); -#endif #ifndef RELEASE jstr = env->GetObjectArrayElement (externalStorageDirs, 0); From 5e361b2aff5138e18124d49c14df7859e264c605 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Mon, 25 Nov 2019 14:02:40 -0500 Subject: [PATCH 57/66] Less verbose please --- src/monodroid/jni/monodroid-glue-internal.hh | 2 ++ src/monodroid/jni/monodroid-glue.cc | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/monodroid/jni/monodroid-glue-internal.hh b/src/monodroid/jni/monodroid-glue-internal.hh index 6bf765a473e..1dd73313bf2 100644 --- a/src/monodroid/jni/monodroid-glue-internal.hh +++ b/src/monodroid/jni/monodroid-glue-internal.hh @@ -179,6 +179,7 @@ namespace xamarin::android::internal void set_debug_env_vars (void); +#if defined (DEBUG) #if !defined (WINDOWS) int parse_runtime_args (char *runtime_args, RuntimeOptions *options); int monodroid_debug_connect (int sock, struct sockaddr_in addr); @@ -187,6 +188,7 @@ namespace xamarin::android::internal #if !defined (RELEASE) static MonoAssembly* open_from_update_dir (MonoAssemblyName *aname, char **assemblies_path, void *user_data); +#endif #endif private: MonoMethod *registerType = nullptr; diff --git a/src/monodroid/jni/monodroid-glue.cc b/src/monodroid/jni/monodroid-glue.cc index 7699b38c601..145153e9115 100644 --- a/src/monodroid/jni/monodroid-glue.cc +++ b/src/monodroid/jni/monodroid-glue.cc @@ -1019,6 +1019,7 @@ MonodroidRuntime::propagate_uncaught_exception (MonoDomain *domain, JNIEnv *env, utils.monodroid_runtime_invoke (domain, method, nullptr, args, nullptr); } +#if DEBUG static void setup_gc_logging (void) { @@ -1027,6 +1028,7 @@ setup_gc_logging (void) log_categories |= LOG_GC; } } +#endif inline int MonodroidRuntime::convert_dl_flags (int flags) @@ -1418,7 +1420,9 @@ MonodroidRuntime::Java_mono_android_Runtime_initInternal (JNIEnv *env, jclass kl init_reference_logging (androidSystem.get_primary_override_dir ()); androidSystem.create_update_dir (androidSystem.get_primary_override_dir ()); +#ifdef DEBUG setup_gc_logging (); +#endif set_debug_env_vars (); #ifndef RELEASE From 47a18b11668d80f274dbeb30774ec52becdc74d7 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Tue, 26 Nov 2019 12:54:20 -0500 Subject: [PATCH 58/66] Revert "Less verbose please" This reverts commit 5e361b2aff5138e18124d49c14df7859e264c605. --- src/monodroid/jni/monodroid-glue-internal.hh | 2 -- src/monodroid/jni/monodroid-glue.cc | 4 ---- 2 files changed, 6 deletions(-) diff --git a/src/monodroid/jni/monodroid-glue-internal.hh b/src/monodroid/jni/monodroid-glue-internal.hh index 1dd73313bf2..6bf765a473e 100644 --- a/src/monodroid/jni/monodroid-glue-internal.hh +++ b/src/monodroid/jni/monodroid-glue-internal.hh @@ -179,7 +179,6 @@ namespace xamarin::android::internal void set_debug_env_vars (void); -#if defined (DEBUG) #if !defined (WINDOWS) int parse_runtime_args (char *runtime_args, RuntimeOptions *options); int monodroid_debug_connect (int sock, struct sockaddr_in addr); @@ -188,7 +187,6 @@ namespace xamarin::android::internal #if !defined (RELEASE) static MonoAssembly* open_from_update_dir (MonoAssemblyName *aname, char **assemblies_path, void *user_data); -#endif #endif private: MonoMethod *registerType = nullptr; diff --git a/src/monodroid/jni/monodroid-glue.cc b/src/monodroid/jni/monodroid-glue.cc index 0d540b4b515..6def97a4b7c 100644 --- a/src/monodroid/jni/monodroid-glue.cc +++ b/src/monodroid/jni/monodroid-glue.cc @@ -1019,7 +1019,6 @@ MonodroidRuntime::propagate_uncaught_exception (MonoDomain *domain, JNIEnv *env, utils.monodroid_runtime_invoke (domain, method, nullptr, args, nullptr); } -#if DEBUG static void setup_gc_logging (void) { @@ -1028,7 +1027,6 @@ setup_gc_logging (void) log_categories |= LOG_GC; } } -#endif inline int MonodroidRuntime::convert_dl_flags (int flags) @@ -1420,9 +1418,7 @@ MonodroidRuntime::Java_mono_android_Runtime_initInternal (JNIEnv *env, jclass kl init_reference_logging (androidSystem.get_primary_override_dir ()); androidSystem.create_update_dir (androidSystem.get_primary_override_dir ()); -#ifdef DEBUG setup_gc_logging (); -#endif set_debug_env_vars (); #ifndef RELEASE From 20a4ef7ff7424bcd3327ad9cc36c5e8f564c4c61 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Tue, 26 Nov 2019 12:54:32 -0500 Subject: [PATCH 59/66] Revert "Enable debug features in release build" This reverts commit 447afa5b56da006dd398e01a924b89bbfd3f8f1a. --- src/monodroid/jni/monodroid-glue-internal.hh | 2 ++ src/monodroid/jni/monodroid-glue.cc | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/src/monodroid/jni/monodroid-glue-internal.hh b/src/monodroid/jni/monodroid-glue-internal.hh index 6bf765a473e..942426640b3 100644 --- a/src/monodroid/jni/monodroid-glue-internal.hh +++ b/src/monodroid/jni/monodroid-glue-internal.hh @@ -177,6 +177,7 @@ namespace xamarin::android::internal static void thread_start (MonoProfiler *prof, uintptr_t tid); static void thread_end (MonoProfiler *prof, uintptr_t tid); +#if defined (DEBUG) void set_debug_env_vars (void); #if !defined (WINDOWS) @@ -184,6 +185,7 @@ namespace xamarin::android::internal int monodroid_debug_connect (int sock, struct sockaddr_in addr); int monodroid_debug_accept (int sock, struct sockaddr_in addr); #endif // !WINDOWS +#endif // DEBUG #if !defined (RELEASE) static MonoAssembly* open_from_update_dir (MonoAssemblyName *aname, char **assemblies_path, void *user_data); diff --git a/src/monodroid/jni/monodroid-glue.cc b/src/monodroid/jni/monodroid-glue.cc index 6def97a4b7c..d00332d068b 100644 --- a/src/monodroid/jni/monodroid-glue.cc +++ b/src/monodroid/jni/monodroid-glue.cc @@ -1019,6 +1019,7 @@ MonodroidRuntime::propagate_uncaught_exception (MonoDomain *domain, JNIEnv *env, utils.monodroid_runtime_invoke (domain, method, nullptr, args, nullptr); } +#if DEBUG static void setup_gc_logging (void) { @@ -1027,6 +1028,7 @@ setup_gc_logging (void) log_categories |= LOG_GC; } } +#endif inline int MonodroidRuntime::convert_dl_flags (int flags) @@ -1140,6 +1142,7 @@ MonodroidRuntime::create_xdg_directories_and_environment (JNIEnv *env, jstring_w create_xdg_directory (homeDir, ".config", "XDG_CONFIG_HOME"); } +#if DEBUG void MonodroidRuntime::set_debug_env_vars (void) { @@ -1166,6 +1169,7 @@ MonodroidRuntime::set_debug_env_vars (void) } utils.monodroid_strfreev (args); } +#endif /* DEBUG */ inline void MonodroidRuntime::set_trace_options (void) @@ -1418,8 +1422,10 @@ MonodroidRuntime::Java_mono_android_Runtime_initInternal (JNIEnv *env, jclass kl init_reference_logging (androidSystem.get_primary_override_dir ()); androidSystem.create_update_dir (androidSystem.get_primary_override_dir ()); +#if DEBUG setup_gc_logging (); set_debug_env_vars (); +#endif #ifndef RELEASE jstr = env->GetObjectArrayElement (externalStorageDirs, 0); From 83fd47408e5744ec48a44f646b83d4fa45845896 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Tue, 26 Nov 2019 12:54:40 -0500 Subject: [PATCH 60/66] Revert "Let's see if we can get more debug output from Mono, to see why it's unhappy" This reverts commit 4aa81c97648417fa07e9237dc37526ebc155af1d. --- .../Xamarin.Forms-Performance-Integration/Droid/Environment.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt b/tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt index d725fedab3b..566f3839478 100644 --- a/tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt +++ b/tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt @@ -1,2 +1 @@ debug.mono.log=gref -debug.mono.env=MONO_LOG_LEVEL=debug From 989fdb8760008b48dc16af3a8f0af47eac1d975f Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Tue, 26 Nov 2019 12:54:48 -0500 Subject: [PATCH 61/66] Revert "Revert "Remove the last month and a half of debug spew"" This reverts commit dc0ceec220270e033fb2076eb3ec3d51cf3ca75d. --- build-tools/scripts/TestApks.targets | 3 +-- src/Mono.Android/Android.Runtime/ConstructorBuilder.cs | 1 - src/Mono.Android/Test/Properties/AndroidManifest.xml | 2 +- .../Tests/Xamarin.ProjectTools/Environment.txt | 1 - .../Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj | 3 --- src/monodroid/jni/osbridge.cc | 1 - .../Droid/Environment.txt | 1 - .../Droid/Properties/AndroidManifest.xml | 4 ++-- .../Droid/Xamarin.Forms.Performance.Integration.Droid.csproj | 4 +--- .../Xamarin.Forms.Performance.Integration.csproj | 2 +- 10 files changed, 6 insertions(+), 16 deletions(-) delete mode 100644 src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Environment.txt delete mode 100644 tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt diff --git a/build-tools/scripts/TestApks.targets b/build-tools/scripts/TestApks.targets index 15d8bbade9f..34bb4f66614 100644 --- a/build-tools/scripts/TestApks.targets +++ b/build-tools/scripts/TestApks.targets @@ -83,7 +83,7 @@ WriteOutputAsMessage="True" /> - - + diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Environment.txt b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Environment.txt deleted file mode 100644 index 566f3839478..00000000000 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Environment.txt +++ /dev/null @@ -1 +0,0 @@ -debug.mono.log=gref diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj index 7cd42319b6d..645a22ec58d 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj @@ -91,9 +91,6 @@ - - - Xamarin.ProjectTools.Resources.Wear.LayoutMain.axml diff --git a/src/monodroid/jni/osbridge.cc b/src/monodroid/jni/osbridge.cc index 173b692725b..b3b72c45d92 100644 --- a/src/monodroid/jni/osbridge.cc +++ b/src/monodroid/jni/osbridge.cc @@ -222,7 +222,6 @@ OSBridge::_write_stack_trace (FILE *to, const char *from) void OSBridge::_monodroid_gref_log (const char *message) { - log_info (LOG_GREF, "%s", message); if (!gref_log) return; fprintf (gref_log, "%s", message); diff --git a/tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt b/tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt deleted file mode 100644 index 566f3839478..00000000000 --- a/tests/Xamarin.Forms-Performance-Integration/Droid/Environment.txt +++ /dev/null @@ -1 +0,0 @@ -debug.mono.log=gref diff --git a/tests/Xamarin.Forms-Performance-Integration/Droid/Properties/AndroidManifest.xml b/tests/Xamarin.Forms-Performance-Integration/Droid/Properties/AndroidManifest.xml index 54d8ff31215..c9182a70c56 100644 --- a/tests/Xamarin.Forms-Performance-Integration/Droid/Properties/AndroidManifest.xml +++ b/tests/Xamarin.Forms-Performance-Integration/Droid/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@  - - + + \ No newline at end of file diff --git a/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj b/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj index c70d7ef31c9..fbc0cc88240 100644 --- a/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj +++ b/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj @@ -44,6 +44,7 @@ true false r8 + True @@ -261,9 +262,6 @@ - - - diff --git a/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj b/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj index c78bcb59194..e2e6ca7a2ee 100644 --- a/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj +++ b/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj @@ -12,4 +12,4 @@ - + \ No newline at end of file From 4f8607e942689be50a159b7ec6de4ec3652705d0 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Mon, 2 Dec 2019 11:01:19 -0500 Subject: [PATCH 62/66] Bump to 6.8.0.61 --- .external | 2 +- Configuration.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.external b/.external index fef7f45b2fc..72570a40307 100644 --- a/.external +++ b/.external @@ -1,2 +1,2 @@ xamarin/monodroid:master@1b907d680cc6561dcfaddc6f997d2f6ff5456644 -mono/mono:2019-10@e9b5aec5ec7801df66117f2da730672ede15dcc6 +mono/mono:2019-10@18920a83f423fb864a2263948737681968f5b2c8 diff --git a/Configuration.props b/Configuration.props index 190d441e91c..5759bf23013 100644 --- a/Configuration.props +++ b/Configuration.props @@ -84,7 +84,7 @@ 6.8.0 6.9.0 True - $(MonoRequiredMinimumVersion).53 + $(MonoRequiredMinimumVersion).61 $(MSBuildThisFileDirectory)external\mono\sdks\out\android-sources\external\linker\src $(MSBuildThisFileDirectory)external\opentk \usr From ed2442bd71176810f509414f2780e724c45470c7 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Mon, 2 Dec 2019 11:02:47 -0500 Subject: [PATCH 63/66] Use new ENABLE, not DISABLE syntax for building Mono SDKs w/o binary SDKs --- .../xaprepare/xaprepare/Steps/Step_BuildMonoRuntimes.Unix.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build-tools/xaprepare/xaprepare/Steps/Step_BuildMonoRuntimes.Unix.cs b/build-tools/xaprepare/xaprepare/Steps/Step_BuildMonoRuntimes.Unix.cs index dcd13c40f57..fff20d9d3bd 100644 --- a/build-tools/xaprepare/xaprepare/Steps/Step_BuildMonoRuntimes.Unix.cs +++ b/build-tools/xaprepare/xaprepare/Steps/Step_BuildMonoRuntimes.Unix.cs @@ -411,8 +411,7 @@ List PrepareMakeArguments (Context context, string workingDirectory, Lis string toolchainsPrefix = Path.Combine (GetProperty (KnownProperties.AndroidToolchainDirectory), "toolchains"); var ret = new List { - "DISABLE_IOS=1", - "DISABLE_MAC=1", + "ENABLE_ANDROID=1", $"CONFIGURATION={Configurables.Defaults.MonoSdksConfiguration}", "IGNORE_PROVISION_MXE=false", "IGNORE_PROVISION_ANDROID=true", From dbef202eead3a36d911b69503633a0de2aaa2775 Mon Sep 17 00:00:00 2001 From: Steve Pfister Date: Mon, 2 Dec 2019 11:27:41 -0500 Subject: [PATCH 64/66] Update HowToBumpMono.md --- Documentation/workflow/HowToBumpMono.md | 167 +++--------------------- 1 file changed, 18 insertions(+), 149 deletions(-) diff --git a/Documentation/workflow/HowToBumpMono.md b/Documentation/workflow/HowToBumpMono.md index b44118a7b07..180f84eda80 100644 --- a/Documentation/workflow/HowToBumpMono.md +++ b/Documentation/workflow/HowToBumpMono.md @@ -1,64 +1,18 @@ # How To Bump Mono -There will eventually be two ways that xamarin-android depends on mono: +Android uses a binary artifcats package from mono that is tied to a specific version / commit. This makes it pretty trivial to bump mono. - 1. Via [source code](#mono-source), or - 2. Via [mono archive](#mono-archive) +The folloing checklist covers what you need to do. Note, if you know the system mono version does not need changed, you can skip the first step. - - - -## Mono Source - -When using mono from source -- which is required for all versions of mono -before the `mono/2018-10` release branch -- the -[`external/mono`](../../external) git submodule reference is used. - -Currently, many parts of the xamarin-android build system *require* the -presence and use of mono source code, including: - - * The [`src/Mono.Posix`](../../src/Mono.Posix) and - [`src/Mono.Data.Sqlite`](../../src/Mono.Data.Sqlite) builds. - * Inclusion of PDB2MDB source code within - [`src/Xamarin.Android.Build.Tasks`](../../src/Xamarin.Android.Build.Tasks). - * Inclusion of networking and related code into - [`src/monodroid`](../../src/monodroid). - -We are working to remove these source dependencies so that we can support using -a [Mono Archive](#mono-archive) in the future. - -Until a Mono Archive *exists* and can be *used*, source code integration must -fulfill the following checklist: - - - [ ] [Update `.gitmodules`](#update-gitmodules). - - [ ] [Update `external/mono` submodule reference](#update-mono-submodule). - [ ] [Update system mono used for the build](#update-system-mono). - - [ ] [Update `MonoAndroid` Profile Assemblies](#update-profile) + - [ ] [Update MonoRequiredDarwinMinimumVersion used in the build](#update-configuration-props). + - [ ] [Update external mono commit in .external](#update-mono-external-commit). - [ ] [Ensure it *builds*](#build). - [ ] [Ensure unit tests *pass*](#unit-tests). - [ ] [Check for API Breakage](#api-validation). - [ ] [Create a Pull Request](#create-pr). - [ ] [Ask for QA Validation](#qa-validation) (***LAST***). - - - -### Update `.gitmodules` - -Update [`.gitmodules`](../../.gitmodules) to refer to the correct mono branch. - - - - -### Update `external/mono` - -Update the git submodule reference that [`external/mono`](../../external) refers to: - - cd external/mono - git checkout BRANCH-NAME - git pull --rebase - - ### Update system mono @@ -71,92 +25,21 @@ These version numbers can be found in [mono's `configure.ac`](https://github.com/mono/mono/blob/master/configure.ac) in the `AC_INIT()` statement. -The `$(_DarwinMonoFramework)` and `%(RequiredProgram.DarwinMinimumUrl)` values -within [`build-tools/dependencies/dependencies.projitems`](../../build-tools/dependencies/dependencies.projitems) -should be updated to corresponds to the version number used in the mono submodule. - -`%(DarwinMinimumUrl)` must be a macOS `.pkg` file and must exist. - -For example, see commit -[606675b5](https://github.com/xamarin/xamarin-android/commit/606675b59f52595e3030c529de4c856fb347edd8): - -```diff -diff --git a/Configuration.props b/Configuration.props -index a2a9c1d1..ec78ddb4 100644 ---- a/Configuration.props -+++ b/Configuration.props -@@ -70,8 +70,8 @@ - $(MSBuildThisFileDirectory)external\Java.Interop - $(MSBuildThisFileDirectory)external\mono -- 5.14.0 -- 5.15.0 -+ 5.16.0 -+ 5.17.0 - True - $(MonoRequiredMinimumVersion).0 - $(MSBuildThisFileDirectory)external\mono\external\linker -diff --git a/build-tools/dependencies/dependencies.projitems b/build-tools/dependencies/dependencies.projitems -index f4a2f60e..1bd5d8c2 100644 ---- a/build-tools/dependencies/dependencies.projitems -+++ b/build-tools/dependencies/dependencies.projitems -@@ -1,7 +1,7 @@ - - - -- <_DarwinMonoFramework>MonoFramework-MDK-5.14.0.141.macos10.xamarin.universal.pkg -+ <_DarwinMonoFramework>MonoFramework-MDK-5.16.0.106.macos10.xamarin.universal.pkg - <_AptGetInstall>apt-get -f -u install - - -@@ -59,7 +59,7 @@ - $(MonoRequiredMaximumVersion) - $(MonoRequiredDarwinMinimumVersion) - $(MSBuildThisFileDirectory)..\scripts\mono-version -- https://xamjenkinsartifact.azureedge.net/build-package-osx-mono/2018-04/116/8ae8c52383b43892fb7a35dbf0992738bd52fa90/$(_DarwinMonoFramework) -+ https://xamjenkinsartifact.azureedge.net/build-package-osx-mono/2018-06/78/341142d7656f43239a041b2c44f00acfb8fa7c59/$(_DarwinMonoFramework) - installer -pkg "$(AndroidToolchainCacheDirectory)\$(_DarwinMonoFramework)" -target / - - -``` - - - - -### Update `MonoAndroid` Profile Assemblies - -[`src/mono-runtimes/ProfileAssemblies.projitems`](../../src/mono-runtimes/ProfileAssemblies.projitems) -has three item groups that may need to be updated: - - * `@(MonoFacadeAssembly)` - * `@(MonoProfileAssembly)` - * `@(MonoTestAssembly)` - -There must be a `@(MonoFacadeAssembly)` entry for every Facade assembly that -must be shipped in the SDK. Facade assemblies are installed into the -`bin/$(Configuration)/lib/xamarin.android/xbuild-frameworks/MonoAndroid/v1.0/Facades` -directory. - -This script uses the contents of `external/mono/sdks/out/android-bcl`, and thus -requires either a local monodroid sdks build, or the extraction of a -[Mono Archive](#mono-archive). - -The `@(MonoProfileAssembly)` item group is for non-Facade assemblies, which are -installed into the -`bin/$(Configuration)/lib/xamarin.android/xbuild-frameworks/MonoAndroid/v1.0` -directory. This item group must be updated whenever a new BCL assembly is added. - -The `@(MonoTestAssembly)` item group contains unit test assemblies, executed by -[`tests/BCL-Tests`](../../tests/BCL-Tests). -The `%(MonoTestAssembly.TestType)` item metadata is the *type* of unit test -assembly; valid values are `xunit` (for xUnit unit test assemblies), -`reference` (for ???), and the empty string/not set (for NUnit assemblies). - - -It should be possible to update `ProfileAssemblies.projitems` by running the -script `build-tools/scripts/gen-ProfileAssemblies.sh`: - - build-tools/scripts/gen-ProfileAssemblies.sh > src/mono-runtimes/ProfileAssemblies.projitems +An example within Configuration.props: + +`6.8.0` + +`6.9.0` + + + +### Update external mono commit in .external + +Updating the commit in this file will pull in the version of mono you want to bump to. +Within [`.external`](../../.external) indicate the mono branch and commit. For example: + +`mono/mono:2019-10@e9b5aec5ec7801df66117f2da730672ede15dcc6` @@ -232,17 +115,3 @@ Asking QA for validation should be done ***last***. Once QA approves, the mono bump PR can be merged. - - - -## Mono Archives - -A "Mono Archive" is a binary package (`.zip` file) which contains *binary* -mono artifacts, *not* source code. - -See also: - - * The [Mono SDKs Integration project](https://github.com/xamarin/xamarin-android/projects/10) - * Commit [f970cd50](https://github.com/xamarin/xamarin-android/commit/f970cd50d2c19dcb4b62cc1dd1198c31cc10a2df) - -TODO. :-) From 0726798bc7780e643a4cf4aacaa3e7712240a226 Mon Sep 17 00:00:00 2001 From: Jonathan Pryor Date: Mon, 2 Dec 2019 21:16:33 -0500 Subject: [PATCH 65/66] Bump to xamarin/xamarin-android-api-compatibility@50a3c52d Go back to master! --- .gitmodules | 2 +- external/xamarin-android-api-compatibility | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 7846385d30b..68edcd73aaa 100644 --- a/.gitmodules +++ b/.gitmodules @@ -37,7 +37,7 @@ [submodule "external/xamarin-android-api-compatibility"] path = external/xamarin-android-api-compatibility url = https://github.com/xamarin/xamarin-android-api-compatibility.git - branch = mono-2019-10 + branch = master [submodule "external/xamarin-android-tools"] path = external/xamarin-android-tools url = https://github.com/xamarin/xamarin-android-tools diff --git a/external/xamarin-android-api-compatibility b/external/xamarin-android-api-compatibility index 6b40592e609..50a3c52db76 160000 --- a/external/xamarin-android-api-compatibility +++ b/external/xamarin-android-api-compatibility @@ -1 +1 @@ -Subproject commit 6b40592e609a9dfa0c3a5d30f9edb14ded0a6dea +Subproject commit 50a3c52db760fa024185b8b580717f173c9f11ed From b72d610d63f5220fedbf4338f3d414ef11e6688d Mon Sep 17 00:00:00 2001 From: Jonathan Pryor Date: Mon, 2 Dec 2019 21:23:52 -0500 Subject: [PATCH 66/66] Add docs for the mono/mono/2019-10 bump --- Documentation/guides/BuildProcess.md | 7 +++++-- Documentation/release-notes/3753.md | 9 +++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 Documentation/release-notes/3753.md diff --git a/Documentation/guides/BuildProcess.md b/Documentation/guides/BuildProcess.md index 43bf0f6b879..219e97b3571 100644 --- a/Documentation/guides/BuildProcess.md +++ b/Documentation/guides/BuildProcess.md @@ -735,12 +735,15 @@ when packaging Release applications. This corresponds to the **Native TLS 1.2+** setting in the Visual Studio property pages. - - `legacy`: Use the historical managed SSL implementation for - network interaction. This *does not* support TLS 1.2. + - `legacy`: In Xamarin.Android v10.1 and earlier, use the historical + managed SSL implementation for network interaction. This *does not* support TLS 1.2. This corresponds to the **Managed TLS 1.0** setting in the Visual Studio property pages. + In Xamarin.Android v10.2 and later, this value is ignored and the + `btls` setting is used. + - `default`: This value is unlikely to be used in Xamarin.Android projects. The recommended value to use instead is the empty string, which corresponds to the **Default** setting in the Visual Studio diff --git a/Documentation/release-notes/3753.md b/Documentation/release-notes/3753.md new file mode 100644 index 00000000000..ba91dbc4f27 --- /dev/null +++ b/Documentation/release-notes/3753.md @@ -0,0 +1,9 @@ +### Bumps to mono/mono/2019-10@18920a83 + +This brings in a multitude of changes. + +TODO: link to Mono release notes for Mono 6.8.0. + +In particular, this updates `Mono.Security.dll` to *remove* support for TLS 1.0. +When the `$(AndroidTlsProvider)` MSBuild property is set to `legacy` or +`default`, the `btls` value will now be used. \ No newline at end of file