Repository navigation
Description
Description
As description: .NET 8 preview 7's illink runs with preview 6 if preview 6 is installed
Reproduction Steps
Install preview 6 and preview 7:
- https://download.visualstudio.microsoft.com/download/pr/6672a02f-48fd-4f4b-80cd-ed58f8a59f85/112dc40e791e651a818780d5054622f0/dotnet-sdk-8.0.100-preview.6.23330.14-osx-x64.pkg
- https://dotnetbuilds.azureedge.net/public/Sdk/8.0.100-preview.7.23376.3/dotnet-sdk-8.0.100-preview.7.23376.3-osx-x64.pkg
Run illink.dll manually:
/usr/local/share/dotnet/dotnet ~/.nuget/packages/microsoft.net.illink.tasks/8.0.0-preview.7.23375.6/tools/net8.0/illink.dll --help
illink.dll is now executed with preview 6, even if preview 7 is the current .NET:
$ dotnet --version
8.0.100-preview.7.23376.3
The simplest way I found to actually determine which .NET version is loaded is to use dotnet-trace to collect a trace and look at the loaded assemblies (the original test case is to create an iOS project, build it, and have illink.dll crash with an inexplicable exception):
dotnet-trace collect --providers Microsoft-Windows-DotNETRuntime:4 -- /usr/local/share/dotnet/dotnet ~/.nuget/packages/microsoft.net.illink.tasks/8.0.0-preview.7.23375.6/tools/net8.0/illink.dll --help
Example result:
dotnet_20230804_141326.nettrace.zip
Screenshot for the curious:
Expected behavior
illink.dll executes with .NET 8 preview 7.
Actual behavior
illink.dll executes with .NET 8 preview 6.
Regression?
Yes.
Known Workarounds
Remove preview 6.
Deleting the following directory seems to be enough:
/usr/local/share/dotnet/shared/Microsoft.NETCore.App/8.0.0-preview.6.23329.7
I also tried forcing the exact version in a global.json:
{
"sdk": {
"version": "8.0.100-preview.7.23376.3",
"rollforward": "disable"
}
}That did not work.
Configuration
$ $ dotnet --info
.NET SDK:
Version: 8.0.100-preview.7.23376.3
Commit: daebeea8ea
Runtime Environment:
OS Name: Mac OS X
OS Version: 13.5
OS Platform: Darwin
RID: osx.13-x64
Base Path: /usr/local/share/dotnet/sdk/8.0.100-preview.7.23376.3/
.NET workloads installed:
[macos]
Installation Source: SDK 8.0.100-preview.7
Manifest Version: 13.3.8694-net8-p7/8.0.100-preview.7
Manifest Path: /usr/local/share/dotnet/sdk-manifests/8.0.100-preview.7/microsoft.net.sdk.macos/WorkloadManifest.json
Install Type: FileBased
[ios]
Installation Source: SDK 8.0.100-preview.7
Manifest Version: 16.4.8694-net8-p7/8.0.100-preview.7
Manifest Path: /usr/local/share/dotnet/sdk-manifests/8.0.100-preview.7/microsoft.net.sdk.ios/WorkloadManifest.json
Install Type: FileBased
[maccatalyst]
Installation Source: SDK 8.0.100-preview.7
Manifest Version: 16.4.8694-net8-p7/8.0.100-preview.7
Manifest Path: /usr/local/share/dotnet/sdk-manifests/8.0.100-preview.7/microsoft.net.sdk.maccatalyst/WorkloadManifest.json
Install Type: FileBased
[maui]
Installation Source: SDK 8.0.100-preview.7
Manifest Version: 8.0.0-preview.7.8842/8.0.100-preview.7
Manifest Path: /usr/local/share/dotnet/sdk-manifests/8.0.100-preview.7/microsoft.net.sdk.maui/WorkloadManifest.json
Install Type: FileBased
[tvos]
Installation Source: SDK 8.0.100-preview.7
Manifest Version: 16.4.8694-net8-p7/8.0.100-preview.7
Manifest Path: /usr/local/share/dotnet/sdk-manifests/8.0.100-preview.7/microsoft.net.sdk.tvos/WorkloadManifest.json
Install Type: FileBased
[android]
Installation Source: SDK 8.0.100-preview.7
Manifest Version: 34.0.0-preview.7.382/8.0.100-preview.7
Manifest Path: /usr/local/share/dotnet/sdk-manifests/8.0.100-preview.7/microsoft.net.sdk.android/WorkloadManifest.json
Install Type: FileBased
Host:
Version: 8.0.0-preview.7.23375.6
Architecture: x64
Commit: 65b696cf5e
RID: osx-x64
.NET SDKs installed:
8.0.100-preview.6.23330.14 [/usr/local/share/dotnet/sdk]
8.0.100-preview.7.23376.3 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.0-preview.6.23329.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.0-preview.7.23375.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.0-preview.6.23329.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.0-preview.7.23375.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
Other information
No response
Activity
rolfbjarne commentedon Aug 4, 2023
CC @lewing @Redth @dsplaisted @dalexsoto
rolfbjarne commentedon Aug 4, 2023
There's an illink.runtimeconfig.json (thanks @jonathanpeppers!).
jeffschwMSFT commentedon Aug 4, 2023
adding @vitek-karas and @elinor-fung for roll forward policy
vitek-karas commentedon Aug 4, 2023
The linker uses
NetCoreAppToolCurrentas the TFM - just like many other tools in the runtime repo. For example, crossgen and ilc are using the same TFM as well - it's just not as obvious in their cases since we ship them as AOTed.Also note that linker has RollForward=Major so it will run on pretty much any runtime newer then that.
I'm curious, why do you think this is a problem? When we build linker in the runtime repo we're using the SDK for it (not live built runtime) - so it is built against Preview 6 binaries, and it can run on Preview 6 and above.
/cc @sbomer
sbomer commentedon Aug 4, 2023
I believe this changed with dotnet/sdk#29441 - we used to ship ILLink as part of the SDK, which would overwrite the runtimeconfig.json to match the runtime version included in that SDK build.
I can see how this would be unexpected behavior. If I install a preview N SDK, I'd expect all of the tools used by that SDK to run on the same runtime version included with that preview, not an earlier one. The AOT'd tools at least won't change based on what's installed.
If this is a problem, maybe we can ship illink's runtimeconfig.json with a version that matches the current runtime instead of the runtime version from the SDK used to build illink.
elinor-fung commentedon Aug 4, 2023
For release vs pre-release, I feel like it may cross from unexpected to more of a problem. For example, in the current state, the ILLink for 8.0 RTM would have RC2 as its version, which means that if a user has RC2 installed, we're running ILLink on a pre-release version of .NET.
sbomer commentedon Aug 14, 2023
@rolfbjarne do you have any more info around the impact this behavior had on your scenario? (How did you discover the issue?) The fix makes it harder to consume the latest ILLink package with an older SDK, which runtime is doing (see #90517). I still intend to move forward with the fix, but would like to evaluate the impact in case we wanted to roll it back.
rolfbjarne commentedon Aug 15, 2023
It completely breaks us when it happens.
No iOS project would build (it took a while to figure out what was going on though, because having to install 2 different .NET versions to reproduce something isn't very obvious).
Note that this happens because preview 6 fails to load/run (at least some) assemblies built with preview 7. This means that if whatever .NET version ILLink is built for (and potentially used to execute it) is forward-compatible with the .NET version the developer is using to build their project, then nothing bad will happen. Otherwise all builds will break... (as long as both .NET versions are installed).
vitek-karas commentedon Aug 15, 2023
No assemblies from illink itself should have this problem - since in this case illink was built targeting preview 6. I assume it's one of the custom step assemblies iOS uses, right?
(We're just trying to understand what the actual problem is, so that we can come up with a robust solution - since as mentioned by Sven above, so far neither is exactly clean).
rolfbjarne commentedon Aug 15, 2023
Correct. Our custom step assembly is built with preview 7, and things broke when executing that assembly using preview 6.