Search Issue Tracker
By Design
Votes
0
Found in
5.6.0p2
Issue ID
905976
Regression
No
Incorrect marshaling of a struct in il2cpp->native call
Description:
Attached code attempts to pass a structure that contains a float[] array to native code. The il2cpp generated code contains marshaling code that copies the array by value. As a result, the side effects are not observable by managed code. if the struct is passed by reference, the changed array is copied back from native to managed code, but is not correct.
Reproduction steps:
1. Open the attached project.
2. Build and run the "main" scene for iOS.
- It performs the calls and displays the results.
Expected result:
- All three text fields should read "10, 11, 12, 13, 14".
Actual result:
- The second text field exhibits struct by value behavior (unobservable side effects).
- The third text field exhibits struct by reference behavior (incorrect unmarshaling).
Reproduced with:
5.5.3p2, 2017.1.0b3
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- [URP][Lighting] The skybox doesn't render after changing the settings of the Material when using the URP Render Pipeline
- Crash on ShaderLab::ShaderState::ApplyShaderState when entering Play Mode and calling ShaderWarmup.WarmupShaderFromCollection with a shader that has dynamic_branch
- Crash on operator delete[] when a serializable structure in the System namespace is serialized by a MonoBehaviour
- [macOS] forward and backward mouse buttons are recognized as middle mouse button
- NavMeshModifier.OnEnable/OnDisable gets progressively slower when called repeatedly
Add comment