Skip to content

Nullable enabled problem #7586

@gmck

Description

@gmck

Android application type

Android for .NET (net6.0-android, etc.)

Affected platform version

VS 2022 17.5.0 Prev 1

Description

Over the weekend I converted one of my test apps to net7.0-android33.0. I used the new project technique and then just imported everything from the old project via Add Existing Item. I initially disabled nullable and implicitUsings and then enabled nullable after getting the project to build and deploy successfully.

The only warning I couldn't get rid of was the following

if (Build.VERSION.SdkInt >= BuildVersionCodes.P)
{
                //#pragma warning disable CA1416 // Validate platform compatibility
                Window!.Attributes!.LayoutInDisplayCutoutMode = LayoutInDisplayCutoutMode.Default;
                //#pragma warning restore CA1416 // Validate platform compatibility
}

I could get rid of the pragma by using the [SupportedOSPlatformAttribute("android28.0")] attribute on the function calling the code. However, I don't understand the necessity for either, when the code is already surrounded by the correct Build.VERSION.SdkInt >= BuildVersionCodes.P condition. Why the warning?

A second problem was trying to do the equivalent of <RuntimeIdentifiers>android-arm;android-arm64;</RuntimeIdentifiers> within Application Properties - it doesn't seem possible,

Sample App https://github.com/gmck/NavigationGraph2Net7

Steps to Reproduce

See sample app

Did you find any workaround?

No

Relevant log output

No response

Metadata

Metadata

Labels

Area: App+Library BuildIssues when building Library projects or Application projects.need-attentionA xamarin-android contributor needs to review

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions