aws / aws/aws-sdk-net

Unity exception with 2022.3.18 ambigouous reference while UnityInitializer script on android device. IOS and editor is working fine.

Open
#3,568 6 comments 0 reactions 0 assignees View on GitHub
bug module/unity p3 queued
Dominant language
C#
Stars
140
Forks
891
Avg merge
21h 51m
Merged PRs (30d)
10

Description

### Describe the bug

AmbiguousMatchException: Ambiguous match found.
System.RuntimeType.GetMethodImplCommon (System.String name, System.Int32 genericParameterCount, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Reflection.CallingConventions callConv, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) (at <00000000000000000000000000000000>:0)
System.RuntimeType.GetMethodImpl (System.String name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Reflection.CallingConventions callConv, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) (at <00000000000000000000000000000000>:0)
Amazon.Util.Internal.AndroidInterop.GetStaticJavaField[T] (System.String className, System.String methodName) (at <00000000000000000000000000000000>:0)
Amazon.Util.Internal.AmazonHookedPlatformInfo.Init () (at <00000000000000000000000000000000>:0)
Amazon.Util.Internal.AmazonHookedPlatformInfo.get_Instance () (at <00000000000000000000000000000000>:0)
Amazon.UnityInitializer.Awake () (at <00000000000000000000000000000000>:0)
UnityEngine.GameObject.AddComponent[T] () (at <00000000000000000000000000000000>:0)
Amazon.UnityInitializer.AttachToGameObject (UnityEngine.GameObject gameObject) (at <00000000000000000000000000000000>:0)
AWSManager.Initialize (System.String gToken) (at <00000000000000000000000000000000>:0)
Bootstrap.InitializeGoogleDependencies (Assets.SimpleGoogleSignIn.Scripts.UserInfo user, System.String googleToken) (at <00000000000000000000000000000000>:0)
Bootstrap+d__20.MoveNext () (at <00000000000000000000000000000000>:0)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <00000000000000000000000000000000>:0)
UnityEngine.GameObject:AddComponent()
Amazon.UnityInitializer:AttachToGameObject(GameObject)
AWSManager:Initialize(String)
Bootstrap:InitializeGoogleDependencies(UserInfo, String)
d__20:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

I'm gettting this exception on android device while calling the : Amazon.UnityInitializer.AttachToGameObject(gameObject);

### Regression Issue

- [ ] Select this option if this issue appears to be a regression.

### Expected Behavior

Should not throw exception.

### Current Behavior

mbiguousMatchException: Ambiguous match found.
System.RuntimeType.GetMethodImplCommon (System.String name, System.Int32 genericParameterCount, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Reflection.CallingConventions callConv, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) (at <00000000000000000000000000000000>:0)
System.RuntimeType.GetMethodImpl (System.String name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Reflection.CallingConventions callConv, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) (at <00000000000000000000000000000000>:0)
Amazon.Util.Internal.AndroidInterop.GetStaticJavaField[T] (System.String className, System.String methodName) (at <00000000000000000000000000000000>:0)
Amazon.Util.Internal.AmazonHookedPlatformInfo.Init () (at <00000000000000000000000000000000>:0)
Amazon.Util.Internal.AmazonHookedPlatformInfo.get_Instance () (at <00000000000000000000000000000000>:0)
Amazon.UnityInitializer.Awake () (at <00000000000000000000000000000000>:0)
UnityEngine.GameObject.AddComponent[T] () (at <00000000000000000000000000000000>:0)
Amazon.UnityInitializer.AttachToGameObject (UnityEngine.GameObject gameObject) (at <00000000000000000000000000000000>:0)
AWSManager.Initialize (System.String gToken) (at <00000000000000000000000000000000>:0)
Bootstrap.InitializeGoogleDependencies (Assets.SimpleGoogleSignIn.Scripts.UserInfo user, System.String googleToken) (at <00000000000000000000000000000000>:0)
Bootstrap+d__20.MoveNext () (at <00000000000000000000000000000000>:0)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <00000000000000000000000000000000>:0)
UnityEngine.GameObject:AddComponent()
Amazon.UnityInitializer:AttachToGameObject(GameObject)
AWSManager:Initialize(String)
Bootstrap:InitializeGoogleDependencies(UserInfo, String)
d__20:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

### Reproduction Steps

Just use : Amazon.UnityInitializer.AttachToGameObject(gameObject);

### Possible Solution

To Work Fine with init.

### Additional Information/Context

No

### AWS .NET SDK and/or Package version used

AWSSDK unity updated.

### Targeted .NET Platform

.Net 2.1

### Operating System and version

Android.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Android failure from Amazon.UnityInitializer.AttachToGameObject(gameObject) in Unity 2022.3.18, then trace the stack through AmazonHookedPlatformInfo.Init and AndroidInterop.GetStaticJavaField. Compare the Android behavior with the working iOS and editor cases; done means initialization completes without AmbiguousMatchException on Android.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, unity
Domain
game-dev, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.