Skip to content

.NET 8 preview 7's illink runs with preview 6 if preview 6 is installed #90015

Closed

Description

@rolfbjarne

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:

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:

Screenshot 2023-08-04 at 14 21 18

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

  1. ghost added
    untriaged
    on Aug 4, 2023
  2. rolfbjarne commented on Aug 4, 2023

    @rolfbjarne
    MemberAuthor
  3. rolfbjarne commented on Aug 4, 2023

    @rolfbjarne
    MemberAuthor

    There's an illink.runtimeconfig.json (thanks @jonathanpeppers!).

    
    $ cat ~/.nuget/packages/microsoft.net.illink.tasks/8.0.0-preview.7.23375.6/tools/net8.0/illink.runtimeconfig.json
    {
      "runtimeOptions": {
        "tfm": "net8.0",
        "rollForward": "Major",
        "framework": {
          "name": "Microsoft.NETCore.App",
          "version": "8.0.0-preview.6.23329.7"
        },
        "configProperties": {
          "System.GC.Server": true,
          "System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
          "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
        }
      }
    }
    
  4. jeffschwMSFT commented on Aug 4, 2023

    @jeffschwMSFT
    Member

    adding @vitek-karas and @elinor-fung for roll forward policy

  5. vitek-karas commented on Aug 4, 2023

    @vitek-karas
    Member

    The linker uses NetCoreAppToolCurrent as 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

  6. sbomer commented on Aug 4, 2023

    @sbomer
    Member

    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.

  7. elinor-fung commented on Aug 4, 2023

    @elinor-fung
    Member

    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.

    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.

  8. ghost added
    in-pr
    on Aug 8, 2023
  9. ghost removed
    in-pr
    on Aug 10, 2023
  10. ghost removed
    untriaged
    on Aug 10, 2023
  11. sbomer commented on Aug 14, 2023

    @sbomer
    Member

    @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.

  12. rolfbjarne commented on Aug 15, 2023

    @rolfbjarne
    MemberAuthor

    @rolfbjarne do you have any more info around the impact this behavior had on your scenario?

    It completely breaks us when it happens.

    (How did you discover the issue?)

    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).

    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.

    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).

  13. vitek-karas commented on Aug 15, 2023

    @vitek-karas
    Member

    Note that this happens because preview 6 fails to load/run (at least some) assemblies built with preview 7.

    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).

  14. rolfbjarne commented on Aug 15, 2023

    @rolfbjarne
    MemberAuthor

    I assume it's one of the custom step assemblies iOS uses, right?

    Correct. Our custom step assembly is built with preview 7, and things broke when executing that assembly using preview 6.

  15. ghost locked as resolved and limited conversation to collaborators on Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions