BepInEx / Il2CppInterop

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

Add awaiter implementation #133

Open extraes opened 2 months ago

extraes commented 2 months ago

Adds Pass61ImplementAwaiters Looks for types implementing INotifyCompletion and generates new methods that allow the interop types to implement that interface, calling the Il2CppSystem.Action -> System.Action implicit conversion before calling the original method.

This makes originally-awaitable types (e.g. UniTasks, if the game has them) awaitable again.

I previously did this in a much less automated way with Cecil in another project, but the runtime didn't like what I was doing, so I figured I'd make it less janky and add it to Il2CppInterop, and sure enough the runtime no longer rejects the type.

ds5678 commented 1 month ago

This seems like it will be fixed automatically by my planned type system improvements. I am hesitant to merge this special case pull request when a generic fix is planned.