Repository: godot
Issue: Mono build thrashes stacktrace (backtrace) from GDNative
Labels: enhancement,topic:dotnet

<!-- Please search existing issues for potential duplicates before filing yours:
https://github.com/godotengine/godot/issues?q=is%3Aissue
-->

**Godot version:** v3.1.beta4.mono.official
<!-- Specify commit hash if non-official. -->

**OS/device including version:** Linux 64b
<!-- Specify GPU model and drivers if graphics-related. -->

**Issue description:**
<!-- What happened, and what was expected. -->

Without mono:
```
handle_crash: Program crashed with signal 11
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x354b0) [0x7f144a1f04b0] (??:0)
[2] /xxx/Godot_v3.1-beta4_x11_64/Godot_v3.1-beta4_x11.64() [0x956179] (??:?)
[3] /xxx/Godot_v3.1-beta4_x11_64/Godot_v3.1-beta4_x11.64() [0x20e0973] (??:?)
[4] /xxx/Godot_v3.1-beta4_x11_64/Godot_v3.1-beta4_x11.64() [0x957ea3] (??:?)
[5] godot::___godot_icall_void_String(godot_method_bind*, godot::Object const*, godot::String const&) (??:0)
[6] godot::Resource::set_name(godot::String) (??:0)
[7] godot::CPP::createMesh(Chunk*) (??:0)
[8] godot::CPP::generateChunkNodes(std::map<Vector3Int, Chunk*, std::less<Vector3Int>, std::allocator<std::pair<Vector3Int const, Chunk*> > >*) (??:0)
[9] godot::CPP::benchGenerateChunkNodes(std::map<Vector3Int, Chunk*, std::less<Vector3Int>, std::allocator<std::pair<Vector3Int const, Chunk*> > >*) (??:0)
[10] godot::CPP::_process(float) (??:0)
[11] godot_variant godot::__wrapped_method<godot::CPP, void, float>(void*, void*, void*, int, godot_variant**) (??:0)
[12] /xxx/Godot_v3.1-beta4_x11_64/Godot_v3.1-beta4_x11.64() [0xa7b338] (<artificial>:?)
[13] /xxx/Godot_v3.1-beta4_x11_64/Godot_v3.1-beta4_x11.64() [0x169444f] (??:?)
[14] /xxx/Godot_v3.1-beta4_x11_64/Godot_v3.1-beta4_x11.64() [0x9078e6] (??:?)
[15] /xxx/Godot_v3.1-beta4_x11_64/Godot_v3.1-beta4_x11.64() [0x20dd3c4] (??:?)
[16] /xxx/Godot_v3.1-beta4_x11_64/Godot_v3.1-beta4_x11.64() [0x1620dbe] (<artificial>:?)
[17] /xxx/Godot_v3.1-beta4_x11_64/Godot_v3.1-beta4_x11.64() [0x166a021] (??:?)
[18] /xxx/Godot_v3.1-beta4_x11_64/Godot_v3.1-beta4_x11.64() [0x9aef90] (??:?)
[19] /xxx/Godot_v3.1-beta4_x11_64/Godot_v3.1-beta4_x11.64() [0x7ac22d] (??:?)
[20] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7f144a1db830] (??:0)
[21] /xxx/Godot_v3.1-beta4_x11_64/Godot_v3.1-beta4_x11.64() [0x7b9c8e] (??:?)
-- END OF BACKTRACE --
```

With mono:
```
Stacktrace:

/proc/self/maps:
00400000-04197000 r-xp 00000000 fc:04 696                                /xxx/Godot_v3.1-beta4_mono_x11.64
04397000-04463000 r--p 03d97000 fc:04 696                                /xxx/Godot_v3.1-beta4_mono_x11.64
04463000-0447d000 rw-p 03e63000 fc:04 696                                /xxx/Godot_v3.1-beta4_mono_x11.64
0447d000-044ae000 rw-p 00000000 00:00 0 
04628000-0e7d9000 rw-p 00000000 00:00 0                                  [heap]
40035000-40045000 rwxp 00000000 00:00 0 
40777000-40797000 rwxp 00000000 00:00 0 
4113b000-411ed000 rw-p 00000000 00:00 0 
412b4000-412b6000 r-xs 00000000 fc:01 2359682                            /tmp/.glkuIqcW (deleted)
413c9000-413d9000 rwxp 00000000 00:00 0 
41432000-41442000 rwxp 00000000 00:00 0 
7fd5ab7ff000-7fd5abbff000 rw-s 00000000 00:06 622                        /dev/nvidiactl
7fd5abbff000-7fd5abfff000 rw-s 00000000 00:06 622                        /dev/nvidiactl
7fd5abfff000-7fd5b0000000 rw-p 00000000 00:00 0 
7fd5b0000000-7fd5b0021000 rw-p 00000000 00:00 0 
7fd5b0021000-7fd5b4000000 ---p 00000000 00:00 0 
7fd5b43fe000-7fd5b47fe000 rw-s 00000000 00:06 622                        /dev/nvidiactl
7fd5b47fe000-7fd5b8000000 rw-p 00000000 00:00 0 
7fd5b8000000-7fd5b8021000 rw-p 00000000 00:00 0 
7fd5b8021000-7fd5bc000000 ---p 00000000 00:00 0 
7fd5bc000000-7fd5bc021000 rw-p 00000000 00:00 0 
7fd5bc021000-7fd5c0000000 ---p 00000000 00:00 0 
7fd5c0000000-7fd5c0021000 rw-p 00000000 00:00 0 
7fd5c0021000-7fd5c4000000 ---p 00000000 00:00 0 
7fd5c41fd000-7fd5c45fd000 rw-s 00000000 00:06 622                        /dev/nvidiactl

Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
```

**Steps to reproduce:**
Run crashing C++ code using GDNative in Godot mono build.

<!--**Minimal reproduction project:**-->
<!-- Recommended as it greatly speeds up debugging. Drag and drop a zip archive to upload it. -->