NuGet / NuGetGallery

NuGet Gallery is a package repository that powers https://www.nuget.org. Use this repo for reporting NuGet.org issues.
https://www.nuget.org/
Apache License 2.0
1.55k stars 643 forks source link

OS compatibility/portability information #7079

Open 2E0PGS opened 5 years ago

2E0PGS commented 5 years ago

Would it be possible to implement a info section for OS compatibility/portability for packages on the NuGet gallery website.

This information would be provided by community feedback or the original package developer upon submission. There is some way of scanning libraries for calls to platform specific APIs also.

For example one library may reference win32 API specific stuff which doesn't work on Linux even though the library maybe targeting a cross-platform framework or so.

Currently the consumers have to trial and error test or we rely on documentation from the developer on their Github.

Just an idea. I will try find more examples of this.

Related MS docs: https://docs.microsoft.com/en-us/dotnet/standard/native-interop/ https://docs.microsoft.com/en-us/uwp/win32-and-com/win32-and-com-for-uwp-apps

Example of platform specific libraries that may catch people out: https://www.hanselman.com/blog/HowDoYouUseSystemDrawingInNETCore.aspx

Alternative FOSS cross platform library: https://github.com/SixLabors/ImageSharp

skofman1 commented 5 years ago

@anangaur

2E0PGS commented 4 years ago

Perhaps this is like Microsoft.DotNet.Analyzers.Compatibility which seems to be a new preview package. Can't we apply something like this to automatically perform static analysis on nuget packages and display this information on the nuget package information when browsing.

anangaur commented 4 years ago

With .NET 5, I am assuming packages will be able to state the supported platform in a much more concrete way than today (RIDs). Tagging @terrajobst for his thoughts on this.

2E0PGS commented 4 years ago

https://docs.microsoft.com/en-us/dotnet/standard/analyzers/portability-analyzer https://docs.microsoft.com/en-us/dotnet/standard/analyzers/platform-compat-analyzer https://docs.microsoft.com/en-us/dotnet/standard/analyzers/api-analyzer

A few more relevant links.

.NET 5 may help this but there is lots before we can get there. Many packages will have hidden platform specific win32 API calls or other non portable code. I guess UWP falls into this too.

Or as you state we rely on some concrete way for devs to state it's portable. Although thats subject to their interpretation of portable. I guess VS tools mayble able to do static analysis if MS implemented something along those lines.

Alternatively there could be a new class library type which forces fully portable APIs within .NET 5.

2E0PGS commented 4 years ago

For example today I need to use: https://www.nuget.org/packages/System.IO.Ports/

I have no way of knowing if this works on Linux without trying it myself (which becomes tedious) or Googling it. I did the latter and found: https://www.hackster.io/sxwei123/serial-communication-with-net-core-3-0-on-rpi-linux-0f2ed4

This doesn't seem like a great way of doing things. Googling each NuGet package. So ideally either NuGet gallery can implement the static analysis or MS provide some method for the package to describe it's platform portability/support. Ideally with some static analysis on client side VS to ensure that's correct.

anangaur commented 4 years ago

/cc: @JonDouglas