Search Issue Tracker

Won't Fix

Votes

0

Found in

2019.4

2020.3

2021.2

2021.2.8f1

2022.1

2022.2

Issue ID

1396246

Regression

No

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

IL2CPP

-

Reproduction steps:
1. Download and open the attached "IL2CPP_Repro.zip" 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: https://gist.github.com/nirinchev/b9c614e39bbfe957e7954b6d1093ed10.

    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.