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.
}
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- “Remove Unused Overrides” available on not loaded Scene and throws “ArgumentException: The scene is not loaded” warning
- Adaptive Probe Volume occlusion edge is calculated incorrectly when viewing probes near geometry edges
- Sampling a texture using an HLSL file throws shader errors and the code does not compile
- "Graphics.CopyTexture called with null source texture" error when Base Camera of an Overlay Camera is removed with DX11 Graphics API and Compatibility Mode enabled
- WebGL sends wrong value with large numbers when SendMessage function is used
Resolution Note:
System.Collections.List<T> is not a type supported for P/Invoke marshaling. Throwing a marshal directive exception is the expected behavior.