Skip to content
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

Fix crash calling delegate invoke on il2cpp 29 or higher #78

Merged
merged 5 commits into from
Feb 17, 2023

Conversation

limoka
Copy link
Contributor

@limoka limoka commented Feb 17, 2023

This PR fixes that calling delegate Invoke() method caused a crash on il2cpp version 29 or higher.

This issue is caused by a new field in the MethodInfo class called virtualMethodPointer. Now when calling delegates il2cpp uses it to determine what to call. Since Il2CppInterop was not aware of that, it's value was null thus causing the crash.

I'm not entirely sure if it's supposed to have a value of it's own though. I have checked with a type from my game and every method there had virtualMethodPointer field equal to methodPointer field.

I have tested this on Unity 2021.3.14, il2cpp 29: no crashes calling delegates or UnityEvent's

@Kasuromi Kasuromi merged commit 8b0f495 into BepInEx:master Feb 17, 2023
@limoka limoka deleted the fix-delegate-crash branch February 17, 2023 18:26
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 this pull request may close these issues.

2 participants