-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
SupportedPlatform calculation for platform compatibility analyzer is wrong #71251
Comments
Tagging subscribers to this area: @dotnet/area-infrastructure-libraries Issue DetailsMoving this discussion out from #69980 (comment).
The SDK unconditionally adds supported platforms and one of those is Windows. The SDK itself doesn't make it possible to only target Windows, macOS or Linux via a target platform, but we in dotnet/runtime allow that via the Microsoft.DotNet.TargetFramework.Sdk. Because of that, we would need to remove these unconditionally set Here you can see that the I think we would want the same for Unix and for any other platform. EDIT: To make this dynamic, an msbuild task in the TargetFramework.Sdk would be required that takes the build rid graph (OSGroups.json), TargetFrameworks, TargetFramework and TargetPlatformIdentifier as an input and outputs the SupportedPlatform item to be added. cc @buyaa-n @jeffhandley @ericstj
|
@buyaa-n commented on the related issue:
I tried to explain that in the related issue:
If you would introduce a runtime/src/libraries/System.IO.Compression.ZipFile/src/System.IO.Compression.ZipFile.csproj Line 4 in 911da68
net7.0 as that's required to compose the shared framework.
That would increase the inner builds from two (net7.0-windows, net7.0) to three (net7.0-windows, net7.0-Unix, net7.0). In projects which also ship via packages, you would increase the number of inner builds further, because of net6.0 which would need to follow the same pattern. For that project, we chose Unix to be the default implementation: net7.0. |
@ericstj commented on the PR:
No, in the context of versioning.targets, the TargetPlatformIdentifier property is fully evaluated, that's not the problem. Please see the top post in which I tried to explain the existing issue. |
I see.
Is that enough? Don't we also need to know what items in that set are actual support vs which are PNSEs? I imagine we're trying to apply these SupportedFramework items on the RID-less configuration and the reference assembly so that there is some design time checking of support. One solution could be to evaluate the best Perhaps another way might be to change how we represent PNSEs so that they can be known statically from the outer build (EG: represent them as a list that's a subset of |
@ViktorHofer thanks for the explanation, question: are all TFMs like I assume there is a case for a real cross platform target/assembly, what will be the TFM for that case? |
Problem statement
The platform compatibility analyzer depends on a set of msbuild items as inputs based on the platform exclusion spec.
From the spec:
Based on the spec, the
SupportedPlatform
item defines the list of platforms that the platform compatibility analyzer should warn about.The SDK unconditionally adds supported platforms and one of those is Windows. The SDK itself doesn't make it possible to only target platforms like macOS or Linux via a target platform, but we in dotnet/runtime allow that via the Microsoft.DotNet.TargetFramework.Sdk.
As reported in #69980 (comment), the warnings are currently not correct in certain cases, i.e. when a target framework is platform agnostic.
Here you can see that the
SupportedPlatform
metadata is added for Browser when the platform is Browser, or when it's agnostic and the library doesn't have a Browser specific implementation.I think we would want the same for Unix and for any other platform.
Possible solution
Please see ViktorHofer#2 (my fork, just to get feedback). That logic calculates the SupportedPlatforms items correctly based on the RID graph. This implementation is completely static but solves the noted issues.
To make this dynamic, an msbuild task in the TargetFramework.Sdk would be required that takes the build rid graph (OSGroups.json), TargetFrameworks, TargetFramework and TargetPlatformIdentifier as an input and outputs the SupportedPlatform item to be added.
cc @buyaa-n @jeffhandley @ericstj
The text was updated successfully, but these errors were encountered: