mirror of
https://github.com/godotengine/godot.git
synced 2025-11-03 15:11:19 +00:00
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.
This commit is contained in:
parent
feb843da2b
commit
bff9627dc4
4 changed files with 38 additions and 6 deletions
|
|
@ -449,7 +449,7 @@ Vector<ScriptLanguage::StackInfo> 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<StackInfo>();
|
||||
|
||||
MonoObject *stack_trace = mono_object_new(mono_domain_get(), CACHED_CLASS(System_Diagnostics_StackTrace)->get_mono_ptr());
|
||||
|
|
@ -503,6 +503,10 @@ Vector<ScriptLanguage::StackInfo> CSharpLanguage::stack_trace_get_info(MonoObjec
|
|||
return Vector<StackInfo>();
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue