Failed to InitSDK in Unity2019 + IL2CPP environment

Hi all, so far my gamelift test goes well in Unity 2019.2.0f1
But as long as I change the scripting backend from “Mono” to “IL2CPP”
It gives me some exception info when I run “GameLiftServerAPI.InitSDK”
Anyone can give me some insights on this issue?

Here’s the log:

WindowsPlayer ArgumentOutOfRangeException: Parameter: defaultRepositoryType, Value: [log4net.Repository.Hierarchy.Hierarchy] out of range. Argument must implement the ILoggerRepository interface
Parameter name: defaultRepositoryType
Actual value was log4net.Repository.Hierarchy.Hierarchy.
at log4net.Core.DefaultRepositorySelector…ctor (System.Type defaultRepositoryType) [0x00000] in <00000000000000000000000000000000>:0
at log4net.Core.LoggerManager…cctor () [0x00000] in <00000000000000000000000000000000>:0
at log4net.LogManager.GetLogger (System.Type type) [0x00000] in <00000000000000000000000000000000>:0
at Aws.GameLift.Server.ServerState…cctor () [0x00000] in <00000000000000000000000000000000>:0
at Aws.GameLift.Server.GameLiftServerAPI.InitSDK () [0x00000] in <00000000000000000000000000000000>:0

I would suspect this is because of the differences between how I2LCPP build things.

I believe the IL2CPP build toolchain does some form of managed code stripping of assemblies, removing managed code from that that is not called at runtime. The Mono build toolchain does not do this by default, or at least that used to be the case.

You may want to look at the manual and turn off assembly stripping for your build to see if this is the case.

Unfortunately, this is not something I believe GameLift has ever tested. Can I ask your reason for using IL2CPP on Windows?

Thank you for your reply.

The main reason why we want IL2CPP is to improve the performance in general. So I followed the document and the original issue is gone. However, I got some other issues. It seems that some 3rd-party libs like “JsonDotNet” and “protobuf-net” are not really AOT friendly.

For the JsonDotNet, I found a unity compatible version here, which fix the problem:

But for the protobuf-net, I didn’t find any workaround yet.
It seems that the author has no interest to fix it:

Now I kinda just give up the idea of making an IL2CPP build :joy:
But if you have any workaround or suggestion that would be great!