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

[unity] 1.4.2版本不支持c# ref. #48

Open
JiangJie opened this issue Dec 11, 2023 · 2 comments
Open

[unity] 1.4.2版本不支持c# ref. #48

JiangJie opened this issue Dec 11, 2023 · 2 comments

Comments

@JiangJie
Copy link

JiangJie commented Dec 11, 2023

error log | 日志或报错信息

index.js:173 InvokeJSFunction error Error: invalid arguments to RefTestPipeLine
at ThrowException (index.js:163:1)
at _ThrowException (c8786011b274598b159335e407f3f8b3.js:3:98956)
at dynCall_vii (2366eda307ca76456a516f79d46497eb.wasm:0x3d02b7)
at invoke_vii (c8786011b274598b159335e407f3f8b3.js:3:360497)
at PuertsDLL_ThrowException_m649ACB27F7E80A3C93CD4C0641621D2B37BEBC6F (2366eda307ca76456a516f79d46497eb.wasm:0x6fc2f1)
at dynCall_viii (2366eda307ca76456a516f79d46497eb.wasm:0x3d0227)
at invoke_viii (c8786011b274598b159335e407f3f8b3.js:3:360658)
at MethodReflectionWrap_Invoke_mF9AEE20BD41E812FE99BDC13BD5A99594D30AEC2 (2366eda307ca76456a516f79d46497eb.wasm:0x7d7d02)
at dynCall_viiiiii (2366eda307ca76456a516f79d46497eb.wasm:0x3d0156)
at invoke_viiiiii (c8786011b274598b159335e407f3f8b3.js:3:364193)
at JsEnv_InvokeCallback_m813280B404B0334196335964EE1548C709004CD0 (2366eda307ca76456a516f79d46497eb.wasm:0x87572b)
at dynCall_viiiiiii (2366eda307ca76456a516f79d46497eb.wasm:0x3d012c)
at invoke_viiiiiii (c8786011b274598b159335e407f3f8b3.js:3:363341)
at StaticCallbacks_JsEnvCallbackWrap_mEF53CEBB363348A8942F2EF45BA895A0B9B153FF (2366eda307ca76456a516f79d46497eb.wasm:0x5c8654)
at legalstub$dynCall_viiiiji (2366eda307ca76456a516f79d46497eb.wasm:0x3aea23)
at invoke_viiiiji (c8786011b274598b159335e407f3f8b3.js:3:381755)
at legalfunc$invoke_viiiiji (2366eda307ca76456a516f79d46497eb.wasm:0x9ffd1)
at ReversePInvokeWrapper_StaticCallbacks_JsEnvCallbackWrap_mEF53CEBB363348A8942F2EF45BA895A0B9B153FF (2366eda307ca76456a516f79d46497eb.wasm:0x691d1c)
at DelegatePInvokeWrapper_V8FunctionCallback_t7810CA6756BE87A6C008C86527A6B44A5001216E (2366eda307ca76456a516f79d46497eb.wasm:0xa30fa6)
at legalstub$dynCall_viiiiiji (2366eda307ca76456a516f79d46497eb.wasm:0x3aea5b)
at invoke_viiiiiji (c8786011b274598b159335e407f3f8b3.js:3:380356)
at legalfunc$invoke_viiiiiji (2366eda307ca76456a516f79d46497eb.wasm:0x72568)
at WebGL_CallV8FunctionCallback_m0283FC5620AE3F1A28E311065DA51E12B3E3F04F (2366eda307ca76456a516f79d46497eb.wasm:0x41e3ef)
at dynCall_viiiiii (2366eda307ca76456a516f79d46497eb.wasm:0x3d0156)
at invoke_viiiiii (c8786011b274598b159335e407f3f8b3.js:3:364193)
at ReversePInvokeWrapper_WebGL_CallV8FunctionCallback_m0283FC5620AE3F1A28E311065DA51E12B3E3F04F (2366eda307ca76456a516f79d46497eb.wasm:0x691a5a)
at dynCall_viiiii (2366eda307ca76456a516f79d46497eb.wasm:0x3d01bd)
at PuertsJSEngine.callV8FunctionCallback (library.js:365:1)
at ctor.RefTestPipeLine (library.js:358:1)
at JSFunction.init [as _func] (puerts_browser_js_resources.js:36:16)
at JSFunction.invoke (library.js:88:1)
at InvokeJSFunction (index.js:169:1)
at _InvokeJSFunction (c8786011b274598b159335e407f3f8b3.js:3:38802)
at dynCall_iii (2366eda307ca76456a516f79d46497eb.wasm:0x3d0544)
at invoke_iii (c8786011b274598b159335e407f3f8b3.js:3:360152)
at PuertsDLL_InvokeJSFunction_m1FBF68DFAEC8086E082384BC30854927A029F2DF (2366eda307ca76456a516f79d46497eb.wasm:0x6fec13)
at dynCall_iiii (2366eda307ca76456a516f79d46497eb.wasm:0x3d0529)
at invoke_iiii (c8786011b274598b159335e407f3f8b3.js:3:360830)
at GenericDelegate_Action_TisRuntimeObject_m99B96B639DAC59CF5A9CC740F43FCF6669344096_gshared (2366eda307ca76456a516f79d46497eb.wasm:0x2e07e8)
at Action_1_Invoke_m69C8773D6967F3B224777183E24EA621CE056F8F_inline(:50603/Action_1_t10DCB0C07D0D3C565CEACADC80D1152B35A45F6C*, bool, MethodInfo const*) (http://localhost:50603/Build/2366eda307ca76456a516f79d46497eb.wasm)
at dynCall_viii (2366eda307ca76456a516f79d46497eb.wasm:0x3d0227)
at invoke_viii (c8786011b274598b159335e407f3f8b3.js:3:360658)
at PuertsTest_Start_m2B90DABD57910323A14FE6FE2C578F85526DD7C1 (2366eda307ca76456a516f79d46497eb.wasm:0x6fbc33)
at RuntimeInvoker_TrueVoid_t4861ACF8F4594C3437BB48B6E56783494B843915(:50603/void ()(), MethodInfo const, void*, void**, void*) (http://localhost:50603/Build/2366eda307ca76456a516f79d46497eb.wasm)
at il2cpp::vm::Runtime::InvokeWithThrow(:50603/MethodInfo const*, void*, void**) (http://localhost:50603/Build/2366eda307ca76456a516f79d46497eb.wasm)
at dynCall_iiii (2366eda307ca76456a516f79d46497eb.wasm:0x3d0529)
at invoke_iiii (c8786011b274598b159335e407f3f8b3.js:3:360830)
at il2cpp::vm::Runtime::Invoke(:50603/MethodInfo const*, void*, void**, Il2CppException**) (http://localhost:50603/Build/2366eda307ca76456a516f79d46497eb.wasm)
at il2cpp_runtime_invoke (2366eda307ca76456a516f79d46497eb.wasm:0x1b6238)
at ScriptingInvocation::Invoke(:50603/ScriptingExceptionPtr*, bool) (http://localhost:50603/Build/2366eda307ca76456a516f79d46497eb.wasm)

context | 编译/运行环境

Unity 2021.3.18

how to reproduce | 复现步骤

  1. 基于8_UnitTest项目
  2. 增加ref测试用例
public void RefTestPipeLine(ref TestObject refArg, Func<TestObject, int> JSValueHandler)
{
    UnityEngine.Debug.Log($"TestCase RefTestPipeLine {refArg == null}");

    if (refArg == null)
    {
        refArg = new TestObject(3);
    }

    AssertAndPrint("JSGetRefArgFromCS", refArg.value == 3);
    AssertAndPrint("CSGetRefReturnFromJS", JSValueHandler(refArg) == 3);
}
const refNativeObject = puerts.$ref(null);
testHelper.RefTestPipeLine(refNativeObject, function (cObject) {
    assertAndPrint("JSGetRefArgFromCS", cObject.value === 3);
    return cObject.value;
});
assertAndPrint("JSGetRefArgFromCS", puerts.$unref(refNativeObject).value === 3);
@JiangJie
Copy link
Author

同时验证了v2.0.3不存在此问题。

@JiangJie
Copy link
Author

增加了测试用例 #49

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

No branches or pull requests

1 participant