Skip to content

.NET MAUI seeing lots of new CA1416 warnings #6158

@jonathanpeppers

Description

@jonathanpeppers

Analyzer

Diagnostic ID: CA1416: Validate platform compatibility

Analyzer source

SDK: Built-in CA analyzers in .NET 7 SDK

Version: 7.0.100-rc.2.22457.6

Describe the bug

We started getting many warnings in dotnet/maui, during this bump: dotnet/maui#9968

Going from .NET 7.0.100-rc.1.22425.9 to 7.0.100-rc.2.22457.6

An example:

error CA1416: This call site is reachable on: 'iOS' 10.0 and later, 'maccatalyst' 10.0 and later. 'UIScreen.MaximumFramesPerSecond' is only supported on: 'ios' 10.3 and later, 'maccatalyst' 10.3 and later, 'tvos' 10.2 and later.

https://github.com/dotnet/maui/blob/dcd91ec3954b225664be410660ac0d4ade24fc9a/src/Essentials/src/DeviceDisplay/DeviceDisplay.ios.cs#L21-L23

We don't think that the MaximumFramesPerSecond API changed any attributes, but the CA1416 appeared.

Steps To Reproduce

  1. Build the branch: [net7.0] Update dependencies from xamarin/xamarin-android maui#9968
  2. this provisions a .NET SDK & optional workloads, then builds
  3. See error

Expected behavior

I don't think we should be seeing CA1416 several of the cases I've reviewed.

Actual behavior

We got a lot of CA1416 warnings.

Other info:

Here is a .binlog with several other examples of warnings: logs.zip

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions