reown-com / reown-dotnet

Toolkits to build onchain UX
https://docs.reown.com/
Apache License 2.0
8 stars 1 forks source link

Error In Unity AppKit InitializeAsync after publish on windows #10

Closed shekaryf closed 1 month ago

shekaryf commented 1 month ago

Hi,

I`m using AppKit in my Unity project. Here is my code:

private async void Start()
    {
            await AppKit.InitializeAsync(new AppKitConfig(
                "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                new Metadata(
                    "mmmmmm",
                    "There are three different blockchain protocols that will be integrated into The My gaming stack",
                    "https://mmmmmm.net",
                    "https://mmmmmm.net/assets/images/Logo.png"
                )));
        }
    }

Every things work fine when I run project from unity. But when I publish (File>Build Settings>Platform-Windows..>Build) it on windows I get error on line: AppKit.InitializeAsync What should I do to solve this error?

This is the error:


System.ArgumentNullException: Value cannot be null.
Parameter name: method
  at Newtonsoft.Json.Utilities.ValidationUtils.ArgumentNotNull (System.Object value, System.String parameterName) [0x00000] in < >:0 
  at Newtonsoft.Json.Utilities.LateBoundReflectionDelegateFactory.CreateParameterizedConstructor (System.Reflection.MethodBase method) [0x00000] in < >:0 
  at Newtonsoft.Json.Serialization.JsonDictionaryContract.CreateWrapper (System.Object dictionary) [0x00000] in < >:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewDictionary (Newtonsoft.Json.JsonReader reader, Newtonsoft.Json.Serialization.JsonDictionaryContract contract, System.Boolean& createdFromNonDefaultCreator) [0x00000] in < >:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject (Newtonsoft.Json.JsonReader reader, System.Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, System.Object existingValue) [0x00000] in < >:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, System.Object existingValue) [0x00000] in < >:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Boolean checkAdditionalContent) [0x00000] in < >:0 
  at Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00000] in < >:0 
  at Newtonsoft.Json.JsonSerializer.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00000] in < >:0 
  at Newtonsoft.Json.JsonConvert.DeserializeObject (System.String value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) [0x00000] in < >:0 
  at Newtonsoft.Json.JsonConvert.DeserializeObject[T] (System.String value, Newtonsoft.Json.JsonSerializerSettings settings) [0x00000] in < >:0 
  at Reown.Core.Storage.FileSystemStorage.Load () [0x00000] in < >:0 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext (System.Object stateMachine) [0x00000] in < >:0 
  at System.Console+WindowsConsole..cctor () [0x00000] in < >:0 
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in < >:0 
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in < >:0 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run () [0x00000] in < >:0 
  at UnityEngine.UIElements.BaseSlider`1[TValueType].SliderLerpUnclamped (TValueType a, TValueType b, System.Single interpolant) [0x00000] in < >:0 
  at System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation+<>c.<.cctor>b__7_0 (System.Object state) [0x00000] in < >:0 
  at System.Console+WindowsConsole..cctor () [0x00000] in < >:0 
  at UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () [0x00000] in < >:0 
  at UnityEngine.UnitySynchronizationContext.Exec () [0x00000] in < >:0 
  at UnityEngine.UnitySynchronizationContext.ExecuteTasks () [0x00000] in < >:0 
--- End of stack trace from previous location where exception was thrown ---
complete error file:
[error2.txt](https://github.com/user-attachments/files/17459935/error2.txt)
skibitsky commented 1 month ago

Hello,

Could you please try setting Managed Code Stripping Level to Minimal in the Player Settings?

shekaryf commented 1 month ago

Perfect!, it works; Thank you