Uno.InvalidCastException only triggered on android

get this error only when im running on android

ERROR: Invalid cast
    Uno.InvalidCastException occured.
       at PaypalJS.SetConfig(Fuse.Scripting.Context,object[])
       at Fuse.Scripting.NativeFunction.NativeFunctionClosure.Callback(object[])
       at Fuse.Scripting.V8.Marshaller.CallbackWrapper.Call(Fuse.Scripting.V8.Simple.JSValue[],Fuse.Scripting.V8.Simple.JSValue&)
       at Fuse.Scripting.V8.V8SimpleExtensions.Call(Fuse.Scripting.V8.Simple.JSFunction,Fuse.Scripting.V8.Simple.JSContext,Fuse.Scripting.V8.Simple.JSObject,Fuse.Scripting.V8.Simple.JSValue[],Fuse.Scripting.V8.AutoReleasePool,Uno.Action<Fuse.Scripting.V8.Simple.JSScriptException>)
       at Fuse.Scripting.V8.Object.CallMethod(string,object[])
       at Fuse.Scripting.ClassInstance.CallMethod(Fuse.Scripting.Function,object[])
       at Fuse.Reactive.RootableScriptModule.CallModuleFunc(Fuse.Scripting.Function,object[])
       at Fuse.Scripting.ScriptModule.Evaluate(Fuse.Scripting.Context,Fuse.Scripting.ModuleResult)
       at Fuse.Reactive.RootableScriptModule.Evaluate(Fuse.Scripting.Context,Fuse.Scripting.ModuleResult)
       at Fuse.Scripting.Module.Evaluate(Fuse.Scripting.Context,string)
       at Fuse.Reactive.JavaScript.EvaluateModule()
       at Fuse.Reactive.JavaScript.EvaluateExports()
       at Fuse.Reactive.JavaScript.EvaluateDataContext.Evaluate()
       at Fuse.Reactive.ThreadWorker.RunInner()
       at Fuse.Reactive.ThreadWorker.Run()

code

object[] SetConfig(Fuse.Scripting.Context c, object[] args)
      {
            Fuse.Scripting.Object config = null;

            if (args.Length <1){
                  debug_log "Please input a valid config object";
                  return null;
            }
            try{
                  config = (Fuse.Scripting.Object) args[0];

            }catch(Exception e){
                  debug_log e.Message;
                  debug_log args[0].GetType();
                  return null;
            }

         .....

      }

object expected is a Fuse.Scripting.Object returned from

object NewPaypalConfiguration(Context c, object[] args)
      {
            if (args.Length < 3){
                  return null;
            }


            Fuse.Scripting.Object config = c.NewObject();
            config["ClientID"] = args[1];
            config["MerchantName"] = args[2];
            config["ENVIRONMENT"] = args[0];

            return config;
      }

build command - fuse preview . -t=android -DGRADLE
Fuse version 0.35.0 (build 10867)
windows 10

Hey!

Thanks for your report. Have you included all the relevant code? Since there’s a try-catch around the cast I can’t see any code in SetConfig that this exception could originate from.

The code looks like it should work to me, so it could be an issue with what’s being passed to SetConfig. Perhaps you can add some more logging to find out what the problem is?

Cheers!

hey, took a while but i tracked down the issue to where one of the keys in my object was the value to a enum that i was casting to

Hi,
Could you provide the PayPal code source with UNO.