Bundle dotnet-script 2.0.1 and give it a roll-forward policy - #2134
Draft
NickJosevski wants to merge 1 commit into
Draft
Bundle dotnet-script 2.0.1 and give it a roll-forward policy#2134NickJosevski wants to merge 1 commit into
NickJosevski wants to merge 1 commit into
Conversation
dotnet-script is framework-dependent and requests Microsoft.NETCore.App 8.0.0 with no rollForward, so on a target with no 8.x runtime it fails to launch with exit 150 before any script runs. Calamari is published self-contained and is unaffected; this is only the separate dotnet-script process. Upgrading does not fix it on its own. 2.0.1's GitHub release zip - the asset IncludeDotNetScript.targets extracts - has a runtimeconfig byte-identical to 1.6.0's. The net10 build exists only in the NuGet package (tools/net10.0), which requests exactly 10.0.0 with no rollForward and would take C# scripts away from every net8-only target. The two changes are orthogonal, so both are here. The zip is vendored byte-for-byte from upstream (sha256 6675357...0e1e13) and the policy is applied by overwriting the extracted runtimeconfig with a file in source control. That keeps the policy reviewable as text and stops it being lost silently the next time the zip is re-vendored, which pre-patching the binary would not. Chose Major over the LatestMajor the decision doc recommends. Major engages only when the requested major is absent, so it fixes the launch failure and moves nobody else. LatestMajor also moves targets that work today, and measurement turned up a cost the decision doc did not account for - see the PR description. Two dotnet-script tests fail on this branch and are left failing deliberately; both are 2.0.1 behaviour changes around --isolated-load-context, not roll-forward, and both want a decision from someone who owns that area. Baseline on main fails four proxy tests already. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes the
WithDotnetRollForwardapproach in #2095, and folds in the 2.0.1 bundle change.Problem
dotnet-script is framework-dependent and requests
Microsoft.NETCore.App 8.0.0with norollForward. Under the defaultMinorpolicy that binds to any 8.x and nothing higher, so on a target with no 8.x runtime it fails to launch (exit 150) before any script runs. Calamari itself is published self-contained and is unaffected — this is only the separate dotnet-script process.Upgrading to 2.0.1 does not fix this on its own. The GitHub release zip — the asset
IncludeDotNetScript.targetsextracts — has a runtimeconfig byte-identical to 1.6.0's. 2.0.1's net10 build exists only in the NuGet package (tools/net10.0), which requests exactly10.0.0with norollForwardand would take C# script steps away from every net8-only target. So both changes are here, because they're orthogonal.Approach
The zip is vendored byte-for-byte from upstream (
sha256 667535727b0660223cfb9dcfc240831d8ca2a2af8f2e98214ee556334e0e1e13, verifiable against the release asset). The policy is applied by overwriting the extracted runtimeconfig withdotnet-script.runtimeconfig.jsonfrom source control.That's deliberate over the two alternatives:
DOTNET_ROLL_FORWARD(Let dotnet-script roll forward to a newer .NET runtime #2095) — no C# change; works on every launch path including Windows'dotnet-script.cmd; doesn't leak into every process a customer's script starts; and config sits below env var and command line in precedence, so a per-step override still works. It also avoids a bug in Let dotnet-script roll forward to a newer .NET runtime #2095:WithDotnetRollForwardintends "don't override an explicit value" but checks only the passed dictionary, neverEnvironment.GetEnvironmentVariable, andSilentProcessRunnerapplies that dictionary over the inherited environment — so a machine-levelDOTNET_ROLL_FORWARDis silently overridden.Why
Majorand notLatestMajorThe decision doc recommends
LatestMajor. I've shippedMajorhere, because measuring it turned up a cost the doc doesn't account for. Measured on a box with 6/8/9/10 installed:MajorLatestMajorLatestMajorgenuinely does what the doc wants. But dotnet-script derives its generated csproj TFM from the loaded corelib, so rolling the host to 10 makes it emitnet10.0— and the restore then needs an SDK that can target net10.0. Underdotnet testthat reds 20 dotnet-script tests withNETSDK1045: The current .NET SDK does not support targeting .NET 10.0.I could not fully isolate whether that's only MSBuild environment leaking from the test host, or whether it also bites a real target with SDK 8 + runtime 10 installed — a plausible shape, and one where scripts work today. Until that's settled,
LatestMajorcan't claim "cannot break a target that works today".Majorfixes the actual reported failure and moves nobody else; switching later is a one-word change plus the test constant.Two failing tests, left failing on purpose
UsingIsolatedAssemblyLoadContext(True)and(False). Baseline onmainalready fails fourDotnetScriptProxyFixtureproxy tests; this branch fails those four plus these two.Both are 2.0.1 behaviour changes around
--isolated-load-context, not roll-forward (they fail withMajor, where the resolved runtime is unchanged frommain):(False)asserts a failure —Could not load file or assembly 'NuGet.Protocol, Version=6.10.1.5'— that no longer happens. It now exits 0. 2.0.1 bundles NuGet 6.14.3 where 1.6.0 bundled 6.10.0.(True)still prints the expectedNuGet.Commands version: 6.10.1.5but no longer producesParameters Parameter0Parameter1.I didn't paper over these.
(False)encodes that isolation is necessary, and if 2.0.1 no longer needs it that's a real signal about assembly isolation that wants a decision from someone who owns this area — not an assertion update from me.Verification
bin/Release/net8.0/dotnet-script/.DotnetScriptRuntimeConfigFixture(2 tests,PlatformAgnostic) guards both failure modes: the copy silently not happening, and a future re-vendor bringing upstream settings the override would clobber.Not addressed
The SDK requirement is unchanged. dotnet-script shells out to
dotnet restoreon every run, even for a script with zero NuGet references, so a runtime-only target has never worked and still doesn't. No roll-forward setting or version bump touches that.🤖 Generated with Claude Code