Closed jasonboukheir closed 1 month ago
I'm also having this issue. Any resolution yet?
@AdamBebko I have a suggested fix above, but I haven't heard anything yet.
I'm away from my desktop for holidays atm, but can update next week.
I don’t know how to do that haha. I’m using the AWS SDK dlls
If it helps resolve things I’m getting the error in IOS. I also suspected code stripping being the culprit. I also don’t have log4net.dll in my project. When I do, the game won’t even boot and crashes on launch.
For me, I’m getting errors when I hit the buttons in my game that calls the methods that try to sign into or sign up for cognito. I think it’s when I create the clientprovider object.
I’ve tried playing around with link.XML in unity but no success so far.
I’ve also tried setting disablelogging = true. It that didn’t change anything.
I'm facing a similar issue; I'm trying to get a WebGL build in Unity for my game to work, so I'm also using IL2CPP. I pulled this repo, added the fix that @jasonboukheir suggested, built the Cognito and GameLift related libraries and used those in my project. At first it was promising, I got through the logger initialization error, however, when the execution proceeds, it fails later downstream when the SDK attempts to encrypt data through the UserCrypto module as it's trying to import Crypt32.dll which is a Windows native library. So it looks like I'm giving up. In any case I pushed the newly built DLLs to S3 if you guys want to give it a try in your builds. Hands on heart there's no destructive code in there. :)
In any case it would be great if the SDK team could make these modules available for platforms that require AOT compilation and don't have access to Win native libraries. I'd imagine there's plenty of use-cases where people might want to use Cognito, DynamoDB and GameLift in their Unity games on various platforms, which is quite impossible at the moment.
I ended up going slightly deeper and fixed the UserCrypt
issue as well; it seems there's a guard that should protect against this behaviour but ultimately ends up causing the failure. There's a check to see if Crypt32.dll
is available on the current system by actually calling out to the DLL, however, the exception is still bubbled up for some reason.
Fixing that, however, caused another issue where I don't even have a stack trace anymore. All it says is a StreamReader
has received a null
value somewhere, but tracking that down would take me way too long unfortunately.
Would love to hear if anyone's managed to solve this.
We have noticed this issue has not received attention in 1 year. We will close this issue for now. If you think this is in error, please feel free to comment and reopen the issue.
This is still happening:
NullReferenceException: Object reference not set to an instance of an object.
at Amazon.Runtime.Internal.Util.InternalLog4netLogger..ctor (System.Type declaringType) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.Util.Logger.GetLogger (System.Type type) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.AmazonServiceClient..ctor (Amazon.Runtime.AWSCredentials credentials, Amazon.Runtime.ClientConfig config) [0x00000] in <00000000000000000000000000000000>:0
at Framework.Core.Managers.GameLiftClientManager+<GameLiftClientInit>d__22.MoveNext () [0x00000] in <00000000000000000000000000000000>:0
at Aws.GameLift.Server.ProcessParameters+OnStartGameSessionDelegate.Invoke (Aws.GameLift.Server.Model.GameSession gameSession) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run () [0x00000] in <00000000000000000000000000000000>:0
at Framework.Utility.ScriptableEvent+ScriptableDelegate.Invoke () [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.TimerCallback.Invoke (System.Object state) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UnitySynchronizationContext.Exec () [0x00000] in <00000000000000000000000000000000>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <00000000000000000000000000000000>:0
at Framework.Core.Managers.GameLiftClientManager+<Start>d__20.MoveNext () [0x00000] in <00000000000000000000000000000000>:0
at Aws.GameLift.Server.ProcessParameters+OnStartGameSessionDelegate.Invoke (Aws.GameLift.Server.Model.GameSession gameSession) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run () [0x00000] in <00000000000000000000000000000000>:0
at Framework.Utility.ScriptableEvent+ScriptableDelegate.Invoke () [0x00000] in <00000000000000000000000000000000>:0
at Aws.GameLift.Server.ProcessParameters+OnStartGameSessionDelegate.Invoke (Aws.GameLift.Server.Model.GameSession gameSession) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.Tasks.AwaitTaskContinuation.RunCallback (System.Threading.ContextCallback callback, System.Object state, System.Threading.Tasks.Task& currentTask) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation.Run (System.Threading.Tasks.Task task, System.Boolean canInlineContinuationTask) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.Tasks.Task.FinishContinuations () [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.Tasks.Task.Finish (System.Boolean bUserDelegateExecuted) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.Tasks.Task`1[TResult].TrySetException (System.Object exceptionObject) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[TResult].SetException (System.Exception exception) [0x00000] in <00000000000000000000000000000000>:0
at Framework.Core.Managers.GameLiftClientManager+<GameLiftClientInit>d__22.MoveNext () [0x00000] in <00000000000000000000000000000000>:0
at Aws.GameLift.Server.ProcessParameters+OnStartGameSessionDelegate.Invoke (Aws.GameLift.Server.Model.GameSession gameSession) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run () [0x00000] in <00000000000000000000000000000000>:0
at Framework.Utility.ScriptableEvent+ScriptableDelegate.Invoke () [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.TimerCallback.Invoke (System.Object state) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UnitySynchronizationContext.Exec () [0x00000] in <00000000000000000000000000000000>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.TimerCallback.Invoke (System.Object state) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UnitySynchronizationContext.Exec () [0x00000] in <00000000000000000000000000000000>:0
Framework.Core.Managers.ServerLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
UnityEngine.WorkRequest:Invoke()
UnityEngine.UnitySynchronizationContext:Exec()
Edit: I built the latest SDK and it works. I'm not sure what is the difference between the download and the buillt one, but it works.
Closing this due to lack of traction and based on last comment that it's fixed with latest version of SDK. Feel free to open new issue in case problem still occurs.
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
Description
I'm getting
NullReferenceException
in my unity android build, and I sourced it toInternalLog4netLogger.ctor(Type declaringType)
. I'm still not sure if it's being caused becausegetLoggerWithTypeMethod
is null, but it seems that's the case. I figure that there's some stripping happening with IL2CPP causing this condition. I don't have log4net logging enabled in my aws config. One of my 3rd party packages is using log4net.I have a hunch there's a condition where
logMangerType
can be non-null, butgetLoggerWithTypeMethod
can be null.Reproduction Steps
Logs
Environment
Resolution
In lines 149-155:
There are conditions where
loadStatics()
can fail, butlogMangerType != null
. My suggestion is to check forloadState == LoadState.Failed
instead oflogMangerType == null
to make sure thatgetLoggerWithTypeMethod
is not null.This is a :bug: bug-report