Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Developers can follow documentation to resolve Platform Compatibility warnings #44919

Open
2 tasks
jeffhandley opened this issue Nov 19, 2020 · 1 comment
Open
2 tasks
Labels
area-Meta Cost:S Work that requires one engineer up to 1 week documentation Documentation bug or enhancement, does not impact product or test code Priority:3 Work that is nice to have Team:Libraries User Story A single user-facing feature. Can be grouped under an epic.
Milestone

Comments

@jeffhandley
Copy link
Member

jeffhandley commented Nov 19, 2020

Original issue description

The Platform Compatibility Analyzer was introduced in .NET 5.0, raising new diagnostics when APIs are referenced that are unsupported on targeted platforms. These diagnostic messages result in build warnings, but there are no corresponding code fixers in place to automatically address the warnings or illustrate how to do so. Instead, developers must turn to the documentation for the analyzer and the CA1416 diagnostic ID to determine how to handle the warnings.

There are multiple ways to handle the warnings, and each of these could be supplied a possible fixer.

  1. Guard platform-specific APIs with guard methods
  2. Mark call site as platform-specific
  3. Assert the call-site with platform check
  4. Suppress the warning

When developers encounter warnings from the Platform Compatibility analyzer, they can be uncertain which approach is best for resolving the warnings. To aide them we will collect our own best practices and document how we've decided to use each remediation approach in our own code base.

  • Review and document the patterns and practices that are emerging within the runtime code
  • Categorize the patterns into scenarios such that we can document refined guidance for when to use each pattern
@jeffhandley jeffhandley added area-Meta code-fixer Marks an issue that suggests a Roslyn code fixer labels Nov 19, 2020
@jeffhandley jeffhandley added this to the 6.0.0 milestone Nov 19, 2020
@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Nov 19, 2020
@jeffhandley jeffhandley added Priority:1 Work that is critical for the release, but we could probably ship without and removed untriaged New issue has not been triaged by the area owner labels Nov 19, 2020
@marek-safar marek-safar changed the title Implement Code Fixers for Platform Compatibility warnings Developers have easy way to resolve Platform Compatibility warnings Nov 27, 2020
@marek-safar marek-safar added the User Story A single user-facing feature. Can be grouped under an epic. label Nov 27, 2020
@buyaa-n buyaa-n added the Cost:M Work that requires one engineer up to 2 weeks label Jan 14, 2021
@jeffhandley jeffhandley changed the title Developers have easy way to resolve Platform Compatibility warnings Developers can easily resolve Platform Compatibility warnings with a code fixer Jan 21, 2021
@buyaa-n buyaa-n added the help wanted [up-for-grabs] Good issue for external contributors label Apr 5, 2021
@jeffhandley jeffhandley added code-fixer Marks an issue that suggests a Roslyn code fixer and removed code-fixer Marks an issue that suggests a Roslyn code fixer help wanted [up-for-grabs] Good issue for external contributors labels Apr 21, 2021
@jeffhandley
Copy link
Member Author

I talked with @terrajobst about this story and we agreed that we’re not yet to a point where we can confidently define the fixer behaviors. As we have applied more platform annotations throughout the runtime, we’ve been iterating on the patterns and practices we apply. Before we build the fixer, we should:

  • Review and document the patterns and practices that are emerging within the runtime code
  • Categorize the patterns into scenarios such that we can document refined guidance for when to use each pattern
  • Determine if we should implement new SDK features related to assembly-level attributes
  • Implement the feature that allows for custom guard methods that assert platform compatibility
  • Finish annotating the runtime with the new 6.0 platforms
  • Feel comfortable that the annotation/guard method logic fully meets the needs in the runtime repo

Thereafter, we can define which fixes this code fixer would offer in which scenarios, and then implement it.

Based on this status, I’m removing this story from scope for 6.0. But we will meet those preconditions above before 6.0 ships, allowing us to plan the fixer work.

@jeffhandley jeffhandley changed the title Developers can easily resolve Platform Compatibility warnings with a code fixer Developers can follow documentation to resolve Platform Compatibility warnings Jan 22, 2022
@jeffhandley jeffhandley added documentation Documentation bug or enhancement, does not impact product or test code Cost:S Work that requires one engineer up to 1 week Priority:3 Work that is nice to have and removed code-fixer Marks an issue that suggests a Roslyn code fixer Cost:M Work that requires one engineer up to 2 weeks Priority:1 Work that is critical for the release, but we could probably ship without labels Jan 22, 2022
@jeffhandley jeffhandley modified the milestones: Future, 7.0.0 Jan 22, 2022
@jeffhandley jeffhandley modified the milestones: 7.0.0, Future Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Meta Cost:S Work that requires one engineer up to 1 week documentation Documentation bug or enhancement, does not impact product or test code Priority:3 Work that is nice to have Team:Libraries User Story A single user-facing feature. Can be grouped under an epic.
Projects
No open projects
Development

No branches or pull requests

5 participants