Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullReferenceException on Unity 2017 iOS #704

Closed
haswalt opened this issue Jul 21, 2017 · 5 comments · Fixed by #709
Closed

NullReferenceException on Unity 2017 iOS #704

haswalt opened this issue Jul 21, 2017 · 5 comments · Fixed by #709
Labels

Comments

@haswalt
Copy link
Contributor

haswalt commented Jul 21, 2017

Expected Behavior

Should be able to initialise the AWS SDK and perform web requests

Current Behavior

NullReferenceException: A null value was found where an object instance was required.
  at Amazon.Runtime.Internal.UnityWebRequestWrapper..ctor () [0x00000] in <filename unknown>:0 
  at Amazon.AWSConfigs.set_HttpClient (HttpClientOption value) [0x00000] in <filename unknown>:0 
  at DownloadManager.Init () [0x00000] in <filename unknown>:0 
  at DownloadManager.get_instance () [0x00000] in <filename unknown>:0 
  at DownloadManager.Update () [0x00000] in <filename unknown>:0 
Rethrow as TypeInitializationException: The type initializer for 'Amazon.Runtime.Internal.UnityWebRequestWrapper' threw an exception.
  at Amazon.AWSConfigs.set_HttpClient (HttpClientOption value) [0x00000] in <filename unknown>:0 
  at DownloadManager.Init () [0x00000] in <filename unknown>:0 
  at DownloadManager.get_instance () [0x00000] in <filename unknown>:0 
  at DownloadManager.Update () [0x00000] in <filename unknown>:0 

Possible Solution

Steps to Reproduce (for bugs)

Create a simple scene and attach the AWS initialiser

Context

SDK is unusable

@ayushvora
Copy link

I'm also having a similar issue (immediately on app startup):

MissingMethodException: Method not found: 'Default constructor not found...ctor() of Amazon.Util.Internal.PlatformServices.NetworkReachability'.
  at System.Activator.CreateInstance (System.Type type, System.Object[] args) [0x00000] in <filename unknown>:0 
  at Amazon.Util.Internal.PlatformServices.ServiceFactory..ctor () [0x00000] in <filename unknown>:0 
  at Amazon.Util.Internal.PlatformServices.ServiceFactory..cctor () [0x00000] in <filename unknown>:0 
  at Amazon.Runtime.Internal.UnityMainThreadDispatcher.ProcessRequests () [0x00000] in <filename unknown>:0 
  at Amazon.Runtime.Internal.UnityMainThreadDispatcher.Update () [0x00000] in <filename unknown>:0 
Rethrow as TypeInitializationException: The type initializer for 'Amazon.Util.Internal.PlatformServices.ServiceFactory' threw an exception.
  at Amazon.Runtime.Internal.UnityMainThreadDispatcher.ProcessRequests () [0x00000] in <filename unknown>:0 
  at Amazon.Runtime.Internal.UnityMainThreadDispatcher.Update () [0x00000] in <filename unknown>:0 
 
(Filename: currently not available on il2cpp Line: -1)

NullReferenceException: A null value was found where an object instance was required.
  at Amazon.Runtime.Internal.UnityMainThreadDispatcher.ProcessRequests () [0x00000] in <filename unknown>:0 
  at Amazon.Runtime.Internal.UnityMainThreadDispatcher.Update () [0x00000] in <filename unknown>:0 

There's also this.

Pardon me, I have no idea how to solve it - I'm just putting these here in case they might turn out helpful in debugging the root causes.

@haswalt
Copy link
Contributor Author

haswalt commented Aug 22, 2017

@ayushvora Your issue is looking more like you're missing the link.xml mentioned here in the Unity README

@ayushvora
Copy link

Thanks @haswalt , I'll check it out.

@karsnen
Copy link

karsnen commented Mar 20, 2018

Yes for people visiting this thread and experience the same.

UnityEngine.Experimental.Networking is no longer a namespace for Unity 2017 onwards. (approx.)

Hence in your link.xml make sure you have
UnityEngine.Networking

Hence the head of link xml would be as follows
<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>

as in this document -> https://github.com/aws/aws-sdk-net/blob/master/Unity.README.md#unity-sdk-fundamentals

@Acqurius
Copy link

How to setting Link xml in Xamarin form ios Project?

My code is:

Amazon.IotData.AmazonIotDataClient c = new Amazon.IotData.AmazonIotDataClient(
                    "https://xxxxx.iot.us-east-1.amazonaws.com", awsCredentials);

Errro is
Default constructor not found for type Amazon.Util.Internal.PlatformServices.NetworkReachability
I have the same problem, btw just happen in Run App in really iphone.
In iphone simulation won't meet the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants