Skip to content

Not working with Unity 6 #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kantagara opened this issue Dec 10, 2024 · 2 comments · May be fixed by #9
Open

Not working with Unity 6 #8

kantagara opened this issue Dec 10, 2024 · 2 comments · May be fixed by #9

Comments

@kantagara
Copy link

Error: IL2CPP error for method 'System.Void System.Threading.<>_GenericWrapper::.ctor(System.Action1<T>)' in assembly 'E:\Projekti\Unity\Gundy Fishing - Copy\Library\Bee\artifacts\WebGL\ManagedStripped\mscorlib.dll' System.InvalidOperationException: Attempting to return from void method 'System.Void System.Threading.<>_GenericWrapper::.ctor(System.Action1)' when there are values on the stack. Is this invalid IL code?

@StephenHodgson
Copy link

@kantagara see #6 (comment)

@StephenHodgson
Copy link

StephenHodgson commented Dec 10, 2024

WebGLPostBuildCallback.cs:

@@ -162,7 +162,7 @@ static MethodDefinition CreateConstructor(ModuleDefinition moduleDefinition, Fie
                ctor.Parameters.Add(new ParameterDefinition(callbackField.FieldType));
                var ilProcessor = ctor.Body.GetILProcessor();
                ilProcessor.Emit(OpCodes.Ldarg_0);
-               ilProcessor.Emit(OpCodes.Call, new MethodReference(".ctor", moduleDefinition.TypeSystem.Void, moduleDefinition.TypeSystem.Object));
+               ilProcessor.Emit(OpCodes.Call, new MethodReference(".ctor", moduleDefinition.TypeSystem.Void, moduleDefinition.TypeSystem.Object) { HasThis = true });
                ilProcessor.Emit(OpCodes.Ldarg_0);
                ilProcessor.Emit(OpCodes.Ldarg_1);
                ilProcessor.Emit(OpCodes.Stfld, callbackField);

@juanfranblanco juanfranblanco linked a pull request Apr 1, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants