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 verify their NuGet dependencies compatibility against specific target platform #44920

Open
jeffhandley opened this issue Nov 19, 2020 · 5 comments
Assignees
Labels
area-Meta Cost:XL Work that requires one engineer more than 4 weeks Priority:2 Work that is important, but not critical for the release 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

AB#1255325
The Platform Compatibility Analyzer was introduced in .NET 5.0, raising new diagnostics when APIs are referenced that are unsupported on targeted platforms. At present, this analysis can only be performed as part of compilation, providing an experience for identifying unsupported API calls within the IDE or during a build.

The projects which benefit most from the annotations are large scale solutions with many dependencies which are usually not available as a source code implementation. If the same analysis performed by the Platform Compatibility Analyzer could be performed against binaries, we could further improve the impact of this tooling. The analysis could potentially be integrated with the .NET Portability Analyzer as well, helping those seeking to migrate from .NET Framework to identify not only which APIs are and are not available in .NET 5.0+, but which of those APIs were Windows-specific.

@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 removed the untriaged New issue has not been triaged by the area owner label Nov 19, 2020
@jeffhandley jeffhandley added the Priority:2 Work that is important, but not critical for the release label Nov 19, 2020
@marek-safar marek-safar changed the title Ability to run the platform compatibility analysis on binaries Developers can verify their app NuGet dependencies compatibility against target platform 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
@marek-safar marek-safar changed the title Developers can verify their app NuGet dependencies compatibility against target platform Developers can verify their NuGet dependencies compatibility against specific target platform Nov 27, 2020
@jeffhandley
Copy link
Member Author

@marek-safar and @bruno-garcia -- Do you have any specific scenarios in mind that can be used as acceptance criteria for this story? At present, this is vaguely defined and low-confidence; specific scenarios would help.

@marek-safar
Copy link
Contributor

We have several major scenarios which would benefit from this support greatly and we could come up with more as this can have quite a broad impact.

A few major ones

  • Blaze WASM developers
  • ios/Android developers
  • NativeAOT/SingleExe like scenarios

All of them would benefit from running compact analyzers for all pieces they deploy than for just parts they built from sources.

@jeffhandley jeffhandley self-assigned this Jan 6, 2021
@buyaa-n buyaa-n added the Cost:L Work that requires one engineer up to 4 weeks label Jan 14, 2021
@jeffhandley jeffhandley added Cost:XL Work that requires one engineer more than 4 weeks and removed Cost:L Work that requires one engineer up to 4 weeks labels Jan 22, 2021
@jeffhandley
Copy link
Member Author

In order to study this further, we need to define some concrete scenarios for usage and expectations.

  1. What would the developer be analyzing?
    a. Their source, but analyzing into the NuGet package dependencies they have
    b. A DLL
    c. A NuGet package
  2. Would this analysis happen inside or outside Visual Studio?
  3. How far into NuGet package dependencies would we traverse for analysis?
  4. What actions would we guide developers to take if a warning is discovered within a referenced assembly/package?
  5. Is the ultimate intent to find netcoreapp APIs that are platform-specific, but used in NuGet packages that are platform agnostic?

@terrajobst @marek-safar -- @buyaa-n and I don't know the answers to these questions. Is the following what you had in mind, or were you thinking of something different?

  1. If we're analyzing the developer's code inside Visual Studio
  2. And the reference an API that comes from a NuGet package and that API does not have any [SupportedOSPlatform]/[UnsupportedOSPlatform] attributes applied
  3. But we're able to inspect the API calls made within the API that is being called (recursively) down to netcoreapp (it is unknown how we could do this)
  4. And we find [SupportedOSPlatform]/[UnsupportedOSPlatform] attributes applied that have not been handled by the intermediate NuGet package's API
  5. Then we provide a warning to the developer that the API they are calling might not be supported on their platforms

@marek-safar
Copy link
Contributor

There are multiple scenarios you could build on top of the original requirements. However, the core one is very simple.

A developer is building Blazor/Win/Apple/etc. app and adds a dependency to NuGet to help him solve some of his problems. The NuGet is added to the project and builds successfully. The developer keeps working on the code and after few more iterations, the app suddenly throws PNSE. After some time spent the developer finds out that NuGet is targetting net6.0 but it's not compatible with Blazor/Win/Apple target and has to remove the library and rewrite the code written to use a different library or approach.

@terrajobst
Copy link
Member

@cathysull, FYI this is not gonna make the cut for .NET 6.

@jeffhandley jeffhandley modified the milestones: 6.0.0, Future Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Meta Cost:XL Work that requires one engineer more than 4 weeks Priority:2 Work that is important, but not critical for the release 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

6 participants