System.Reflection.Emit-using code causes Unity3D IL2CPP compilation fail
As the title states, currently DefaultECS cannot be used with unity3d il2cpp compilation backend due to System.Reflection.Emit code inside framework.
The problem here is that, unlike some other AoT compilation methods, il2cpp does not care if you are using this specific part of the code or nor. Simply having it is enough for a failure, so in order for it to be compatible, .Emit-using code has to be rewritten without its usage.
I did quick and dirty fix for myself by removing affected parts of framework here in my fork repo, so you can look where are the things that causing the problem.
That's weird, I remember trying it as is with IL2CPP and building a project for both PC and Android. No problem (as long as I didn't call those methods obviously). That was with version 2020.2.3f1, what version are you using? maybe they changed it :/
I'm using the 2021.2 version.
Finally got around to update my Unity. I managed to create a build using IL2CPP for windows, with the version 2021.2.16f1 and netstandard2.1 api. I tried to look into their release notes to see if there was something about it but found nothing. Can you try to see if upgrading your Unity fixes it? Truth be told this separation is something I had in mind but didn't want to invest time in yet. So I will probably make Default.Serialization as its own package sooner than later.