godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.54k stars 20.65k forks source link

Running C# project can crash after editing it with VS 2019 #45557

Open magian1127 opened 3 years ago

magian1127 commented 3 years ago

Godot version:

3.2.4.rc (- 3.2.3) VS2019 + godot-csharp-visualstudio

OS/device including version:

windows 10 GeForce GTX 1060 6GB/PCIe/SSE2

Issue description:

godot Programs sometimes crash

Steps to reproduce:

Two cases

1 modify code in VS2019 2 VS2019 Press F5 mono_logs The last two lines Requesting loading reference 0 (of 2) of D:/Projects/Godot/godot/bin/GodotSharp/Tools/GodotTools.IdeMessaging.dll (in domain Mono, info) Loading reference 0 of D:/Projects/Godot/godot/bin/GodotSharp/Tools/GodotTools.IdeMessaging.dll asmctx DEFAULT, looking for netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 (in domain Mono, info) Running in VS

1 modify code in VS2019 2 Godot Press F5 mono_logs The last two lines Requesting loading reference 0 (of 2) of D:/Projects/Godot/godot/bin/GodotSharp/Tools/GodotTools.IdeMessaging.dll (in domain Mono, info) Loading reference 0 of D:/Projects/Godot/godot/bin/GodotSharp/Tools/GodotTools.IdeMessaging.dll asmctx DEFAULT, looking for netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 (in domain Mono, info) Assembly Ref addref GodotTools.IdeMessaging[000001F5957F34E0] -> netstandard[000001F5957F27F0]: 4 (in domain Mono, info) * Assertion at ..\mono\mini\mini-runtime.c:1841, conditionis_ok (error)not met, function:lookup_method, VAR 0 (T) cannot be expanded in this context with 0 instantiations (in domain , error) Running in Godot

magian1127 commented 3 years ago

Vs running debugging when Godot scene is not saved and Godot runs debugging when vs2019.cs is not saved Separation will collapse

当Godot场景没有保存 时VS运行调试 和 当vs2019.cs没有保存 时Godot运行调试 分别会崩溃

magian1127 commented 3 years ago

经过测试 JetBrains Rider 在类似情况下也会奔溃

After testing, JetBrains rider will crash in similar situations

magian1127 commented 3 years ago
CrashHandlerException: Program crashed
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[0] mono_type_is_reference
[1] mini_generic_inst_is_sharable
[2] mono_generic_context_is_sharable_full
[3] mono_method_is_generic_sharable_full
[4] mono_metadata_generic_context_equal
[5] mono_jit_compile_method_jit_only
[6] mono_jit_find_compiled_method_with_jit_info
[7] mono_type_is_valid_generic_argument
[8] mono_runtime_invoke
[9] GDMonoUtils::runtime_invoke (D:\Projects\Godot\godot\modules\mono\mono_gd\gd_mono_utils.cpp:461)
[10] GDMonoMethod::invoke_raw (D:\Projects\Godot\godot\modules\mono\mono_gd\gd_mono_method.cpp:152)
[11] GDMonoMarshal::Array_to_system_generic_list (D:\Projects\Godot\godot\modules\mono\mono_gd\gd_mono_marshal.cpp:999)
[12] GDMonoField::set_value_from_variant (D:\Projects\Godot\godot\modules\mono\mono_gd\gd_mono_field.cpp:467)
[13] CSharpInstance::set (D:\Projects\Godot\godot\modules\mono\csharp_script.cpp:1530)
[14] CSharpLanguage::reload_assemblies (D:\Projects\Godot\godot\modules\mono\csharp_script.cpp:1036)
[15] MethodBind1<_GodotSharp,bool>::call (D:\Projects\Godot\godot\core\method_bind.gen.inc:867)
[16] Object::call (D:\Projects\Godot\godot\core\object.cpp:919)
[17] MessageQueue::_call_function (D:\Projects\Godot\godot\core\message_queue.cpp:250)
[18] MessageQueue::flush (D:\Projects\Godot\godot\core\message_queue.cpp:316)
[19] SceneTree::idle (D:\Projects\Godot\godot\scene\main\scene_tree.cpp:538)
[20] Main::iteration (D:\Projects\Godot\godot\main\main.cpp:2111)
[21] OS_Windows::run (D:\Projects\Godot\godot\platform\windows\os_windows.cpp:3449)
[22] widechar_main (D:\Projects\Godot\godot\platform\windows\godot_windows.cpp:162)
[23] _main (D:\Projects\Godot\godot\platform\windows\godot_windows.cpp:186)
[24] main (D:\Projects\Godot\godot\platform\windows\godot_windows.cpp:196)
[25] __scrt_common_main_seh (d:\agent\_work\63\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
[26] BaseThreadInitThunk
-- END OF BACKTRACE --

2021-02-06_19.48.57_20580.log

magian1127 commented 3 years ago

可能是插件问题,我把他删除了就好了.

https://github.com/sitiom/Polygonizer-cs-addon

Maybe it's a plug-in problem. After I delete it, it won't crash

nobody0 commented 3 years ago

i have a very similiar crash. most of the time i dont have any logged error at all but this time i had

Loading reference 2 of F:\Godot\Godot_v3.2.3-stable_mono_win64/GodotSharp/Tools/GodotTools.dll asmctx DEFAULT, looking for GodotSharpEditor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null (in domain Mono, info)
Assembly Ref addref GodotTools[000000002ACD7930] -> GodotSharpEditor[000000002ACD76F0]: 3 (in domain Mono, info)
* Assertion at mini-runtime.c:1827, condition `is_ok (error)' not met, function:lookup_method, VAR 0 (T) cannot be expanded in this context with 0 instantiations
 (in domain , error)

it happens only when i change cs code and rebuild the change itself doesnt matter, i jsut renamed a variable and eventually it crashed it doesnt always crash either, its roughly a 30% chance

i am also using a c# addon, though not the same one but a custom one

nobody0 commented 3 years ago

disabling the plugin changes the nature of the crash. its a lot rarer (about 10% instead of 30% chance) and the engine freezes before its getting closed, while the plugin was enabled it closed instantly on build

i do have other [Tool] c# scripts in the project though edit after removing all [Tool] keywords it still sometimes crashes on build

Atlinx commented 3 years ago

I have the same error as nobody0, with my C# project sometimes crashing on build. My logs terminate with the same error of

Assembly Ref addref GodotTools[000000001EE81680] -> mscorlib[000000001EB41EA0]: 8 (in domain Mono, info)
Loading reference 2 of C:\Program Files\Godot/GodotSharp/Tools/GodotTools.dll asmctx DEFAULT, looking for GodotSharpEditor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null (in domain Mono, info)
Assembly Ref addref GodotTools[000000001EE81680] -> GodotSharpEditor[000000001EE817A0]: 3 (in domain Mono, info)
* Assertion at mini-runtime.c:1827, condition `is_ok (error)' not met, function:lookup_method, VAR 0 (T) cannot be expanded in this context with 0 instantiations
 (in domain , error)