Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Xamarin.Android.Build.Tasks] emit XA1040 for experimental runtimes #9834

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 4, 2025

Conversation

jonathanpeppers
Copy link
Member

MonoVM is currently the default (and supported!) runtime for .NET for Android. Emit XA1040 when the user opts into using the experimental runtimes, such as:

  • $(UseMonoRuntime)=false CoreCLR
  • $(PublishAot)=true NativeAOT

If desired, you can opt out of the warning completely with $(AndroidAllowExperimentalRuntime)=true, or use existing MSBuild mechanisms to suppress it.

MonoVM is currently the default (and supported!) runtime for .NET for
Android. Emit `XA1040` when the user opts into using the experimental
runtimes, such as:

* `$(UseMonoRuntime)=false` CoreCLR
* `$(PublishAot)=true` NativeAOT

If desired, you can opt out of the warning completely with
`$(AndroidAllowExperimentalRuntime)=true`, or use existing MSBuild
mechanisms to suppress it.
@jpobst
Copy link
Contributor

jpobst commented Feb 27, 2025

We could also require the user to set this like the runtime does for experimental features:

<PropertyGroup>
    <EnablePreviewFeatures>true</EnablePreviewFeatures>
</PropertyGroup>

@jonathanpeppers
Copy link
Member Author

Right now we have the same Mono.Android.dll for all runtimes, so we can't really use [RequiresPreviewFeatures]:

Are you saying to just use the same property to opt out of the warning?

@jpobst
Copy link
Contributor

jpobst commented Feb 27, 2025

Are you saying to just use the same property to opt out of the warning?

Yeah, it feels like the accepted ".NET way" of doing this would be to always throw this message as an error unless the user sets $(EnablePreviewFeatures).

I realize technically this is a bit different because it's not an API/assembly decorated with [RequiresPreviewFeatures], but it feels like from a user point of view that isn't a meaningful distinction.

The .NET documented standard is $(EnablePreviewFeatures).

Granted, this is bikeshedding over naming, so treat this just as a suggestion. 😉

@jonpryor
Copy link
Member

I like the $(EnablePreviewFeatures) suggestion. Change made, let's see how CI goes.

@jonpryor jonpryor merged commit 87d7b22 into main Mar 4, 2025
58 checks passed
@jonpryor jonpryor deleted the dev/peppers/xa1040 branch March 4, 2025 17:32
jonathanpeppers added a commit that referenced this pull request Mar 4, 2025
…9834)

MonoVM is currently the default (and supported!) runtime for .NET for
Android.  Emit warning XA1040 when the user opts into using the
experimental runtimes, such as:

  * CoreCLR, via `$(UseMonoRuntime)=false`
  * NativeAOT, via `$(PublishAot)=true`

For example:

	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

If desired, you can opt out of the warning completely with
`$(EnablePreviewFeatures)=true`, or use existing MSBuild
mechanisms to suppress it.
@github-actions github-actions bot locked and limited conversation to collaborators Apr 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants