Skip to content

Annotate platform-specific implementation assemblies with [SupportedOSPlatform] #41901

@jeffhandley

Description

@jeffhandley

With the introduction of the Platform Compatibility Analyzer and the supporting attributes, we can now mark APIs or assemblies as platform-specific. The analyzer will flag any platform-neutral code that calls into platform-specific code and produce warnings. PR #41760 enabled the analyzer in the runtime repo and it addressed the warnings introduced.

Some of the warnings surfaced in platform-specific implementation assemblies and we suppressed they by using Debug.Assert statements. Ideally, our platform-specific implementation assemblies would be marked with [SupportedOSPlatform] attributes to indicate the specific platform for that assembly. However, we need to be careful not to let those platform-specific attributes get propagated into the corresponding reference assemblies.

This topic came up here: #41760 (comment). We previously had a rough draft attempt of applying the attributes automatically based on the TFM in #41209. We weren't confident in the approach though, so we chose to proceed with #41760 as-is and file this issue for a follow-up investigation to see if there's a better way to accomplish this through assembly-level attributes.

/cc @terrajobst

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions