Search Issue Tracker
By Design
Votes
0
Found in
2017.4.0f1
2018.3.0a1
2018.3.0f2
2019.1.0a1
2019.2.0a1
Issue ID
1114180
Regression
No
Editor hard crashes when using Marshal.PtrToStructure()
How to reproduce:
1. Open attached project "Example"
2. Load Scene "Simple"
3. Enter Play Mode
-----------------------------
Observe the crash
Reproduced with: 2014.4.18f1, 2018.3.3f1, 2019.1.0a14 2019.2.0a1
Note: Building project for il2cpp crashes player with il2cpp::vm::String::New
Used code:
public class GameAPI
{
[DllImport("game", CharSet = CharSet.Ansi)]
public static extern IntPtr GetStatusPtr();
public static game.ProductStatus GetStatus()
{
System.IntPtr p = GameAPI.GetStatusPtr();
return (game.ProductStatus)Marshal.PtrToStructure(p, typeof(game.ProductStatus));
}
}
-
LiamMitchell
Dec 15, 2019 12:20
Also seems like this crashes in 2019.3.0a4 unable to download attached example.
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
- Crash on when D3D12RenderPass::SetupDeviceResources when opening FBX animation preview
- Serialization errors are thrown when "com.unity.render-pipelines.core" is added as a custom package and Graphics window is opened
- Character Joints unexpectedly rotate when a ragdoll is created using the Ragdoll Wizard
- Crash on GfxDeviceD3D11Base::DrawBuffersBatchMode when rendering the Scene view
- The shared EditorBuildSettings.asset file of symlinked projects is not updated when changing the order of the Scenes in Build Settings in one of the projects
Resolution Note:
Types being marshaled from C# did not match the structs declared on the native side.