Skip to content

Incorrect CA1416 warnings #10509

@tipa

Description

@tipa

Android framework version

net10.0-android (Preview)

Affected platform version

NET 10 RC1

Description

After moving from net9.0-android36.0 to net10.0-android, I am seeing new deprecation warnings. SupportedOSPlatformVersion is 24.
All those APIs work without issue even when running on an API 28 / Android 9 device.

warning CA1416: This call site is reachable on: 'Android' 24.0 and later. 'MediaStore.Images.IImageColumns.DateTaken' is unsupported on: 'Android' 29.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
warning CA1416: This call site is reachable on: 'Android' 24.0 and later. 'FrameLayout.Foreground.set' is unsupported on: 'android' 23.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
warning CA1416: This call site is reachable on: 'Android' 24.0 and later. 'FrameLayout.Foreground' is unsupported on: 'Android' 23.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
warning CA1416: This call site is reachable on: 'Android' 24.0 and later. 'MediaStore.Video.IVideoColumns.DateTaken' is unsupported on: 'Android' 29.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
warning CA1416: This call site is reachable on: 'Android' 24.0 and later. 'ListView.Adapter.set' is unsupported on: 'android' 1

Steps to Reproduce

new FrameLayout(this).Foreground = null;
new ListView(this).Adapter = null;

// these do not cause errors in a Java Android project
// using those stat below API 29 works without problem
// likely related: https://stackoverflow.com/questions/64376737 
var a = MediaStore.Video.IVideoColumns.DateTaken;
var b = MediaStore.Images.IImageColumns.DateTaken;

Download an run example project: New folder (3).zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: App+Library BuildIssues when building Library projects or Application projects.needs-triageIssues that need to be assigned.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions