Goobwabber / MultiplayerCore

A Beat Saber mod that implements core custom multiplayer functionality.
MIT License
66 stars 36 forks source link

Simpler, more reliable status data patch #19

Closed rcelyte closed 1 year ago

rcelyte commented 2 years ago

The transpiler-based patch seemed to collide with something in my mod, throwing this exception if the two were installed alongside each other:

InvalidOperationException: An attempt was made to transition a task to a final state when it had already completed.
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[TResult].SetResult (TResult result) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
(wrapper dynamic-method) MultiplayerStatusModel+<GetMultiplayerStatusAsyncInternal>d__9.DMD<MultiplayerStatusModel+<GetMultiplayerStatusAsyncInternal>d__9::MoveNext>(MultiplayerStatusModel/<GetMultiplayerStatusAsyncInternal>d__9&)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext (System.Object stateMachine) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run () (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation+<>c.<.cctor>b__7_0 (System.Object state) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at <451019b49f1347529b43a32c5de769af>:0)
UnityEngine.UnitySynchronizationContext:ExecuteTasks()
rcelyte commented 1 year ago

Upon further investigation, I believe this exception is the result of a bug in HarmonyX. I'll go open an issue there.