Search Issue Tracker

Won't Fix

Votes

0

Found in

2018.4

2020.2

2020.2.0a12

Issue ID

1254155

Regression

No

Editor crashes on mono_string_new_checked when calling an extern function from DLL with a wrong return type

Mono

-

Reproduction steps:
1. Open the attached "case_1254155.zip" project
2. Load the "SampleScene"
3. Enter Play mode
-- Observe the crash

Reproducible with: 2018.4.23f1, 2019.3.16f1, 2019.4.0f1, 2020.1.0b13, 2020.2.0a15

Note: in Unity 2018.4 the Editor silently crashes without any stack trace

First lines of the stack trace:
0x00007FFE506BC6C6 (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\metadata\object.c:6350] mono_string_new_checked
0x00007FFE5068C636 (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\metadata\marshal.c:333] ves_icall_string_new_wrapper
ERROR: SymGetSymFromAddr64, GetLastError: 'The specified module could not be found.' (Address: 00000227DD014628)
ERROR: SymGetModuleInfo64, GetLastError: 'A dynamic link library (DLL) initialization routine failed.' (Address: 00000227DD014628)
0x00000227DD014628 ((<unknown>)) (function-name not available)
0x0000022839928F83 (Mono JIT Code) (wrapper managed-to-native) Test:GetKeyboardLayout (int)
0x0000022839928DEB (Mono JIT Code) [D:\Downloads\case_1254155\Assets\Test.cs:14] Test:Start ()
<...>

  1. Response avatar

    Resolution Note:

    Crash is a result of user error and the way mono handles pinvokes providing incorrect data to native functions. The stack provided in the editor log when the crash occurs provides the user with enough information to determine the cause. https://www.mono-project.com/docs/advanced/pinvoke/

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.