-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Microsoft.NET.ILLink.Tasks in .NET 8 does not target .NET 8 #82241
Comments
Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov Issue DetailsDescriptionThe Microsoft.NET.ILLink.Tasks NuGet in .NET 8 preview 1 does not target .NET 8, causing problems for custom linker steps when they are built with .NET 8. Reproduction StepsFollow the instructions here: https://gist.github.com/jonathanpeppers/99961b4639823206c2537c03c856b097, except:
Create a new maui project and try to build it: $ dotnet new maui
$ dotnet build -f net8.0-ios Expected behaviorSuccessful build. Actual behaviorBuild failure:
Regression?Yes Known WorkaroundsRemove .NET 7. Configuration.NET 8.0.100-preview.1.23115.2 Other informationIt's because this NuGet: https://dev.azure.com/dnceng/public/_artifacts/feed/dotnet8/NuGet/Microsoft.NET.ILLink.Tasks/versions/8.0.100-1.23067.1 is built for .NET 7: $ unzip -l /Users/rolf/Downloads/microsoft.net.illink.tasks.8.0.100-1.23067.1.nupkg
Archive: /Users/rolf/Downloads/microsoft.net.illink.tasks.8.0.100-1.23067.1.nupkg
Length Date Time Name
--------- ---------- ----- ----
520 01-17-2023 18:35 _rels/.rels
977 01-17-2023 18:35 Microsoft.NET.ILLink.Tasks.nuspec
39872 01-17-2023 18:35 tools/net472/ILLink.Tasks.dll
421328 01-17-2023 18:34 tools/net472/Mono.Cecil.dll
20856 02-19-2020 10:05 tools/net472/System.Buffers.dll
189312 10-19-2020 18:37 tools/net472/System.Collections.Immutable.dll
141184 02-19-2020 10:05 tools/net472/System.Memory.dll
115856 05-15-2018 13:29 tools/net472/System.Numerics.Vectors.dll
462728 10-19-2020 18:45 tools/net472/System.Reflection.Metadata.dll
16768 10-19-2020 18:46 tools/net472/System.Runtime.CompilerServices.Unsafe.dll
721296 01-17-2023 18:35 tools/net7.0/illink.dll
40376 01-17-2023 18:35 tools/net7.0/ILLink.Tasks.dll
421328 01-17-2023 18:34 tools/net7.0/Mono.Cecil.dll
103888 01-17-2023 18:35 tools/net7.0/Mono.Cecil.Pdb.dll
6822 01-17-2023 18:35 tools/net7.0/illink.deps.json
324 01-17-2023 18:35 tools/net7.0/illink.runtimeconfig.json
24890 01-17-2023 18:35 tools/net7.0/ILLink.Tasks.deps.json
783 01-17-2023 18:33 Sdk/Sdk.props
1451 01-17-2023 18:33 build/Microsoft.NET.ILLink.Tasks.props
21256 01-17-2023 18:33 build/Microsoft.NET.ILLink.targets
10806 01-17-2023 18:33 build/6.0_suppressions.xml
7006 12-30-2022 18:15 Icon.png
787 01-17-2023 18:35 [Content_Types].xml
664 01-17-2023 18:35 package/services/metadata/core-properties/c7cfde231f344fc9b00bdaf0b59aea91.psmdcp
11403 01-17-2023 10:38 .signature.p7s
--------- -------
2782481 25 files and our custom linker steps are built using .NET 8, thus things go wrong when the .NET 7 version of illink.dll (running on .NET 7) tries to load the custom linker steps built with .NET 8 (and this is also why having .NET 7 installed is required to reproduce the problem: if .NET 7 is not installed, illink.dll will be executed with .NET 8, and everything works).
|
…work around the fact that the linker is still a .NET 7 app. Hopefully works around dotnet/runtime#82241.
@rolfbjarne does it block P1 for you? |
Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas Issue DetailsDescriptionThe Microsoft.NET.ILLink.Tasks NuGet in .NET 8 preview 1 does not target .NET 8, causing problems for custom linker steps when they are built with .NET 8. Reproduction StepsFollow the instructions here: https://gist.github.com/jonathanpeppers/99961b4639823206c2537c03c856b097, except:
Create a new maui project and try to build it: $ dotnet new maui
$ dotnet build -f net8.0-ios Expected behaviorSuccessful build. Actual behaviorBuild failure:
Regression?Yes Known WorkaroundsRemove .NET 7. Configuration.NET 8.0.100-preview.1.23115.2 Other informationIt's because this NuGet: https://dev.azure.com/dnceng/public/_artifacts/feed/dotnet8/NuGet/Microsoft.NET.ILLink.Tasks/versions/8.0.100-1.23067.1 is built for .NET 7: $ unzip -l /Users/rolf/Downloads/microsoft.net.illink.tasks.8.0.100-1.23067.1.nupkg
Archive: /Users/rolf/Downloads/microsoft.net.illink.tasks.8.0.100-1.23067.1.nupkg
Length Date Time Name
--------- ---------- ----- ----
520 01-17-2023 18:35 _rels/.rels
977 01-17-2023 18:35 Microsoft.NET.ILLink.Tasks.nuspec
39872 01-17-2023 18:35 tools/net472/ILLink.Tasks.dll
421328 01-17-2023 18:34 tools/net472/Mono.Cecil.dll
20856 02-19-2020 10:05 tools/net472/System.Buffers.dll
189312 10-19-2020 18:37 tools/net472/System.Collections.Immutable.dll
141184 02-19-2020 10:05 tools/net472/System.Memory.dll
115856 05-15-2018 13:29 tools/net472/System.Numerics.Vectors.dll
462728 10-19-2020 18:45 tools/net472/System.Reflection.Metadata.dll
16768 10-19-2020 18:46 tools/net472/System.Runtime.CompilerServices.Unsafe.dll
721296 01-17-2023 18:35 tools/net7.0/illink.dll
40376 01-17-2023 18:35 tools/net7.0/ILLink.Tasks.dll
421328 01-17-2023 18:34 tools/net7.0/Mono.Cecil.dll
103888 01-17-2023 18:35 tools/net7.0/Mono.Cecil.Pdb.dll
6822 01-17-2023 18:35 tools/net7.0/illink.deps.json
324 01-17-2023 18:35 tools/net7.0/illink.runtimeconfig.json
24890 01-17-2023 18:35 tools/net7.0/ILLink.Tasks.deps.json
783 01-17-2023 18:33 Sdk/Sdk.props
1451 01-17-2023 18:33 build/Microsoft.NET.ILLink.Tasks.props
21256 01-17-2023 18:33 build/Microsoft.NET.ILLink.targets
10806 01-17-2023 18:33 build/6.0_suppressions.xml
7006 12-30-2022 18:15 Icon.png
787 01-17-2023 18:35 [Content_Types].xml
664 01-17-2023 18:35 package/services/metadata/core-properties/c7cfde231f344fc9b00bdaf0b59aea91.psmdcp
11403 01-17-2023 10:38 .signature.p7s
--------- -------
2782481 25 files and our custom linker steps are built using .NET 8, thus things go wrong when the .NET 7 version of illink.dll (running on .NET 7) tries to load the custom linker steps built with .NET 8 (and this is also why having .NET 7 installed is required to reproduce the problem: if .NET 7 is not installed, illink.dll will be executed with .NET 8, and everything works).
|
@marek-safar we might have a workaround: dotnet/macios#17560 |
This should also be fixed when updating to an SDK with dotnet/installer#15484 (although I understand that may be blocked as in dotnet/macios#17518). The 8.0.100-* packages built from dotnet/linker weren't updated to target net8, while the 8.0.0-preview* ones built from dotnet/runtime do target net8. |
That fix wasn't in Preview 1, so you'll have to work around this for Preview 1. |
Context: dotnet/macios#17560 Context: dotnet/runtime#82241 On macOS, if you have both .NET 7 and .NET 8 Preview 1 installed, and you do: * `dotnet new android` * `dotnet build -c Release` You get a build error: Fatal error in IL Linker Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. File name: 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' at Microsoft.Android.Sdk.ILLink.PreserveSubStepDispatcher..ctor() at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions) --- End of inner exception stack trace --- at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions) at Mono.Linker.Driver.AddCustomStep(Pipeline pipeline, String arg) at Mono.Linker.Driver.SetupContext(ILogger customLogger) at Mono.Linker.Driver.Run(ILogger customLogger) at Mono.Linker.Driver.Main(String[] args) This happens because the linker is actually trying to run against the .NET 7 runtime! It promptly blows up against `net8.0` linker steps. Trying the same workaround as xamarin-macios, to build our linker steps for `net7.0`
…work around the fact that the linker is still a .NET 7 app. (#17560) Hopefully works around dotnet/runtime#82241.
Context: dotnet/macios#17560 Context: dotnet/runtime#82241 On macOS, if you have both .NET 7 and .NET 8 Preview 1 installed, and you do: dotnet new android dotnet build -c Release You get a build error: Fatal error in IL Linker Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. File name: 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' at Microsoft.Android.Sdk.ILLink.PreserveSubStepDispatcher..ctor() at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions) --- End of inner exception stack trace --- at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions) at Mono.Linker.Driver.AddCustomStep(Pipeline pipeline, String arg) at Mono.Linker.Driver.SetupContext(ILogger customLogger) at Mono.Linker.Driver.Run(ILogger customLogger) at Mono.Linker.Driver.Main(String[] args) This happens because the .NET 8 linker is actually trying to run against the .NET 7 runtime! It promptly blows up against `net8.0` linker steps. Trying [the same workaround as xamarin-macios][0], to build our linker steps for `net7.0`. [0]: dotnet/macios@c61e327
Context: dotnet/macios#17560 Context: dotnet/runtime#82241 On macOS, if you have both .NET 7 and .NET 8 Preview 1 installed, and you do: dotnet new android dotnet build -c Release You get a build error: Fatal error in IL Linker Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. File name: 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' at Microsoft.Android.Sdk.ILLink.PreserveSubStepDispatcher..ctor() at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions) --- End of inner exception stack trace --- at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions) at Mono.Linker.Driver.AddCustomStep(Pipeline pipeline, String arg) at Mono.Linker.Driver.SetupContext(ILogger customLogger) at Mono.Linker.Driver.Run(ILogger customLogger) at Mono.Linker.Driver.Main(String[] args) This happens because the .NET 8 linker is actually trying to run against the .NET 7 runtime! It promptly blows up against `net8.0` linker steps. Trying [the same workaround as xamarin-macios][0], to build our linker steps for `net7.0`. [0]: dotnet/macios@c61e327
um.. after clearing my local nuget cache via
|
@EgorBo Did you add the .NET 8 package source as specified in https://github.com/dotnet/installer#installers-and-binaries? |
I thought those are only for daily bits, public previews used to work fine without it, didn't they? |
Oh, nvm, I see Preview 1 was just officially released. I think it takes a bit for packages to flow to public servers. Last time I checked it took a few hours at least. |
That said, not a bad idea to confirm that the packages are set for release. @mmitche any way to verify that the runtime packs are going to published to NuGet? |
I'm getting this error in Microsoft Visual Studio Community 2022 (64-bit) - Version 17.6.0 Preview 1.0 with a Blazor WASM project. 7.x is installed too. Severity Code Description Project File Line Suppression State .csproj
[UPDATE] |
I think this is specific to the linker packages, not all of the runtime packs. I see for example that the preview1 netcoreapp package was published: https://www.nuget.org/packages/Microsoft.NETCore.App.Runtime.linux-x64/8.0.0-preview.1.23110.8#versions-body-tab. We need the following versions of Microsoft.NET.ILLink.Tasks to be published:
I suspect that 1-3 are not getting published because they are built out of the dotnet/linker repo (but I hope 4 will "just work" since that should be no different than the other runtime packs). |
It looks like the package was missing for arbitrary reasons -- we're uploading it now. |
Package should be uploaded now, this should hopefully be fixed. |
I can confirm that error is gone and build/publish works fine now |
Yep, it works with Visual Studio 17.6.0 Preview 1.0 and my Blazor WASM project too. |
Closing as this should be resolved in |
Description
The Microsoft.NET.ILLink.Tasks NuGet in .NET 8 preview 1 does not target .NET 8, causing problems for custom linker steps when they are built with .NET 8.
Reproduction Steps
Follow the instructions here: https://gist.github.com/jonathanpeppers/99961b4639823206c2537c03c856b097, except:
Create a new maui project and try to build it:
Expected behavior
Successful build.
Actual behavior
Build failure:
Regression?
Yes
Known Workarounds
Remove .NET 7.
Configuration
.NET 8.0.100-preview.1.23115.2
Other information
It's because this NuGet: https://dev.azure.com/dnceng/public/_artifacts/feed/dotnet8/NuGet/Microsoft.NET.ILLink.Tasks/versions/8.0.100-1.23067.1 is built for .NET 7:
and our custom linker steps are built using .NET 8, thus things go wrong when the .NET 7 version of illink.dll (running on .NET 7) tries to load the custom linker steps built with .NET 8 (and this is also why having .NET 7 installed is required to reproduce the problem: if .NET 7 is not installed, illink.dll will be executed with .NET 8, and everything works).
The text was updated successfully, but these errors were encountered: