From bff9627dc47f12d517c96a2ba5ee929810491761 Mon Sep 17 00:00:00 2001 From: Ignacio Etcheverry Date: Fri, 12 Jan 2018 19:23:11 +0100 Subject: Mono: Some StackTrace to StackInfo[] fixes - Sometimes `StackFrame.GetMethod()` returns null (e.g.: latest frame of a `MissingMethodException`). Still not sure what to do with that frame (maybe skip it), but at least it no longer fails. - Skip `CSharpLanguage::debug_get_current_stack_info()` if an error is printed from `GDMonoUtils::update_corlib_cache()`. - Fix crash when calling `GDMonoUtils::print_unhandled_exception(exc)` if there is no ScriptDebugger attached. --- modules/mono/csharp_script.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'modules/mono/csharp_script.cpp') diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 8f8116e26e..7df2043a62 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -449,7 +449,7 @@ Vector CSharpLanguage::debug_get_current_stack_info() // Printing an error here will result in endless recursion, so we must be careful - if (!gdmono->is_runtime_initialized() && GDMono::get_singleton()->get_api_assembly()) + if (!gdmono->is_runtime_initialized() || !GDMono::get_singleton()->get_api_assembly() || !GDMonoUtils::mono_cache.corlib_cache_updated) return Vector(); MonoObject *stack_trace = mono_object_new(mono_domain_get(), CACHED_CLASS(System_Diagnostics_StackTrace)->get_mono_ptr()); @@ -503,6 +503,10 @@ Vector CSharpLanguage::stack_trace_get_info(MonoObjec return Vector(); } + // TODO + // what if the StackFrame method is null (method_decl is empty). should we skip this frame? + // can reproduce with a MissingMethodException on internal calls + sif.file = GDMonoMarshal::mono_string_to_godot(file_name); sif.line = file_line_num; sif.func = GDMonoMarshal::mono_string_to_godot(method_decl); -- cgit v1.2.3