onimp / oni_multiplayer

Oxygen Not Included multiplayer mod. Work in progress.
MIT License
218 stars 18 forks source link

#340 Fix fetchRef failure. #358

Closed zuev93 closed 5 months ago

zuev93 commented 5 months ago

The issue was caused by 0 amount and underlying assert in the constructor of FetchOrder.

joevenzon commented 3 months ago

This change removed the TryGetKey check in MultiplayerObjects.Get, and now a failed dictionary lookup will result in a KeyNotFoundException. Here's the stack:

KeyNotFoundException: The given key was not present in the dictionary. at System.Collections.Generic.Dictionary2[TKey,TValue].get_Item (TKey key) [0x0001e] in <695d1cc93cca45069c528c15c9fdd749>:0 at MultiplayerMod.Core.Collections.BidirectionalMap2[TKey,TValue].get_Item (TValue key) [0x00000] in <70756a7e22354ab2ba8f3eebfc9a79b2>:0 at MultiplayerMod.Multiplayer.Objects.MultiplayerObjects.Get[T] (MultiplayerMod.Multiplayer.Objects.MultiplayerId id) [0x00000] in <70756a7e22354ab2ba8f3eebfc9a79b2>:0 at MultiplayerMod.Multiplayer.Commands.Chores.States.AllowStateTransition.Execute (MultiplayerMod.Multiplayer.Commands.MultiplayerCommandContext context) [0x00055] in <70756a7e22354ab2ba8f3eebfc9a79b2>:0 at MultiplayerMod.Multiplayer.CoreOperations.CommandExecution.MultiplayerCommandExecutor.RunCatching (MultiplayerMod.Network.IMultiplayerClientId clientId, MultiplayerMod.Multiplayer.Commands.IMultiplayerCommand command) [0x00036] in <70756a7e22354ab2ba8f3eebfc9a79b2>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <695d1cc93cca45069c528c15c9fdd749>:0 at MultiplayerMod.Multiplayer.CoreOperations.CommandExecution.CommandExceptionHandler.Handle (MultiplayerMod.Multiplayer.Commands.IMultiplayerCommand command, System.Exception exception) [0x00036] in <70756a7e22354ab2ba8f3eebfc9a79b2>:0 at MultiplayerMod.Multiplayer.CoreOperations.CommandExecution.MultiplayerCommandExecutor.RunCatching (MultiplayerMod.Network.IMultiplayerClientId clientId, MultiplayerMod.Multiplayer.Commands.IMultiplayerCommand command) [0x0003e] in <70756a7e22354ab2ba8f3eebfc9a79b2>:0 at MultiplayerMod.Multiplayer.CoreOperations.CommandExecution.MultiplayerCommandExecutor+<>c__DisplayClass6_0.b__0 () [0x00000] in <70756a7e22354ab2ba8f3eebfc9a79b2>:0 at MultiplayerMod.ModRuntime.Context.ExecutionLevelManager.RunUsingLevel (MultiplayerMod.ModRuntime.Context.ExecutionLevel level, System.Action action) [0x00007] in <70756a7e22354ab2ba8f3eebfc9a79b2>:0 at MultiplayerMod.ModRuntime.Context.ExecutionLevelManager.RunIfLevelIsActive (MultiplayerMod.ModRuntime.Context.ExecutionLevel requiredLevel, MultiplayerMod.ModRuntime.Context.ExecutionLevel actionLevel, System.Action action) [0x00009] in <70756a7e22354ab2ba8f3eebfc9a79b2>:0 at MultiplayerMod.Multiplayer.CoreOperations.CommandExecution.MultiplayerCommandExecutor.Execute (MultiplayerMod.Network.IMultiplayerClientId clientId, MultiplayerMod.Multiplayer.Commands.IMultiplayerCommand command) [0x00055] in <70756a7e22354ab2ba8f3eebfc9a79b2>:0 at MultiplayerMod.Multiplayer.CoreOperations.MultiplayerCommandController.OnClientReceivedCommand (MultiplayerMod.Multiplayer.Commands.IMultiplayerCommand command) [0x00000] in <70756a7e22354ab2ba8f3eebfc9a79b2>:0 at MultiplayerMod.Platform.Steam.Network.SteamClient.ReceiveCommands () [0x0005f] in <70756a7e22354ab2ba8f3eebfc9a79b2>:0 at MultiplayerMod.Platform.Steam.Network.SteamClient.Tick () [0x0000f] in <70756a7e22354ab2ba8f3eebfc9a79b2>:0 at MultiplayerMod.Platform.Steam.Network.Components.SteamClientComponent.Update () [0x00000] in <70756a7e22354ab2ba8f3eebfc9a79b2>:0