Skip to content
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

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants