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

Add warning about version/distro-specific RID assets in .NET 8+ #32970

Merged
merged 8 commits into from
Jun 10, 2023

Conversation

elinor-fung
Copy link
Member

@elinor-fung elinor-fung commented Jun 1, 2023

To help with the .NET 8 breaking change around no longer looking at version/distro-specific RID assets, we want to add a warning on build when we detect the dependencies that have non-portable-RID-specific assets.

This adds a warning when:

  • targeting net8.0 and higher
  • compat switch (System.Runtime.Loader.UseRidGraph) is not set or not set to true
  • dependencies (based on the generated deps.json) have either runtime or native assets that are RID-specific and not for one of our known portable RIDs.

The link in the message (https://aka.ms/dotnet/rid-usage) currently just points to the breaking change - we will have more doc in the future).

cc @agocke @baronfel @richlander @vitek-karas

Comment on lines 256 to 257
<_ValidRuntimeIdentifierPlatformsForAssets Include="any;freebsd;illumos;linux;linux-bionic;linux-musl;osx;solaris;unix;win" />
<_ValidRuntimeIdentifierPlatformsForAssets Include="android;aot;browser;ios;iossimulator;maccatalyst;tvos;tvossimulator" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How will this work in source build for some custom distro. In my mental model if I create a amazetux distro and setup source build for it, the SDK should allow for a package to have amazetux specific assets for it, right?

Would it make sense to simplify this to basically say that any dot separated identifier is considered non-portable? So ubuntu would still work, but ubuntu.22 would not work. Hmm I guess that's not correct either.
I think we should add the source built native RID into this list then.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should hard-code these RuntimeIdentifiers here. They should probably come from or be generated in the Microsoft.NETCoreSdk.BundledVersions.props file which is created in the installer repo.

Copy link
Member Author

@elinor-fung elinor-fung Jun 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would putting the list in the (generation for) Microsoft.NETCoreSdk.BundledVersions.props also let source-builds append to it? Maybe conditionally adding $(OSName) or $(ProductMonikerRid)? I have not dealt much with how all the redist/generation comes together.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put up dotnet/installer#16578 for adding _KnownRuntimeIdentiferPlatforms items that this will then use.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on discussion with @dsplaisted, switched to making ProcessFrameworkReferences do the processing of known runtime packs and set an output. That should also cover the source-build RID, since it should be part of the runtime pack available RIDs.

Comment on lines 256 to 257
<_ValidRuntimeIdentifierPlatformsForAssets Include="any;freebsd;illumos;linux;linux-bionic;linux-musl;osx;solaris;unix;win" />
<_ValidRuntimeIdentifierPlatformsForAssets Include="android;aot;browser;ios;iossimulator;maccatalyst;tvos;tvossimulator" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should hard-code these RuntimeIdentifiers here. They should probably come from or be generated in the Microsoft.NETCoreSdk.BundledVersions.props file which is created in the installer repo.

@@ -924,4 +924,8 @@ You may need to build the project on another operating system or architecture, o
<value>NETSDK1204: Ahead-of-time compilation is not supported on the current platform '{0}'.</value>
<comment>{StrBegin="NETSDK1204: "}</comment>
</data>
<data name="NonPortableRuntimeIdentifierDetected" xml:space="preserve">
<value>NETSDK1205: Found version-specific or distribution-specific runtime identifier(s): {0}. Affected libraries: {1}. In .NET 8.0 and higher, assets for version-specific and distribution-specific runtime identifiers will not be found by default. See https://aka.ms/dotnet/rid-usage for details.</value>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This aka.ms link should be created before merging this PR. It can point to this PR or the design doc or something similar for now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Currently points to the breaking change notice.

Comment on lines +1000 to +1007
// The actual list comes from BundledVersions.props. For testing, we conditionally add a
// subset of the list if it isn't already defined (so running on an older version)
testProject.AddItem("_KnownRuntimeIdentiferPlatforms",
new Dictionary<string, string>()
{
{ "Include", "unix" },
{ "Condition", "'@(_KnownRuntimeIdentiferPlatforms)'==''" }
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably a good idea to go back and delete this once the installer changes have been merged and flowed into stage 0.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created #33152 so I don't forget this.

Co-authored-by: Daniel Plaisted <dsplaisted@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-NetSDK untriaged Request triage from a team member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants