Skip to content

CA1416 with guard attributes #7647

Closed
Closed
@rolfbjarne

Description

@rolfbjarne

Analyzer

Diagnostic ID: warning CA1416: This call site is reachable on: 'macOS/OSX', 'tvos' 12.2 and later. 'TestType.GpuRegistryId' is only supported on: 'tvos' 13.0 and later.

Analyzer source

SDK: Built-in CA analyzers in .NET 5 SDK or later

$ .dotnet/dotnet --version
10.0.100-preview.3.25167.3

Describe the bug

Incorrect CA1416 when trying to access API in code block protected using guard attributes.

Steps To Reproduce

Run this unit test: rolfbjarne@3c8fed4

Expected behavior

Unit test should pass

Actual behavior

Unit test fails:

Diagnostics:
// /0/Test0.cs(13,32): warning CA1416: This call site is reachable on: 'macOS/OSX', 'tvos' 12.2 and later. 'TestType.GpuRegistryId' is only supported on: 'tvos' 13.0 and later.

Additional context

This is not fixed by #7569 nor #7644.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions