ResoniteModLoader icon indicating copy to clipboard operation
ResoniteModLoader copied to clipboard

ExecutionHook race condition

Open art0007i opened this issue 1 year ago • 5 comments

currently the ExecutionHook is being called from inside FrooxEngine.EngineInitializer.InitializeFrooxEngine. this function creates a few initialization tasks and runs them alongside our execution hook using Task.WhenAll

tasks it's being ran alongside of:

  • Initializing connector fields for PlatformInterface
  • Initializing asset classes
  • Initializing workers

this can apparently cause some weird issues such as this https://github.com/badhaloninja/DeselectOwnGizmos/issues/2

art0007i avatar Dec 25 '24 15:12 art0007i

note that on neos the startup was completely synchronous, so it wasn't an issue back then, and it was never adjusted for resonite where the startup process has been made async

art0007i avatar Dec 25 '24 15:12 art0007i

Know of any replication with just RML or without MonkeyLoader? From the linked issue, it isn't clear if it was caused by that being loaded or changing other functionality. Still can be something to improve here just hard to test for and validate the cause.

XDelta avatar Dec 25 '24 16:12 XDelta

ye i can test it later but I assume it's true

fixing it might be a bit annoying though.

I think maybe instead of the execution hook loading mods directly it would patch that init func to run after it (it's what monkeyloader does to fix that)

art0007i avatar Dec 25 '24 19:12 art0007i

miss clicked close and i cant reopen oops

art0007i avatar Dec 25 '24 19:12 art0007i

ROTHORN - 2024.12.18.477 - 2024-12-25 20_20_05.log

bugged mod's code (very simple and probably shouldn't be gamebreaking)

public override void OnEngineInit()
{
    var x = AccessTools.Field(typeof(DevCreateNewForm), "root").GetValue(null);
    Debug(x == null);
    Debug(x);
    Debug(x == null);
}

art0007i avatar Dec 25 '24 19:12 art0007i