From a9a45ee7ee551e931b8aed3b9f5cebbc82de14b0 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Wed, 10 Nov 2021 17:31:54 +0100 Subject: [PATCH] Move Mono unhandled exception setting to be located within a subsection Settings that aren't within a subsection are difficult to reach when other settings do have a subsection. This also adds documentation for the project setting. --- doc/classes/ProjectSettings.xml | 4 +++- main/main.cpp | 2 +- modules/mono/mono_gd/gd_mono.cpp | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 205987f5be..80ef73d824 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -1315,7 +1315,9 @@ - + + The policy to use for unhandled Mono (C#) exceptions. The default "Terminate Application" exits the project as soon as an unhandled exception is thrown. "Log Error" logs an error message to the console instead, and will not interrupt the project execution when an unhandled exception is thrown. + [b]Note:[/b] The unhandled exception policy is always set to "Log Error" in the editor, which also includes C# [code]tool[/code] scripts running within the editor as well as editor plugin code. Default cell size for 2D navigation maps. See [method NavigationServer2D.map_set_cell_size]. diff --git a/main/main.cpp b/main/main.cpp index eb6e69e256..7355493677 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -2050,7 +2050,7 @@ bool Main::start() { GLOBAL_DEF("mono/debugger_agent/wait_timeout", 3000); GLOBAL_DEF("mono/profiler/args", "log:calls,alloc,sample,output=output.mlpd"); GLOBAL_DEF("mono/profiler/enabled", false); - GLOBAL_DEF("mono/unhandled_exception_policy", 0); + GLOBAL_DEF("mono/runtime/unhandled_exception_policy", 0); #endif DocTools doc; diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp index f3e83b26b9..52447bc59b 100644 --- a/modules/mono/mono_gd/gd_mono.cpp +++ b/modules/mono/mono_gd/gd_mono.cpp @@ -504,7 +504,7 @@ void GDMono::_init_godot_api_hashes() { } void GDMono::_init_exception_policy() { - PropertyInfo exc_policy_prop = PropertyInfo(Variant::INT, "mono/unhandled_exception_policy", PROPERTY_HINT_ENUM, + PropertyInfo exc_policy_prop = PropertyInfo(Variant::INT, "mono/runtime/unhandled_exception_policy", PROPERTY_HINT_ENUM, vformat("Terminate Application:%s,Log Error:%s", (int)POLICY_TERMINATE_APP, (int)POLICY_LOG_ERROR)); unhandled_exception_policy = (UnhandledExceptionPolicy)(int)GLOBAL_DEF(exc_policy_prop.name, (int)POLICY_TERMINATE_APP); ProjectSettings::get_singleton()->set_custom_property_info(exc_policy_prop.name, exc_policy_prop);