Skip to content

Commit ad0ed28

Browse files
More changes
1 parent 5d40058 commit ad0ed28

File tree

5 files changed

+11
-13
lines changed

5 files changed

+11
-13
lines changed

Documentation/docs-mobile/messages/xa1040.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,23 @@ ms.date: 02/24/2025
88
## Example messages
99

1010
```
11-
warning XA1040: The CoreCLR runtime on Android is an experimental feature and not yet suitable for production use. File issues at: https://github.com/dotnet/android/issues
1211
warning XA1040: The NativeAOT runtime on Android is an experimental feature and not yet suitable for production use. File issues at: https://github.com/dotnet/android/issues
1312
```
1413

1514
## Issue
1615

17-
MonoVM is the default, supported runtime for .NET for Android.
16+
CoreCLR is the default, supported runtime for .NET for Android. Mono is also supported.
1817

19-
Other runtimes are currently experimental, such as:
18+
You can opt into other runtimes via:
2019

21-
* CoreCLR, used via `$(UseMonoRuntime)=false`
20+
* CoreCLR, default
21+
* MonoVM, used via `$(UseMonoRuntime)=true`
2222
* NativeAOT, used via `$(PublishAot)=true`
2323

2424
## Solution
2525

2626
To silence this warning, you can either:
2727

28-
* Use MonoVM by removing `$(UseMonoRuntime)=false` or
29-
`$(PublishAot)=true` from your project file.
28+
* Use CoreCLR by removing `$(PublishAot)=true` from your project file.
3029

3130
* Set `$(EnablePreviewFeatures)` to `true` in your project file.

build-tools/scripts/TestApks.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
<PropertyGroup>
2020
<!-- APK tests might run on 32-bit emulators -->
21-
<RuntimeIdentifiers Condition=" '$(RuntimeIdentifier)' == '' and '$(PublishAot)' != 'true' and '$(UseMonoRuntime)' != 'false' ">android-arm64;android-x86;android-x64;</RuntimeIdentifiers>
21+
<RuntimeIdentifiers Condition=" '$(RuntimeIdentifier)' == '' and '$(PublishAot)' != 'true' and '$(UseMonoRuntime)' == 'true' ">android-arm64;android-x86;android-x64;</RuntimeIdentifiers>
2222
<TestAvdApiLevel Condition=" '$(TestAvdApiLevel)' == '' ">29</TestAvdApiLevel>
2323
<TestAvdAbi Condition=" '$(TestAvdAbi)' == '' and '$(HostOS)' == 'Darwin' and '$(HostOSArchitecture)' == 'Arm64' ">arm64-v8a</TestAvdAbi>
2424
<TestAvdAbi Condition=" '$(TestAvdAbi)' == '' ">x86_64</TestAvdAbi>

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/ProjectExtensions.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,20 @@ public static class ProjectExtensions
77
{
88
/// <summary>
99
/// Sets the appropriate MSBuild property to use a specific .NET runtime.
10-
/// NOTE: $(EnablePreviewFeatures) ignores warning XA1040: The CoreCLR/NativeAOT runtime on Android is an experimental feature and not yet suitable for production use.
10+
/// NOTE: $(EnablePreviewFeatures) ignores warning XA1040: The NativeAOT runtime on Android is an experimental feature and not yet suitable for production use.
1111
/// </summary>
1212
public static void SetRuntime (this XamarinProject project, AndroidRuntime runtime)
1313
{
1414
switch (runtime) {
1515
case AndroidRuntime.CoreCLR:
1616
project.SetProperty ("UseMonoRuntime", "false");
17-
project.SetProperty ("EnablePreviewFeatures", "true");
1817
break;
1918
case AndroidRuntime.NativeAOT:
2019
project.SetProperty ("PublishAot", "true");
2120
project.SetProperty ("EnablePreviewFeatures", "true");
2221
break;
2322
default:
24-
// MonoVM or default can just use default settings
23+
project.SetProperty ("UseMonoRuntime", "true");
2524
break;
2625
}
2726
}

src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved.
570570
<AndroidWarning Code="XA1040"
571571
ResourceName="XA1040"
572572
FormatArguments="$(_AndroidRuntime)"
573-
Condition=" '$(_AndroidRuntime)' != 'MonoVM' and '$(EnablePreviewFeatures)' != 'true' "
573+
Condition=" '$(_AndroidRuntime)' == 'NativeAOT' and '$(EnablePreviewFeatures)' != 'true' "
574574
/>
575575
</Target>
576576

tests/Mono.Android-Tests/Mono.Android-Tests/Mono.Android.NET-Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<WarningsAsErrors>IL2037</WarningsAsErrors>
2323
<AndroidUseNegotiateAuthentication>true</AndroidUseNegotiateAuthentication>
2424
<AndroidNdkDirectory></AndroidNdkDirectory>
25-
<DefineConstants Condition=" '$(UseMonoRuntime)' == 'false' ">$(DefineConstants);CORECLR</DefineConstants>
25+
<DefineConstants Condition=" '$(UseMonoRuntime)' != 'true' ">$(DefineConstants);CORECLR</DefineConstants>
2626
<DefineConstants Condition=" '$(PublishAot)' == 'true' ">$(DefineConstants);NATIVEAOT</DefineConstants>
2727
<!--
2828
TODO: Fix excluded tests
@@ -31,7 +31,7 @@
3131
NetworkInterfaces excluded: https://github.com/dotnet/runtime/issues/75155
3232
-->
3333
<!-- TODO: https://github.com/dotnet/android/issues/10069 -->
34-
<ExcludeCategories Condition=" '$(UseMonoRuntime)' == 'false' ">$(ExcludeCategories):CoreCLRIgnore:SSL:NTLM:RuntimeConfig</ExcludeCategories>
34+
<ExcludeCategories Condition=" '$(UseMonoRuntime)' != 'true' ">$(ExcludeCategories):CoreCLRIgnore:SSL:NTLM:RuntimeConfig</ExcludeCategories>
3535
<!-- TODO: https://github.com/dotnet/android/issues/10079 -->
3636
<ExcludeCategories Condition=" '$(PublishAot)' == 'true' ">$(ExcludeCategories):NativeAOTIgnore:SSL:NTLM:AndroidClientHandler:Export:NativeTypeMap</ExcludeCategories>
3737
<!-- FIXME: LLVMIgnore https://github.com/dotnet/runtime/issues/89190 -->

0 commit comments

Comments
 (0)