Search Issue Tracker

Won't Fix



Found in







Issue ID




Build fails when building for iOS using IL2CPP and Realm Unity SDK



Reproduction steps:
1. Download and open the attached "" project
2. Build for iOS
3. Observe the console window

Expected result: The build succeeds
Actual result: The build fails with a "Stack overflow" error

Reproducible with: 2019.4.35f1, 2020.3.27f1, 2021.2.10f1, 2022.1.0b6, 2022.2.0a3

  1. Resolution Note:

    This is the problem in the Realm.dll assembly in this project. It contains a type named JetBrains.Annotations.UsedImplicitlyAttribute, where the constructors of the attribute type use the attribute itself.

Comments (1)

  1. nirinchev

    Feb 02, 2022 15:35

    Hey, thanks for looking into this. I would like to challenge the assessment though. Adding an attribute to the constructor of that same attribute is something supported in c# and the compiler generates IL that is fully supported by ILSpy and JustDecompile, implying that the IL is valid. I've put up a simple .NET 6 project that reproduces this, but it is something that is supported at least since netstandard 2.0, possible even earlier:

    Additionally, this appears to be a regression in the IL2CPP compiler - I tested this with Unity 2020.3.10f1 and the project compiles successfully with no code changes. I haven't tried to track down the exact Unity version that introduces the regression since I'm sure you're better equipped to figure it out. Since the UsedImplicitlyAttribute is added to Realm via the Remotion.Linq dependency, it will be fairly complicated to remove it on our end, so I hope to see this fixed on the Unity side.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.