diff --git a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets index b7a35e2e08d..3701c41be58 100644 --- a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets +++ b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets @@ -73,7 +73,7 @@ None - true + true true 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 d5641a715e9..4f8a42ff111 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 @@ -1687,17 +1687,16 @@ static IEnumerable Get_EnvironmentVariablesData () var ret = new List (); foreach (AndroidRuntime runtime in new[] { AndroidRuntime.CoreCLR, AndroidRuntime.NativeAOT }) { - AddTestData (true, "LowercaseMD5", "", runtime, runtime == AndroidRuntime.CoreCLR); - AddTestData (true, "LowercaseCrc64", "", runtime, false); - AddTestData (false, "", "127.0.0.1:9000,suspend,connect", runtime, false); + AddTestData ("LowercaseMD5", "", runtime, runtime == AndroidRuntime.CoreCLR); + AddTestData ("LowercaseCrc64", "", runtime, false); + AddTestData ("", "127.0.0.1:9000,suspend,connect", runtime, false); } return ret; - void AddTestData (bool useInterpreter, string packageNamingPolicy, string diagnosticConfiguration, AndroidRuntime runtime, bool enableCrashReport) + void AddTestData (string packageNamingPolicy, string diagnosticConfiguration, AndroidRuntime runtime, bool enableCrashReport) { ret.Add (new object[] { - useInterpreter, packageNamingPolicy, diagnosticConfiguration, runtime, @@ -1708,34 +1707,23 @@ void AddTestData (bool useInterpreter, string packageNamingPolicy, string diagno [Test] [TestCaseSource (nameof (Get_EnvironmentVariablesData))] - public void EnvironmentVariables (bool useInterpreter, string packageNamingPolicy, string diagnosticConfiguration, AndroidRuntime runtime, bool enableCrashReport) + public void EnvironmentVariables (string packageNamingPolicy, string diagnosticConfiguration, AndroidRuntime runtime, bool enableCrashReport) { - // NativeAOT supports neither the interpreter nor debug builds, but what we test here is - // environment file creation and contents, and that's relevant to NativeAOT too + // NativeAOT does not support debug builds, but environment file creation and contents are relevant to NativeAOT too. bool isRelease = runtime == AndroidRuntime.NativeAOT; if (IgnoreUnsupportedConfiguration (runtime, release: isRelease)) { return; } - if (runtime == AndroidRuntime.NativeAOT) { - if (packageNamingPolicy == "LowercaseMD5") { - Assert.Ignore ("NativeAOT does not support the 'LowercaseMD5' package naming policy."); - return; - } - - // TODO: investigate and fix this. For some reason, `DOTNET_MODIFIABLE_ASSEMBLIES=Debug` is not - // in the environment variables file - if (useInterpreter && packageNamingPolicy == "LowercaseCrc64" && diagnosticConfiguration == "") { - Assert.Ignore ("NativeAOT doesn't put the DOTNET_MODIFIABLE_ASSEMBLIES=Debug variable in the environment file."); - return; - } + if (runtime == AndroidRuntime.NativeAOT && packageNamingPolicy == "LowercaseMD5") { + Assert.Ignore ("NativeAOT does not support the 'LowercaseMD5' package naming policy."); + return; } var proj = new XamarinAndroidApplicationProject { IsRelease = isRelease, }; proj.SetRuntime (runtime); - proj.SetProperty ("UseInterpreter", useInterpreter.ToString ()); proj.SetProperty ("EnableCrashReport", enableCrashReport.ToString ()); if (!string.IsNullOrEmpty (packageNamingPolicy)) proj.SetProperty ("AndroidPackageNamingPolicy", packageNamingPolicy); @@ -1748,7 +1736,7 @@ public void EnvironmentVariables (bool useInterpreter, string packageNamingPolic var values = new List { "mono.enable_assembly_preload=0", }; - if (useInterpreter) + if (!isRelease) values.Add ("DOTNET_MODIFIABLE_ASSEMBLIES=Debug"); if (!string.IsNullOrEmpty (diagnosticConfiguration)) values.Add ($"DOTNET_DiagnosticPorts={diagnosticConfiguration}"); diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets index 2690ef12a13..a43f1074ca1 100644 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets @@ -1651,7 +1651,7 @@ because xbuild doesn't support framework reference assemblies. <_GeneratedAndroidEnvironment Include="mono.enable_assembly_preload=0" Condition=" '$(AndroidEnablePreloadAssemblies)' != 'True' " /> - <_GeneratedAndroidEnvironment Include="DOTNET_MODIFIABLE_ASSEMBLIES=Debug" Condition=" '$(AndroidIncludeDebugSymbols)' == 'true' and '$(AndroidUseInterpreter)' == 'true' " /> + <_GeneratedAndroidEnvironment Include="DOTNET_MODIFIABLE_ASSEMBLIES=Debug" Condition=" '$(AndroidIncludeDebugSymbols)' == 'true' " /> <_GeneratedAndroidEnvironment Include="DOTNET_DiagnosticPorts=$(DiagnosticConfiguration)" Condition=" '$(DiagnosticConfiguration)' != '' " /> <_GeneratedAndroidEnvironment Include="DOTNET_EnableCrashReport=1" Condition=" '$(EnableCrashReport)' == 'true' and '$(UseMonoRuntime)' != 'true' " /> diff --git a/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs b/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs index 4ff7544eefb..f854e6f70c6 100644 --- a/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs +++ b/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs @@ -2212,7 +2212,7 @@ public void FastDeployEnvironmentFiles ([Values] bool isRelease, [Values] bool e logcatOutput, "The Environment variable \"DOTNET_DiagnosticPorts\" was not set to expected value \"127.0.0.1:9000,connect,nosuspend\"." ); - // NOTE: set when $(UseInterpreter) is true, default for Debug mode + // NOTE: set when $(AndroidIncludeDebugSymbols) is true if (!isRelease) { StringAssert.Contains ( "DOTNET_MODIFIABLE_ASSEMBLIES=Debug",