diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-23 13:56:06 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-23 13:56:06 +0100 |
commit | e0de3573f3fc86062763152f5a1ac62f5a986da3 (patch) | |
tree | 39fe77bf8cc5b395e33a4176602c95f8c7f7c53f | |
parent | 13382a88dfab32f3ce56560756926df3349e3422 (diff) | |
parent | 6b050a35024933cf5b43ea0a9e950fc70297d5de (diff) |
Merge pull request #73815 from RedworkDE/net-missing-editor-message
C#: Fix editor crashing without a message when .NET is not installed
-rw-r--r-- | modules/mono/mono_gd/gd_mono.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp index 86b0e04206..8bcfc5a5eb 100644 --- a/modules/mono/mono_gd/gd_mono.cpp +++ b/modules/mono/mono_gd/gd_mono.cpp @@ -271,7 +271,12 @@ godot_plugins_initialize_fn initialize_hostfxr_and_godot_plugins(bool &r_runtime load_assembly_and_get_function_pointer_fn load_assembly_and_get_function_pointer = initialize_hostfxr_for_config(get_data(config_path)); - ERR_FAIL_NULL_V(load_assembly_and_get_function_pointer, nullptr); + + if (load_assembly_and_get_function_pointer == nullptr) { + // Show a message box to the user to make the problem explicit (and explain a potential crash). + OS::get_singleton()->alert(TTR("Unable to load .NET runtime, no compatible version was found.\nAttempting to create/edit a project will lead to a crash.\n\nPlease install the .NET SDK 6.0 or later from https://dotnet.microsoft.com/en-us/download and restart Godot."), TTR("Failed to load .NET runtime")); + ERR_FAIL_V_MSG(nullptr, ".NET: Failed to load compatible .NET runtime"); + } r_runtime_initialized = true; @@ -394,6 +399,9 @@ void GDMono::initialize() { ERR_FAIL_MSG(".NET: Failed to load hostfxr"); } #else + + // Show a message box to the user to make the problem explicit (and explain a potential crash). + OS::get_singleton()->alert(TTR("Unable to load .NET runtime, specifically hostfxr.\nAttempting to create/edit a project will lead to a crash.\n\nPlease install the .NET SDK 6.0 or later from https://dotnet.microsoft.com/en-us/download and restart Godot."), TTR("Failed to load .NET runtime")); ERR_FAIL_MSG(".NET: Failed to load hostfxr"); #endif } |