How do I fix this issue with System.Configuration.ConfigurationManager::get_AppSettings on iOS

I posted the forum with more detail as well, but wanted to get more visibility. When I build to IOS using AWSSDK.Gamelift (net 4.0), I consistently get the above error whether or not I have code stripping disabled.

More detail on my own issue here.
https://forum.unity.com/threads/issue-with-system-configuration-configurationmanager-get_appsettings-on-ios.1026877/

I easily reproduced this issue by making a canvas the single class here attached (using the net 4.5 dlls in assets/plugins):

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Amazon;
using Amazon.GameLift;
using Amazon.Runtime;
using Amazon.GameLift.Model;
using Amazon.Runtime.CredentialManagement;
using System;

public class TestGameLift : MonoBehaviour
{

    public Guid myName;
    private Amazon.GameLift.Model.PlayerSession psession = null;
    public string aliasId = "<alias>";
    public static readonly string profileName = "<profile>";
    public AmazonGameLiftClient aglc = null;
    public AWSCredentials credentials;
    public AmazonGameLiftConfig config;


    // Start is called before the first frame update
    void Start()
    {
        string ticketId = Guid.NewGuid().ToString();
        string playerId = Guid.NewGuid().ToString();

        var options = new CredentialProfileOptions
        {
            AccessKey = "<key>",
            SecretKey = "<key>"
        };
        CredentialProfile profile = new CredentialProfile("iam", options);
        profile.Region = Amazon.RegionEndpoint.USWest2;
        var sharedFile = new SharedCredentialsFile();
        sharedFile.RegisterProfile(profile);

        credentials = profile.GetAWSCredentials(null);
        aglc = new AmazonGameLiftClient(credentials, Amazon.RegionEndpoint.USWest2);

        ticketId = Guid.NewGuid().ToString();

        AttributeValue skill = new AttributeValue
        {
            N = 1.0
        };

        Player player = new Player
        {
            PlayerId = playerId,
            LatencyInMs = new Dictionary<string, int>{
                { "us-west-2" , 1 }
            },
            PlayerAttributes = new Dictionary<string, AttributeValue>
            {
                { "skill", skill }
            }
        };

        var mmRequest = new StartMatchmakingRequest();
        mmRequest.Players = new List<Player> { player };

        mmRequest.TicketId = ticketId;
        mmRequest.ConfigurationName = "defaultMatchmakingConfiguration";

        StartMatchmakingResponse mmResponse = aglc.StartMatchmaking(mmRequest);
    }

    // Update is called once per frame
    void Update()
    {
        Debug.Log("Hi!");
        
    }
}

In the editor, this successfully starts a matchmaking request which I verified in my gamelift console. However, when I build this to iOS and run it on my phone I get the following:

NotSupportedException: System.Configuration.ConfigurationManager::get_AppSettings
  at System.Configuration.ConfigurationManager.get_AppSettings () [0x00000] in <00000000000000000000000000000000>:0 
  at Amazon.AWSConfigs.GetConfig (System.String name) [0x00000] in <00000000000000000000000000000000>:0 
  at Amazon.AWSConfigs..cctor () [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..ctor (System.Type type) [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 TestGameLift.Start () [0x00000] in <00000000000000000000000000000000>:0 
Rethrow as TypeInitializationException: The type initializer for 'Amazon.AWSConfigs' threw an exception.
  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..ctor (System.Type type) [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 TestGameLift.Start () [0x00000] in <00000000000000000000000000000000>:0 

How can I fix this issue?

I got this working (on iOS) by switching to AWS 2.0 SDKs from the zip in this documentation page: Referencing the AWS SDK for .NET Standard 2.0 from Unity, Xamarin, or UWP | AWS Developer Tools Blog

I had to make some code changes (have to use async functions for many network calls, but that should be moved to lambda once I’m done with my proof of concept anyways).

I used the libraries from the realtime package as they were, I think, as they only build the one version. After this my game works and I can call matchmaking & query my dynamodb on both my editor, mac builds, and ios builds.

Unfortunately, now I am running into issues with TLS not working on ios builds, but as far as this specific error it’s resolved for me :slight_smile: