IL2CPP Issue - Any Workarounds?

Hi!

I encountered a compilation issue with IL2CPP (already submitted as a bug). Here’s a simple file that, when placed in a project, causes the error: ActionCollection.cs.

I’ve already tried various changes to the original code to avoid the problem, but I haven’t been able to find a workaround.

Has anyone encountered this or knows exactly what it is that causes IL2CPP to fail? I already tried removing the events, using a class instead of a struct for the JoystickAxis type, avoiding internal types, but so far, I haven’t been able to pinpoint it.

After a quick initial look at the code, I don’t see anything that should cause problems for IL2CPP. Please submit a bug with the project that fails to compile, and we will have a look. Also, please reply here with the bug number. Thanks.

Already done so. The bug number is 643808.

Thanks I have been able to track down the cause of this problem, and I have corrected it. It should be available in an upcoming beta release (I’ll reply here when I know the version where it will land).

The problem in this case occurred because IActionCollection contained a property IAction this[int index] { get; } which was implemented by ActionCollection using the base class Collection. IL2CPP was not correctly handling an interface method implemented on a base class.

Fantastic! Thank you!

That also explains why I didn’t get anywhere commenting out stuff :slight_smile:

This fix should be available in 5.0b13.

Yep, that fixed it. Thanks again.

…though I immediately ran into another IL2CPP error message (648085), a NullReferenceException in Unity.IL2CPP.GenericsCollection.Inflater.ConstructGenericMethod() :slight_smile:

Thanks for reporting the new bug. We will have a look at it.

I have been able to correct bug 648085 now.

The Nuclex.Support.dll included an assembly reference to System.Xml.Linq.dll. However, Nuclex.Support.dll did not use any types from System.Xml.Linq, so the Unity stripping process removed System.Xml.Linq from the directory of assemblies to convert to C++ code. IL2CPP then still attempted to convert it, but it found the System.Xml.Linq assembly from the GAC instead of the one from the Mono profile used by Unity. IL2CPP then failed to convert that version of System.Xml.Linq, and produced this error.

I’ve made a change to our stripping process that will keep an assembly that is referenced like this. However, you may want to determine why Nuclex.Support.dll included an assembly reference to System.Xml.Linq.dll when it was entirely unused. This is a bit odd, I think. It will cause Unity to write C++ (and eventually JS) code for System.Xml.Linq.dll which you probably don’t need. That will, in turn, unnecessarily increase the size of the code that you have to deliver for the WebGL build target of this project.

I’ll reply here when I know which beta will include this fix.

Bug 648085 should be included in the next beta release, which will be 5.0b16 I believe.

Thanks, you rock! :slight_smile:

I have removed the System.Xml.Linq reference (I just blame NAnt’s default reference set for that) and it’s been smooth sailing since then. It’s quite impressive what IL2CPP can handle.