Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[area-Tools-ILLink]: ILLinker is failing when building a mac-catalyst app #110714

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

Closed
pictos opened this issue Dec 14, 2024 · 5 comments
Closed

[area-Tools-ILLink]: ILLinker is failing when building a mac-catalyst app #110714

pictos opened this issue Dec 14, 2024 · 5 comments
Labels
area-Tools-ILLink .NET linker development as well as trimming analyzers

Comments

@pictos
Copy link

pictos commented Dec 14, 2024

Description

During the release build of the sample app of CommunityToolkit.Maui, for maccatalyst, the build breaks with a IL1012 error, and doesn't provide any helpful log message.

Reproduction Steps

  1. Checkout this repo https://github.com/CommunityToolkit/Maui/tree/feature/sl-dotnet-nine
  2. checkout at the feature/sl-dotnet-nine branch
  3. (IF you want you can remove other TFM and just build for macCatalyst)
  4. build the sample app on terminal dotnet build --no-incremental /bl -c Release
  5. see the error.

Expected behavior

The project builds.

Actual behavior

The build breaks.

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

msbuild.binlog.zip

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Dec 14, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Dec 14, 2024
@jkotas jkotas added the area-Tools-ILLink .NET linker development as well as trimming analyzers label Dec 14, 2024
@jkotas jkotas removed the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Dec 14, 2024
Copy link
Contributor

Tagging subscribers to this area: @dotnet/illink
See info in area-owners.md if you want to be subscribed.

@vitek-karas
Copy link
Member

Unhandled exception. System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at System.Collections.Immutable.ImmutableArray`1.get_Item(Int32 index)
   at Mono.Linker.Dataflow.TrimAnalysisMethodCallPattern.Merge(ValueSetLattice`1 lattice, TrimAnalysisMethodCallPattern other)
   at Mono.Linker.Dataflow.TrimAnalysisPatternStore.Add(TrimAnalysisMethodCallPattern pattern)
   at Mono.Linker.Dataflow.ReflectionMethodBodyScanner.HandleCall(MethodBody callingMethodBody, MethodReference calledMethod, Instruction operation, ValueNodeList methodParams)

I have a repro package for mac - ping me when you get to this.

@vitek-karas
Copy link
Member

#110753 contains the explanation of this failure.

@ivanpovazan is there a way to change an option to stop using managed registrar, that might be a viable workaround.

@ivanpovazan
Copy link
Member

Yes, here are the .NET 9 release notes explaining the change and the way to opt-out from using managed-static registrar: https://github.com/xamarin/xamarin-macios/wiki/.NET-9-release-notes#type-registrar-managed-static-as-the-new-default

rolfbjarne added a commit to dotnet/macios that referenced this issue Feb 12, 2025
…ia Cecil (#22149)

The trimmer has logic which relies on IL Offsets for each instruction to differentiate events from different instructions. If there are two instructions with the same offset it can lead to confusion and eventually failures.

There's more detailed discussion of the problem in dotnet/runtime#110753

This change modifies all the places where the custom steps are generating IL instructions to also generate unique IL offsets for each instruction (the actual values don't matter really).

This should fix the problem in dotnet/runtime#110714

This is an unforked version of #22127 (required due to CI restrictions).

---------

Co-authored-by: vitek-karas <[email protected]>
@agocke
Copy link
Member

agocke commented May 2, 2025

Closing as by-design in the linker

@agocke agocke closed this as completed May 2, 2025
@dotnet-policy-service dotnet-policy-service bot removed the untriaged New issue has not been triaged by the area owner label May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Tools-ILLink .NET linker development as well as trimming analyzers
Projects
Status: No status
Development

No branches or pull requests

5 participants