Need More Information

IL2CPP encountered a managed type which it cannot convert ahead-of-time

Juliean 2 years ago updated 2 years ago 6

Here at work we are regularly encountering startup errors when building for the IL2CPP-platform. App hangs directly after unity logo fades, error log shows the following output (only in the device logs):


This is usually resolved by reverting some of our recent changes, ie. we had to remove an app-rating plugin once, or the other time we actually had to convert a timeline animation to a regular animator. None of which actually involves any heavily generic or otherwise nested types that should cause this issue.

Now aside from resolving the actual reason, would it be at all possible to instrument this error condition with more information? We'd be interested in the actual type that is causing this problem, so that we will have to spend less time trying to find out what caused the error this time.

(As a side note, we had a very persistent occurance of this error lately, which was only resolved by updating bolt from 1.4.2 to 1.4.4, only to reappear a week afterwards as of today. Also, its happening on both iOS and Android, and we do perform the AotPrebuild often, which is usually the catalyst for the error appearning - meaning it will just stop working after we updated the AotStubs with the prebuild step)


Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):

Same happens to me!


In my case, removing Odin Inspector resolve the problem 1 week ago, but the problem happens without Odin Inspector today.

Is it Full Serializer problem?


Interesting, we are using Odin Inspector as well.

I was able to circumenvent the issue way simplier though. We are now shipping a custm debug-build of Bolt from Source. That somehow seems to fix the issue as well. Custom release-build only seems to work sporadically. Thankfully in our case we are not experiencing any performance issues even on our low-end target hardware, so that may be a thing can consider doing as well.

Thanks for sharing! That's good news!

Another workaround I found is including almost all of the assemblies using link.xml. It works for my case, but the build size grows 10 MB bigger.

Also, unchecking Strip Engine Code in player settings may work.

Need More Information

Hi Juliean,

Sorry, I missed this bug report for the version I just published because it was tagged as a question.

For clarity, does this crash occur in the editor, build, or both?

Do you get an instant crash or a console error?

From quick research, it seems like there's a generic type in the project with > 7 levels of nesting, which is very deep: https://forum.unity.com/threads/il2cpp-max-nested-generic-types.540534/

It's the first time I had this issue reported ever so I wonder if it could have to do with a specific type in your project.

I could wrap the GetGenericParameterAttributes callin a try-catch and rethrow with the attempted type at least. If you're already using a debug build of Bolt in-house, can you test yourself right away?

Hi there!

"For clarity, does this crash occur in the editor, build, or both?"

Only occurs in mobile-builds using IL2CPP, for both android and iOS.

"Do you get an instant crash or a console error?"

Console error. Game simply stops at that point. In earlier version this happened right during the Unity-Logo screen, but now happens when the scene using the affected graph is loaded.

"From quick research, it seems like there's a generic type in the project with > 7 levels of nesting, which is very deep: https://forum.unity.com/threads/il2cpp-max-nested-generic-types.540534/"

Yes, that appears to be the reason, but the type in question didn't really have any generics/nesting at all. I found the GUID of the node in the error-messages first line, so I was able to track down the type after all. Yet it didn't make much sense. It was ie. this:

public class BoltRoom : MonoBehaviour
    public void StartRoom(int id)

where the StartRoom-function was causing the issue to appear. So I suspect its rather some type-construct within bold that is stripped out (I see no way that StartRoom here would be affected by IL2CPP-type strpping; and I did even attempt all possible variants of manual type preservation).