Skip to content
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

[release/8.0.1xx-preview1] [dotnet-linker] Make this a .NET 7 app to work around the fact that the linker is still a .NET 7 app. #17560

Conversation

rolfbjarne
Copy link
Member

Hopefully works around dotnet/runtime#82241.

…work around the fact that the linker is still a .NET 7 app.

Hopefully works around dotnet/runtime#82241.
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

jonathanpeppers added a commit to jonathanpeppers/xamarin-android that referenced this pull request Feb 16, 2023
Context: xamarin/xamarin-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`
@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ API diff for current PR / commit

Legacy Xamarin (No breaking changes)
  • iOS (no change detected)
  • tvOS (no change detected)
  • watchOS (no change detected)
  • macOS (no change detected)
NET (empty diffs)
  • iOS: (empty diff detected)
  • tvOS: (empty diff detected)
  • MacCatalyst: (empty diff detected)
  • macOS: (empty diff detected)

✅ API diff vs stable

Legacy Xamarin (No breaking changes)
.NET (No breaking changes)
Legacy Xamarin (stable) vs .NET

✅ Generator diff

Generator diff is empty

Pipeline on Agent
Hash: 77d6137e5f51aee37834852d06d9bd6ad0e639d3 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

📚 [PR Build] Artifacts 📚

Packages generated

View packages

Pipeline on Agent XAMBOT-1108.Monterey'
Hash: 77d6137e5f51aee37834852d06d9bd6ad0e639d3 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [PR Build] Tests on macOS M1 - Mac Big Sur (11.5) passed 💻

All tests on macOS M1 - Mac Big Sur (11.5) passed.

Pipeline on Agent
Hash: 77d6137e5f51aee37834852d06d9bd6ad0e639d3 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🚀 [CI Build] Test results 🚀

Test results

✅ All tests passed on VSTS: simulator tests.

🎉 All 225 tests passed 🎉

Tests counts

✅ bcl: All 69 tests passed. Html Report (VSDrops) Download
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests: All 1 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 7 tests passed. Html Report (VSDrops) Download
✅ framework: All 8 tests passed. Html Report (VSDrops) Download
✅ generator: All 2 tests passed. Html Report (VSDrops) Download
✅ interdependent_binding_projects: All 7 tests passed. Html Report (VSDrops) Download
✅ install_source: All 1 tests passed. Html Report (VSDrops) Download
✅ introspection: All 8 tests passed. Html Report (VSDrops) Download
✅ linker: All 65 tests passed. Html Report (VSDrops) Download
✅ mac_binding_project: All 1 tests passed. Html Report (VSDrops) Download
✅ mmp: All 2 tests passed. Html Report (VSDrops) Download
✅ mononative: All 12 tests passed. Html Report (VSDrops) Download
✅ monotouch: All 25 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ mtouch: All 1 tests passed. Html Report (VSDrops) Download
✅ xammac: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 8 tests passed. Html Report (VSDrops) Download
✅ xtro: All 2 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: 77d6137e5f51aee37834852d06d9bd6ad0e639d3 [PR build]

@rolfbjarne rolfbjarne merged commit c61e327 into xamarin:release/8.0.1xx-preview1 Feb 17, 2023
@rolfbjarne rolfbjarne deleted the release/8.0.1xx-preview1 branch February 17, 2023 12:02
jonpryor pushed a commit to dotnet/android that referenced this pull request Feb 17, 2023
Context: xamarin/xamarin-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]: xamarin/xamarin-macios@c61e327
jonathanpeppers added a commit to dotnet/android that referenced this pull request Feb 17, 2023
Context: xamarin/xamarin-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]: xamarin/xamarin-macios@c61e327
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants