BepInEx / Il2CppInterop

A tool interoperate between CoreCLR and Il2Cpp at runtime
GNU Lesser General Public License v3.0
185 stars 59 forks source link

Metadata 27+ Xref crash fix #110

Open HookedBehemoth opened 9 months ago

HookedBehemoth commented 9 months ago

On previous versions, one call per method instantiated all globals used. Now there is one call per global. Instead of a method-handle, the pointers are passed directly. With method inlining, multiple of these blocks are added into one method

This bug would manifest as hard crashes during xref on methods that weren't fully initialized by the runtime.

TODO: Only one of the flags is set and we might check the wrong one

I got distracted and never properly implemented this. I hope these patches can help you.

HookedBehemoth commented 9 months ago

I think the pointers where just polluted so I couldn't just null check, but I'm not sure anymore

HookedBehemoth commented 9 months ago

This is still too brittle... I'm getting crashes with some functions again.

HookedBehemoth commented 7 months ago

Did anyone get a chance to look into this PR or the issue at hand? It would be nice to get the issue resolved upstream.

krulci commented 4 months ago

Any updates on this? @HookedBehemoth I wasn't able to find you on Melon or BepInEx's server anymore

HookedBehemoth commented 4 months ago

Works but the maintainers here don't seem to be interested in having this upstream

krulci commented 4 months ago

Works but the maintainers here don't seem to be interested in having this upstream

In some version, I am getting Op0Kind = Register

HookedBehemoth commented 4 months ago

Do you actually know what this patch is for or do you just use this issue to report a bug that has nothing to do with this?

krulci commented 4 months ago

Do you actually know what this patch is for or do you just use this issue to report a bug that has nothing to do with this?

I am not entirely sure if is related. But, using this PR or the original with Metadata 29, I get Argument out of range on certain xref. The op0kind is register. I supposed the address decoder has some issue.

HookedBehemoth commented 4 months ago

So it probably has nothing to do with this patch?