I am having a persistent issue in building my Unity (version 2020.2.0a15) game, which utilizes AWS Gamelift, on iOS. It runs fine on simulator, and I can build and successfully run on my mac with all of my networking, matchmaking, etc. working.
However, when I try to build this to my iOS device through xcode (12.3), I get the error below, which seems related to IL2CPP based on my search so far.
The final line of the stack trace is: System.NotSupportedException: System.Configuration.ConfigurationManager::get_AppSettings. I’ve copied the full logging below.
I have spent a few days trying to fix this myself, but have been unable to make progress. The common issues referenced during my search have been:
- link.xml not being set up, so the code gets stripped. I have one, posting below
- AWS config not being set up. I have one, posting below
- log4net not being configured. On my local version, I have a log4net.xml set up, which is being read and I confirmed the appender is working and logging to a file on my dev pc when I run in the simulator
- Needing to use 2.0 instead of 4.x - I’ve tried building with 2.0 as much as possible (e.g. using log4net 2.0, and all the necessary dependencies), and again it works in editor but fails when built to an iphone.
- AWS being fundamentally incompatible with Il2CPP (which I hope isn’t true, and seems wrong if there are gamelift games on ios?)
Could somebody please help me figure out how to fix this and get gamelift working on mobile builds from unity? I’ve even tried setting logging to None in AWS settings, but to no avail.
References:
Full stack trace from xcode debug window; this is triggered when I instantiate my gamelift client from my networkmanager class.
log4net:ERROR Exception while reading ConfigurationSettings. Check your .config file is well formed XML.
System.NotSupportedException: System.Configuration.ConfigurationManager::get_AppSettings
at System.Configuration.ConfigurationManager.get_AppSettings () [0x00000] in <00000000000000000000000000000000>:0
at log4net.Util.SystemInfo.GetAppSetting (System.String key) [0x00000] in <00000000000000000000000000000000>:0
at log4net.Util.LogLog…cctor () [0x00000] in <00000000000000000000000000000000>:0
at log4net.Util.SystemInfo.GetAppSetting (System.String key) [0x00000] in <00000000000000000000000000000000>:0
at log4net.Util.SystemInfo…cctor () [0x00000] in <00000000000000000000000000000000>:0
at log4net.Core.LoggerManager.GetVersionInfo () [0x00000] in <00000000000000000000000000000000>:0
at log4net.Core.LoggerManager…cctor () [0x00000] in <00000000000000000000000000000000>:0
at log4net.LogManager.GetLogger (System.Reflection.Assembly repositoryAssembly, System.String name) [0x00000] in <00000000000000000000000000000000>:0
at log4net.LogManager.GetLogger (System.Type type) [0x00000] in <00000000000000000000000000000000>:0
at Controller…cctor () [0x00000] in <00000000000000000000000000000000>:0
log4net:ERROR Exception while reading ConfigurationSettings. Check your .config file is well formed XML.
System.NotSupportedException: System.Configuration.ConfigurationManager::get_AppSettings
at System.Configuration.ConfigurationManager.get_AppSettings () [0x00000] in <00000000000000000000000000000000>:0
at log4net.Util.SystemInfo.GetAppSetting (System.String key) [0x00000] in <00000000000000000000000000000000>:0
at log4net.Util.LogLog…cctor () [0x00000] in <00000000000000000000000000000000>:0
at log4net.Util.SystemInfo.GetAppSetting (System.String key) [0x00000] in <00000000000000000000000000000000>:0
at log4net.Util.SystemInfo…cctor () [0x00000] in <00000000000000000000000000000000>:0
at log4net.Core.LoggerManager.GetVersionInfo () [0x00000] in <00000000000000000000000000000000>:0
at log4net.Core.LoggerManager…cctor () [0x00000] in <00000000000000000000000000000000>:0
at log4net.LogManager.GetLogger (System.Reflection.Assembly repositoryAssembly, System.String name) [0x00000] in <00000000000000000000000000000000>:0
at log4net.LogManager.GetLogger (System.Type type) [0x00000] in <00000000000000000000000000000000>:0
at Controller…cctor () [0x00000] in <00000000000000000000000000000000>:0
log4net:ERROR Exception while reading ConfigurationSettings. Check your .config file is well formed XML.
System.NotSupportedException: System.Configuration.ConfigurationManager::get_AppSettings
at System.Configuration.ConfigurationManager.get_AppSettings () [0x00000] in <00000000000000000000000000000000>:0
at log4net.Util.SystemInfo.GetAppSetting (System.String key) [0x00000] in <00000000000000000000000000000000>:0
at log4net.Util.LogLog…cctor () [0x00000] in <00000000000000000000000000000000>:0
at log4net.Util.SystemInfo.GetAppSetting (System.String key) [0x00000] in <00000000000000000000000000000000>:0
at log4net.Util.SystemInfo…cctor () [0x00000] in <00000000000000000000000000000000>:0
at log4net.Core.LoggerManager.GetVersionInfo () [0x00000] in <00000000000000000000000000000000>:0
at log4net.Core.LoggerManager…cctor () [0x00000] in <00000000000000000000000000000000>:0
at log4net.LogManager.GetLogger (System.Reflection.Assembly repositoryAssembly, System.String name) [0x00000] in <00000000000000000000000000000000>:0
at log4net.LogManager.GetLogger (System.Type type) [0x00000] in <00000000000000000000000000000000>:0
at Controller…cctor () [0x00000] in <00000000000000000000000000000000>:0
log4net:ERROR Exception while reading ConfigurationSettings. Check your .config file is well formed XML.
System.NotSupportedException: System.Configuration.ConfigurationManager::get_AppSettings
at System.Configuration.ConfigurationManager.get_AppSettings () [0x00000] in <00000000000000000000000000000000>:0
at log4net.Util.SystemInfo.GetAppSetting (System.String key) [0x00000] in <00000000000000000000000000000000>:0
at log4net.Util.SystemInfo…cctor () [0x00000] in <00000000000000000000000000000000>:0
at log4net.Core.LoggerManager.GetVersionInfo () [0x00000] in <00000000000000000000000000000000>:0
at log4net.Core.LoggerManager…cctor () [0x00000] in <00000000000000000000000000000000>:0
at log4net.LogManager.GetLogger (System.Reflection.Assembly repositoryAssembly, System.String name) [0x00000] in <00000000000000000000000000000000>:0
at log4net.LogManager.GetLogger (System.Type type) [0x00000] in <00000000000000000000000000000000>:0
at Controller…cctor () [0x00000] in <00000000000000000000000000000000>:0
log4net:ERROR Exception while reading ConfigurationSettings. Check your .config file is well formed XML.
System.NotSupportedException: System.Configuration.ConfigurationManager::get_AppSettings
at System.Configuration.ConfigurationManager.get_AppSettings () [0x00000] in <00000000000000000000000000000000>:0
at log4net.Util.SystemInfo.GetAppSetting (System.String key) [0x00000] in <00000000000000000000000000000000>:0
at log4net.Util.SystemInfo…cctor () [0x00000] in <00000000000000000000000000000000>:0
at log4net.Core.LoggerManager.GetVersionInfo () [0x00000] in <00000000000000000000000000000000>:0
at log4net.Core.LoggerManager…cctor () [0x00000] in <00000000000000000000000000000000>:0
at log4net.LogManager.GetLogger (System.Reflection.Assembly repositoryAssembly, System.String name) [0x00000] in <00000000000000000000000000000000>:0
at log4net.LogManager.GetLogger (System.Type type) [0x00000] in <00000000000000000000000000000000>:0
at Controller…cctor () [0x00000] in <00000000000000000000000000000000>:0
log4net:ERROR Exception while reading ConfigurationSettings. Check your .config file is well formed XML.
System.NotSupportedException: System.Configuration.ConfigurationManager::get_AppSettings
at System.Configuration.ConfigurationManager.get_AppSettings () [0x00000] in <00000000000000000000000000000000>:0
at log4net.Util.SystemInfo.GetAppSetting (System.String key) [0x00000] in <00000000000000000000000000000000>:0
at log4net.Core.LoggerManager…cctor () [0x00000] in <00000000000000000000000000000000>:0
at log4net.LogManager.GetLogger (System.Reflection.Assembly repositoryAssembly, System.String name) [0x00000] in <00000000000000000000000000000000>:0
at log4net.LogManager.GetLogger (System.Type type) [0x00000] in <00000000000000000000000000000000>:0
at Controller…cctor () [0x00000] in <00000000000000000000000000000000>:0
log4net:ERROR Exception while reading ConfigurationSettings. Check your .config file is well formed XML.
System.NotSupportedException: System.Configuration.ConfigurationManager::get_AppSettings
at System.Configuration.ConfigurationManager.get_AppSettings () [0x00000] in <00000000000000000000000000000000>:0
at log4net.Util.SystemInfo.GetAppSetting (System.String key) [0x00000] in <00000000000000000000000000000000>:0
at log4net.Core.DefaultRepositorySelector.ConfigureRepository (System.Reflection.Assembly assembly, log4net.Repository.ILoggerRepository repository) [0x00000] in <00000000000000000000000000000000>:0
at log4net.Core.DefaultRepositorySelector.CreateRepository (System.Reflection.Assembly repositoryAssembly, System.Type repositoryType, System.String repositoryName, System.Boolean readAssemblyAttributes) [0x00000] in <00000000000000000000000000000000>:0
at log4net.Core.DefaultRepositorySelector.CreateRepository (System.Reflection.Assembly repositoryAssembly, System.Type repositoryType) [0x00000] in <00000000000000000000000000000000>:0
at log4net.Core.DefaultRepositorySelector.GetRepository (System.Reflection.Assembly repositoryAssembly) [0x00000] in <00000000000000000000000000000000>:0
at log4net.Core.LoggerManager.GetLogger (System.Reflection.Assembly repositoryAssembly, System.String name) [0x00000] in <00000000000000000000000000000000>:0
at log4net.LogManager.GetLogger (System.Reflection.Assembly repositoryAssembly, System.String name) [0x00000] in <00000000000000000000000000000000>:0
at log4net.LogManager.GetLogger (System.Type type) [0x00000] in <00000000000000000000000000000000>:0
at Controller…cctor () [0x00000] in <00000000000000000000000000000000>:0
2020-12-22 11:33:18.190362-0800 TSBRV2[26335:3201119] Unbalanced calls to begin/end appearance transitions for <UIViewController: 0x1181a4a50>.
UnloadTime: 2.203000 ms
False
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[ ])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
Controller:Start()
Ignore me - called to open Console
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[ ])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogError(Object)
Controller:Start()
ArgumentNullException: Value cannot be null.
Parameter name: obj
at System.Threading.Monitor.ReliableEnterTimeout (System.Object obj, System.Int32 timeout, System.Boolean& lockTaken) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.Monitor.ReliableEnter (System.Object obj, System.Boolean& lockTaken) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.Monitor.Enter (System.Object obj, System.Boolean& lockTaken) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.AWSConfigs.TraceListeners (System.String source) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.Util.TraceSourceUtil.GetTraceSourceWithListeners (System.String name, System.Diagnostics.SourceLevels sourceLevels) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.Util.TraceSourceUtil.GetTraceSource (System.Type targetType, System.Diagnostics.SourceLevels sourceLevels) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.Util.TraceSourceUtil.GetTraceSource (System.Type targetType) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.Util.InternalSystemDiagnosticsLogger…ctor (System.Type declaringType) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.Util.Logger.GetHashCode () [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.Util.Logger.GetLogger (System.Type type) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.CredentialManagement.SharedCredentialsFile…ctor () [0x00000] in <00000000000000000000000000000000>:0
at GameLiftClient.CreateGameLiftClient () [0x00000] in <00000000000000000000000000000000>:0
at GameLiftClient…ctor () [0x00000] in <00000000000000000000000000000000>:0
at NetworkManager…ctor () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.GameObject.AddComponent (System.Type componentType) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.GameObject.AddComponent[T] () [0x00000] in <00000000000000000000000000000000>:0
at Controller.Start () [0x00000] in <00000000000000000000000000000000>:0
UnityEngine.GameObject:AddComponent(Type)
UnityEngine.GameObject:AddComponent()
Controller:Start()
My log4net.xml file, in my Assets folder, though I have since moved this configuration to be in code so I can have a dynamic log path for my mac build.
<?xml version="1.0" encoding="utf-8"?>
<log4net>
<appender name="EventLog" type="log4net.Appender.RollingFileAppender">
<file value="./TestLog/tsbrlog.txt" />
<appendToFile value="true" />
<rollingStyle value="Once" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="1MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %-5level in [%thread] %logger%newline%message%newline" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="EventLog" />
</root>
</log4net>
My awsconfig.xml, in Assets/Resources:
<?xml version="1.0" encoding="utf-8"?>My (Very permissive) link.xml – note I also turned off code stripping in project settings.
<linker>
<assembly fullname="UnityEngine">
<type fullname="UnityEngine.Networking.UnityWebRequest" preserve="all" />
<type fullname="UnityEngine.Networking.UploadHandlerRaw" preserve="all" />
<type fullname="UnityEngine.Networking.UploadHandler" preserve="all" />
<type fullname="UnityEngine.Networking.DownloadHandler" preserve="all" />
<type fullname="UnityEngine.Networking.DownloadHandlerBuffer" preserve="all" />
</assembly>
<assembly fullname="AWSSDK.Core" preserve="all"/>
<assembly fullname="AWSSDK.DynamoDBv2" preserve="all"/>
<assembly fullname="AWSSDK.GameLift" preserve="all"/>
<assembly fullname="AWSSDK.SimpleNotificationService" preserve="all"/>
<assembly fullname="Microsoft.Bcl.AsyncInterfaces" preserve="all"/>
<assembly fullname="Newtonsoft.Json" preserve="all"/>
<assembly fullname="System.Buffers" preserve="all"/>
<assembly fullname="System.Configure" preserve="all"/>
<assembly fullname="System.Configuration" preserve="all"/>
<assembly fullname="System.Configuration.Install" preserve="all"/>
<assembly fullname="System.Object" preserve="all"/>
<assembly fullname="System.Numeric.Vectors" preserve="all"/>
<assembly fullname="System.Runtime.CompilerServices.Unsafe" preserve="all"/>
<assembly fullname="System.Text.Encodings.WEb" preserve="all"/>
<assembly fullname="System.Threading.Tasks.Extensions" preserve="all"/>
<assembly fullname="System.ValueTuple" preserve="all"/>
<assembly fullname="Google.Protobuf" preserve="all"/>
<assembly fullname="log4net" preserve="all"/>
<assembly fullname="System.Configuration" preserve="all"/>
<assembly fullname="mscorlib">
<namespace fullname="System.Security.Cryptography" preserve="all"/>
</assembly>
<assembly fullname="System">
<namespace fullname="System.Security.Cryptography" preserve="all"/>
</assembly>
<assembly fullname="AWSSDK.CognitoIdentity" preserve="all"/>
<assembly fullname="AWSSDK.SecurityToken" preserve="all"/>