Can't seem to get link.xml working with AWS SDK

Hi, having a horribly difficult time here, been trying to fix this for hours…

We’re using the AWS SDK and it seems to be getting stripped, specifically a constructor inside one of the assemblies. This is the error we’re encountering in Xcode when the games runs on a device:

MissingMethodException: Method not found: 'Default constructor not found...ctor() of Amazon.Util.Internal.PlatformServices.NetworkReachability'.

I’ve tried setting up the link.xml file in both of the following ways:

<linker>

<assembly fullname="AWSSDK.Core" preserve="all"/>
<assembly fullname="AWSSDK.CognitoIdentity" preserve="all"/>
<assembly fullname="AWSSDK.SecurityToken" preserve="all"/>
<assembly fullname="AWSSDK.DynamoDBv2" preserve="all"/>

<assembly fullname="UnityEngine">
    <type fullname="UnityEngine.Experimental.Networking.UnityWebRequest" preserve="all" />
    <type fullname="UnityEngine.Experimental.Networking.UploadHandlerRaw" preserve="all" />
    <type fullname="UnityEngine.Experimental.Networking.UploadHandler" preserve="all" />
    <type fullname="UnityEngine.Experimental.Networking.DownloadHandler" preserve="all" />
    <type fullname="UnityEngine.Experimental.Networking.DownloadHandlerBuffer" preserve="all" />
</assembly>

<assembly fullname="mscorlib">
    <namespace fullname="System.Security.Cryptography" preserve="all"/>
</assembly>

<assembly fullname="System">
    <namespace fullname="System.Security.Cryptography" preserve="all"/>
</assembly>

</linker>

…and this way…

<linker>

<assembly fullname="AWSSDK.Core">
   <namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
</assembly>
<assembly fullname="AWSSDK.CognitoIdentity">
   <namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
</assembly>
<assembly fullname="AWSSDK.SecurityToken">
   <namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
</assembly>
<assembly fullname="AWSSDK.DynamoDBv2">
   <namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
</assembly>

<assembly fullname="UnityEngine">
    <type fullname="UnityEngine.Experimental.Networking.UnityWebRequest" preserve="all" />
    <type fullname="UnityEngine.Experimental.Networking.UploadHandlerRaw" preserve="all" />
    <type fullname="UnityEngine.Experimental.Networking.UploadHandler" preserve="all" />
    <type fullname="UnityEngine.Experimental.Networking.DownloadHandler" preserve="all" />
    <type fullname="UnityEngine.Experimental.Networking.DownloadHandlerBuffer" preserve="all" />
</assembly>

<assembly fullname="mscorlib">
    <namespace fullname="System.Security.Cryptography" preserve="all"/>
</assembly>

<assembly fullname="System">
    <namespace fullname="System.Security.Cryptography" preserve="all"/>
</assembly>

</linker>

Neither of them seem to be working. Using the Assembly Browser in Mono and switching between C# and IL, I can see IL is missing the constructor that is clearly present in C#.

Any help would be greatly appreciated, running out of things to try.
Thanks!

So I did actually figure this out. Eventually I got it working by using the second method and also manually setting the import settings on the libraries from “Any Platform” to “iOS, Android, Editor”.

This let it run and connect to DynamoDB, but then it was unable to parse the data (or something), giving the error “Type System.String is unsupported, it cannot be instantiated”. This was fixed by reverting the Dynamo assembly line back to the original format. Anyway, if none of that makes sense, this is what it ended up looking like:

<linker>

<assembly fullname="UnityEngine">
    <type fullname="UnityEngine.Experimental.Networking.UnityWebRequest" preserve="all" />
    <type fullname="UnityEngine.Experimental.Networking.UploadHandlerRaw" preserve="all" />
    <type fullname="UnityEngine.Experimental.Networking.UploadHandler" preserve="all" />
    <type fullname="UnityEngine.Experimental.Networking.DownloadHandler" preserve="all" />
    <type fullname="UnityEngine.Experimental.Networking.DownloadHandlerBuffer" preserve="all" />
</assembly>

<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.Core">
	<type fullname="Amazon.Util.Internal.PlatformServices.NetworkReachability" preserve="all"/>
   <namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
</assembly>
<assembly fullname="AWSSDK.CognitoIdentity">
   <namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
</assembly>
<assembly fullname="AWSSDK.SecurityToken">
   <namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
</assembly>
<assembly fullname="AWSSDK.DynamoDBv2" preserve="all"/>

</linker>

This is a silly question, but where is link.xml meant to be? In /Assets ? Is that the assembly root?

I ran into this to trying to get GameLift to work. No combination of anything I tried could make this work. The solution was to refer to the example unity project amazon provides with their AWSSDK.

Basically, just include this in the base Assets folder:

https://github.com/aws/aws-sdk-net/blob/master/sdk/test/Unity/Unity3DTests/Assets/link.xml

Once I did this, and rebuilt projects, it just magically worked.

Had a slightly different link.xml, moved it to the root of the asset folder, really not sure if it was this or changing from IL2CPP to Mono but finally got it working.

 <linker>
 
 <assembly fullname="UnityEngine">
     <type fullname="UnityEngine.Experimental.Networking.UnityWebRequest" preserve="all" />
     <type fullname="UnityEngine.Experimental.Networking.UploadHandlerRaw" preserve="all" />
     <type fullname="UnityEngine.Experimental.Networking.UploadHandler" preserve="all" />
     <type fullname="UnityEngine.Experimental.Networking.DownloadHandler" preserve="all" />
     <type fullname="UnityEngine.Experimental.Networking.DownloadHandlerBuffer" preserve="all" />
 </assembly>
 
 <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.Core" preserve="all"/>
 <assembly fullname="AWSSDK.CognitoIdentity" preserve="all"/>
 <assembly fullname="AWSSDK.SecurityToken" preserve="all"/>
 <assembly fullname="log4net" preserve="all"/>
 <assembly fullname="System.Configuration" preserve="all"/>

 <assembly fullname="AWSSDK.Core">
     <type fullname="Amazon.Util.Internal.PlatformServices.NetworkReachability" preserve="all"/>
    <namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
 </assembly>
 <assembly fullname="AWSSDK.CognitoIdentity">
    <namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
 </assembly>
 <assembly fullname="AWSSDK.SecurityToken">
    <namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
 </assembly>
 <assembly fullname="AWSSDK.DynamoDBv2" preserve="all"/>
 
 </linker>