Skip to content

Simplify RID graph: keep floating and last versioned RIDs#125076

Open
richlander wants to merge 1 commit intomainfrom
simplify-rid-graph-soft
Open

Simplify RID graph: keep floating and last versioned RIDs#125076
richlander wants to merge 1 commit intomainfrom
simplify-rid-graph-soft

Conversation

@richlander
Copy link
Member

Replaces: #123161

Softer approach to RID graph simplification. Instead of removing all versioned and distro-specific RIDs, this keeps:

  • All portable/base RIDs (any, unix, linux, win, etc.)
  • All floating (unversioned) OS RIDs (alpine, ubuntu, osx, etc.)
  • The last versioned RID for each OS family and its arch variants

This reduces runtime.json from ~4600 lines (798 RIDs) to ~1500 lines (266 RIDs) while preserving a migration path for packages that reference the most recent versioned RIDs.

We can do more cleanup later. This approach is a much safer starting point with easier migration guidance. It's also more defensible.

Removed RIDs: all intermediate versioned RIDs (e.g. alpine.3.7 through alpine.3.17, ubuntu.14.04 through ubuntu.23.04, osx.10.10 through osx.12, etc.)

Kept last versions include: alpine.3.18, android.32, centos.9, debian.12, fedora.39, freebsd.13, ios.15, osx.13, rhel.9, rocky.9, tizen.7.0.0, tvos.15, ubuntu.23.10, and others.

Softer approach to RID graph simplification. Instead of removing all
versioned and distro-specific RIDs, this keeps:

- All portable/base RIDs (any, unix, linux, win, etc.)
- All floating (unversioned) OS RIDs (alpine, ubuntu, osx, etc.)
- The last versioned RID for each OS family and its arch variants

This reduces runtime.json from ~4600 lines (798 RIDs) to ~1500 lines
(266 RIDs) while preserving a migration path for packages that reference
the most recent versioned RIDs.

Removed RIDs: all intermediate versioned RIDs (e.g. alpine.3.7 through
alpine.3.17, ubuntu.14.04 through ubuntu.23.04, osx.10.10 through
osx.12, etc.)

Kept last versions include: alpine.3.18, android.32, centos.9,
debian.12, fedora.39, freebsd.13, ios.15, osx.13, rhel.9, rocky.9,
tizen.7.0.0, tvos.15, ubuntu.23.10, and others.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 2, 2026 20:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.

@richlander
Copy link
Member Author

richlander commented Mar 2, 2026

@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @agocke, @jeffschwMSFT, @elinor-fung
See info in area-owners.md if you want to be subscribed.

@ericstj
Copy link
Member

ericstj commented Mar 2, 2026

What have you done to test this? Did you consider making this change in the VMR so that we can see if source build and phase2 product build are happy with the changes?

@richlander
Copy link
Member Author

Great questions. I haven't done anything to test it. My belief/understanding is that the fallout is compat. I can make this change in VMR. That didn't occur to me. My thinking -- perhaps naive -- is that any break there is a bug that needs to be fixed downstream. I'll apply this change to VMR.

richlander pushed a commit to dotnet/dotnet that referenced this pull request Mar 2, 2026
Softer approach to RID graph simplification. Instead of removing all
versioned and distro-specific RIDs, this keeps:

- All portable/base RIDs (any, unix, linux, win, etc.)
- All floating (unversioned) OS RIDs (alpine, ubuntu, osx, etc.)
- The last versioned RID for each OS family and its arch variants

This reduces runtime.json from ~4600 lines (798 RIDs) to ~1500 lines
(266 RIDs) while preserving a migration path for packages that reference
the most recent versioned RIDs.

Backport of dotnet/runtime#125076

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ericstj
Copy link
Member

ericstj commented Mar 2, 2026

Great questions. I haven't done anything to test it. My belief/understanding is that the fallout is compat. I can make this change in VMR. That didn't occur to me. My thinking -- perhaps naive -- is that any break there is a bug that needs to be fixed downstream. I'll apply this change to VMR.

It should be, but we might want to get that signal now. I think the VMR can give at least a sampling of those it won't run the SDK tests which I think might be equally valuable, but we don't have a good way to do that in PR.

I don't have any objections to the PR itself, it's more "what's the fallout". I trust its well formed, but I am not reviewing for that. We used to have a generator for this that made it a bit easier to review the changes to the generator inputs.

@richlander
Copy link
Member Author

Understood. We're on the same page.

@tmds
Copy link
Member

tmds commented Mar 3, 2026

this keeps:
All floating (unversioned) OS RIDs (alpine, ubuntu, osx, etc.)
The last versioned RID for each OS family and its arch variants

I'd consider removing these too.

The "modern" rid handling for a non-portable SDK depends on:

    "fedora.42-x64": [
      "linux-x64",
      "linux",
      "unix-x64",
      "unix",
      "any",
      "base"
    ]

@ericstj
Copy link
Member

ericstj commented Mar 3, 2026

I shared some data offline to show what packages are using the RIDs being discussed here. That provides a view of the producer side - we can't know what people use when building apps (consumer side) but a review of that data might help understand the compat impact of removing RIDs that might be used during restore.

@richlander
Copy link
Member Author

This proposal is on top of this break that we made 3 years ago: dotnet/docs#36466

That break has a workaround. You can see it in use: https://grep.app/search?q=%3CUseRidGraph%3Etrue%3C%2FUseRidGraph%3E

The use of UseRidGraph suggests that the original change would have been too breaking.

@am11
Copy link
Member

am11 commented Mar 3, 2026

My understanding is; with Microsoft SDK:

  1. PortableRuntimeIdentifierGraph.json is used by default
  2. runtime.json is used as a fallback for < .NET8 SDKs or when user specifies UseRidGraph=true (so it is set-in-stone / considered immutable)
  3. There is an override RuntimeIdentifierGraphPath where user can provide their custom graph.

Distro maintainers use 3rd option (graph gets generated during the source-bulid).

If this is correct, then we don't need to change runtime.json for older/outdated SDK deployments to keep working. Otherwise, I misunderstood. 🙂

cc @elinor-fung

@richlander
Copy link
Member Author

The intent is to remove cruft from the product. The RID file is basically a wikipedia of old distros. I'd like to eventually delete the file. I grasp, as you are suggesting, that its also enable compatibility for old assets on nuget.org, otherise they are basically unusable. Consumers can either use old SDKs, insert their own RID graph, or user a newer version. Some of the libraries may be abandoned. It's OK to have to take extra steps to use abandoned software.

@richlander
Copy link
Member Author

Here is the data we collected, sorted by package count with a cutoff at 10 packages. The primary data I see is that we should consider bringing some Ubuntu RIDs back. On that note, I see that Ubuntu 23.10 is the latest/retained Ubuntu RID. That's not super useful. If we follow the data, we could replace 23.10 with 18.04 and that would solve most of the problem.

RID Packages TotalDownloads
win-x64 2619 207237330
win 2049 19292274122
win-x86 1829 177109693
linux-x64 1708 129237714
unix 1123 7254257098
osx-x64 1098 49230613
win-arm64 823 10471924
linux-arm64 632 82847442
win10-x64 590 11712306
osx 569 592532030
win10-x86 558 11400902
linux-arm 482 77527334
win10-arm 460 8308597
osx-arm64 450 11622264
linux-musl-x64 352 6193593
win-arm 349 62507883
linux-x86 276 9332247
alpine-x64 239 1957557
win7-x64 196 9761981
browser 188 52817835
linux 179 422141284
linux-armel 170 62772107
linux-musl-arm64 156 1505670
win7-x86 150 8884912
win10-arm64 148 1613561
linux-musl-arm 148 1319978
ubuntu.18.04-x64 143 1731579
rhel-x64 140 879046
fedora-x64 137 1093005
debian.9-x64 130 1636565
alpine.3.9-x64 102 819572
debian-arm64 97 814104
ubuntu.16.04-arm64 97 814104
linux-mips64 84 277434
android-arm64 78 8947188
maccatalyst-x64 71 6129705
maccatalyst-arm64 70 5851291
android-x64 69 8941814
linux-s390x 67 255760
android-arm 66 8878358
android-x86 61 8881581
browser-wasm 60 105415377
ios 51 1631429
freebsd 48 1499857
any 46 527589
native1.12-tchmi 44 6013105
win8-arm 44 656478
linux-ppc64le 37 237069
win81-x64 34 162713
win81-x86 34 161137
ubuntu.16.04-x64 32 1885962
ios-arm64 31 8446030
tvos 31 1037541
win8-x64 30 184919
win8-x86 30 179797
iossimulator-x64 27 8675284
illumos 27 972741
solaris 27 972741
alpine-arm64 27 70014
alpine-arm 26 63432
iossimulator-arm64 25 8406514
aot 23 5585530322
debian-x64 23 128315
x64 21 307951
ios-arm 20 14353065
tvos-arm64 20 512633
tvossimulator-x64 20 472887
centos-x64 19 175450
ubuntu.20.04-x64 18 262325
ios-armv7s 17 52958
ubuntu.14.04-x64 16 6031
osx-64 15 51277
win7-arm 15 12699
models 15 6303
win7 14 540652238
osx.10.10-x64 14 164277
arm64 14 11382
osx-universal 14 8509
native 13 17253297
x86 13 297447
win81-arm 13 223363
linux-64 13 54125
debian.8-x64 12 187855
rhel.7-x64 11 791721
opensuse-x64 11 248293
fedora.23-x64 10 5948
opensuse.13.2-x64 10 5948

@tmds
Copy link
Member

tmds commented Mar 4, 2026

runtime.json is used as a fallback for < .NET8 SDKs or when user specifies UseRidGraph=true

Ah, yes.

I think users should use APIs like NativeLibrary.SetDllImportResolver instead of UseRidGraph.

It doesn't seem a mechanism that is relied on for splitting nuget packages either. Searching for latest Ubuntu LTS shows only 7 packages (by 5 users): https://www.nuget.org/packages?q=ubuntu.24.04-x64.

@richlander
Copy link
Member Author

That's a good point. As I hinted at, my hope would be to make this change for 11 and the delete most of the infra for 12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants