Fix regression from recent scripting fixes/features on 1.5

This commit is contained in:
Wojciech Figat
2023-01-10 16:13:53 +01:00
parent eebc4951de
commit 6ef5c76e1a
3 changed files with 11 additions and 5 deletions

View File

@@ -47,6 +47,7 @@ jobs:
# Tests on Windows
tests-windows:
if: ${{ false }}
name: Tests (Windows)
runs-on: "windows-2022"
steps:

View File

@@ -2931,10 +2931,15 @@ namespace FlaxEngine
genericParamTypes.Add(type);
}
string typeName = $"FlaxEngine.NativeInterop+Invoker+Invoker{(method.IsStatic ? "Static" : "")}{(method.ReturnType != typeof(void) ? "Ret" : "NoRet")}{parameterTypes.Length}{(genericParamTypes.Count > 0 ? "`" + genericParamTypes.Count : "")}";
Type invokerType = genericParamTypes.Count == 0 ? Type.GetType(typeName) : Type.GetType(typeName).MakeGenericType(genericParamTypes.ToArray());
methodDelegate = invokerType.GetMethod(nameof(Invoker.InvokerStaticNoRet0.InvokeThunk), BindingFlags.Static | BindingFlags.NonPublic).CreateDelegate<Invoker.InvokeThunkDelegate>();
methodDelegateContext = invokerType.GetMethod(nameof(Invoker.InvokerStaticNoRet0.CreateInvokerDelegate), BindingFlags.Static | BindingFlags.NonPublic).Invoke(null, new object[] { method });
string invokerTypeName = $"FlaxEngine.NativeInterop+Invoker+Invoker{(method.IsStatic ? "Static" : "")}{(method.ReturnType != typeof(void) ? "Ret" : "NoRet")}{parameterTypes.Length}{(genericParamTypes.Count > 0 ? "`" + genericParamTypes.Count : "")}";
Type invokerType = Type.GetType(invokerTypeName);
if (invokerType != null)
{
if (genericParamTypes.Count != 0)
invokerType = invokerType.MakeGenericType(genericParamTypes.ToArray());
methodDelegate = invokerType.GetMethod(nameof(Invoker.InvokerStaticNoRet0.InvokeThunk), BindingFlags.Static | BindingFlags.NonPublic).CreateDelegate<Invoker.InvokeThunkDelegate>();
methodDelegateContext = invokerType.GetMethod(nameof(Invoker.InvokerStaticNoRet0.CreateInvokerDelegate), BindingFlags.Static | BindingFlags.NonPublic).Invoke(null, new object[] { method });
}
if (methodDelegate != null)
Assert.IsTrue(methodDelegateContext != null);

View File

@@ -1342,7 +1342,7 @@ namespace Flax.Build.Bindings
// If platform supports JITed code execution then use method thunk, otherwise fallback to generic mono_runtime_invoke
var returnType = functionInfo.ReturnType;
var useThunk = buildData.Platform.HasDynamicCodeExecutionSupport;
var useThunk = false; //buildData.Platform.HasDynamicCodeExecutionSupport; // TODO: fix marshaing some types when using thunks on dotnet7
if (useThunk)
{
// Convert parameters into managed format as boxed values