Search Issue Tracker

By Design

Votes

0

Found in

2020.3.48f1

2021.3.26f1

2022.2.19f1

2023.1.0b18

2023.2.0a16

Issue ID

UUM-36600

Regression

No

[IL2CPP] When generating an IL2CPP build, the method signature void MyMethod(List<XRNodeState>), results in a marshal directive exception being generated

-

Steps to reproduce:
1. Open the attached project "il2cppTest.zip"
2. Make sure IL2CPP is selected
3. Perform a Standalone Build
4. Navigate to "il2cppTest\Build\il2cppTest_BackUpThisFolder_ButDontShipItWithYourGame\il2cppOutput\Assembly-CSharp.cpp"
5. Observe the marshal directive exception being generated

Expected results: When generating an IL2CPP build, the underlying implementation function is called and exception is not generated
Actual Results: When generating an IL2CPP build, the method signature void MyMethod(List<XRNodeState>), results in a marshal directive exception being generated

Reproducible in: 2020.3.48f1, 2021.3.26f1, 2022.2.19f1, 2023.1.0b18, 2023.2.0a16

Tested environment: Windows 10

Notes:
-Full exception:
extern "C" void DEFAULT_CALL ReversePInvokeWrapper_NewBehaviourScript_MyMethod_m8B322288435972946310777DC26729D81E23C10C(List_1_t8AE5A65CCFBC753343962D38B82C801F7BDE3C87* ___0_nodeStates)
{
IL2CPP_RAISE_MANAGED_EXCEPTION(il2cpp_codegen_get_marshal_directive_exception("Cannot marshal type 'System.Collections.Generic.List`1<UnityEngine.XR.XRNodeState>'."), NULL);
}
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NewBehaviourScript_Start_mDEAA416D3A6676A79851DDF6B62D676E53372A87 (NewBehaviourScript_t89363A736D121ACCCE70DC36A66775D2F1D42CF7* __this, const RuntimeMethod* method)
{
//..... Correct code here, but not called.
}

  1. Resolution Note:

    System.Collections.List<T> is not a type supported for P/Invoke marshaling. Throwing a marshal directive exception is the expected behavior.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.