1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

C#: Begin move to .NET Core

We're targeting .NET 5 for now to make development easier while
.NET 6 is not yet released.

TEMPORARY REGRESSIONS
---------------------

Assembly unloading is not implemented yet. As such, many Godot
resources are leaked at exit. This will be re-implemented later
together with assembly hot-reloading.
This commit is contained in:
Ignacio Roldán Etcheverry
2021-09-12 20:23:05 +02:00
parent 513ee857a9
commit f9a67ee9da
96 changed files with 2475 additions and 5615 deletions

View File

@@ -32,7 +32,6 @@
#include "csharp_script.h"
#include "mono_gd/gd_mono_cache.h"
#include "mono_gd/gd_mono_utils.h"
#ifdef GD_MONO_HOT_RELOAD
SelfList<ManagedCallable>::List ManagedCallable::instances;
@@ -52,12 +51,8 @@ bool ManagedCallable::compare_equal(const CallableCustom *p_a, const CallableCus
}
// Call Delegate's 'Equals'
MonoException *exc = nullptr;
MonoBoolean res = GDMonoCache::cached_data.methodthunk_DelegateUtils_DelegateEquals
.invoke(a->delegate_handle,
b->delegate_handle, &exc);
UNHANDLED_EXCEPTION(exc);
return (bool)res;
return GDMonoCache::managed_callbacks.DelegateUtils_DelegateEquals(
a->delegate_handle, b->delegate_handle);
}
bool ManagedCallable::compare_less(const CallableCustom *p_a, const CallableCustom *p_b) {
@@ -92,27 +87,15 @@ void ManagedCallable::call(const Variant **p_arguments, int p_argcount, Variant
r_call_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; // Can't find anything better
r_return_value = Variant();
MonoException *exc = nullptr;
GDMonoCache::cached_data.methodthunk_DelegateUtils_InvokeWithVariantArgs
.invoke(delegate_handle, p_arguments,
p_argcount, &r_return_value, &exc);
GDMonoCache::managed_callbacks.DelegateUtils_InvokeWithVariantArgs(
delegate_handle, p_arguments, p_argcount, &r_return_value);
if (exc) {
GDMonoUtils::set_pending_exception(exc);
} else {
r_call_error.error = Callable::CallError::CALL_OK;
}
r_call_error.error = Callable::CallError::CALL_OK;
}
void ManagedCallable::release_delegate_handle() {
if (delegate_handle.value) {
MonoException *exc = nullptr;
GDMonoCache::cached_data.methodthunk_GCHandleBridge_FreeGCHandle.invoke(delegate_handle, &exc);
if (exc) {
GDMonoUtils::debug_print_unhandled_exception(exc);
}
GDMonoCache::managed_callbacks.GCHandleBridge_FreeGCHandle(delegate_handle);
delegate_handle = GCHandleIntPtr();
}
}