ArgumentOutOfRangeException on remote client

ChristianWiele

Active member
Hi,

I sometimes get the exception below on the client, but I have no idea why and when. So I need some advice where this exception might come from to further analyze it.

Code:
ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
  at System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) [0x00029] in <eae584ce26bc40229c1b1aa476bfa589>:0
  at System.ThrowHelper.ThrowArgumentOutOfRangeException () [0x00000] in <eae584ce26bc40229c1b1aa476bfa589>:0
  at Opsive.UltimateCharacterController.Inventory.ItemSetManagerBase.IsDefaultItemCategory (Opsive.Shared.Inventory.ItemDefinitionBase itemDefinition, Opsive.Shared.Inventory.IItemCategoryIdentifier itemCategory) [0x000fc] in /Users/christian/Documents/repos/Unity3D/The Pirate Project/Assets/Opsive/UltimateCharacterController/Scripts/Inventory/ItemSetManagerBase.cs:196
  at Opsive.UltimateCharacterController.Inventory.ItemSetManagerBase.IsDefaultItemCategory (Opsive.Shared.Inventory.ItemDefinitionBase itemDefinition) [0x00025] in /Users/christian/Documents/repos/Unity3D/The Pirate Project/Assets/Opsive/UltimateCharacterController/Scripts/Inventory/ItemSetManagerBase.cs:152
  at Opsive.UltimateCharacterController.Character.Abilities.ItemEquipVerifier.IsDefaultItemIdentifier (Opsive.Shared.Inventory.IItemIdentifier itemIdentifier) [0x00012] in /Users/christian/Documents/repos/Unity3D/The Pirate Project/Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/ItemEquipVerifier.cs:220
  at Opsive.UltimateCharacterController.Character.Abilities.ItemEquipVerifier.TryToggleItem (Opsive.UltimateCharacterController.Character.Abilities.Ability ability, System.Boolean activate) [0x00170] in /Users/christian/Documents/repos/Unity3D/The Pirate Project/Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/ItemEquipVerifier.cs:109
  at Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.TryStartAbility (Opsive.UltimateCharacterController.Character.Abilities.Ability ability, System.Boolean ignorePriority, System.Boolean ignoreCanStartCheck) [0x002f4] in /Users/christian/Documents/repos/Unity3D/The Pirate Project/Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:1161
  at Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.TryStartAbility (Opsive.UltimateCharacterController.Character.Abilities.Ability ability, System.Boolean ignorePriority) [0x00001] in /Users/christian/Documents/repos/Unity3D/The Pirate Project/Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:1065
  at Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.TryStartAbility (Opsive.UltimateCharacterController.Character.Abilities.Ability ability) [0x00001] in /Users/christian/Documents/repos/Unity3D/The Pirate Project/Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:1054
  at Opsive.UltimateCharacterController.AddOns.Multiplayer.PhotonPun.Character.PunCharacter.OnAbilityActiveRPC (System.Int32 abilityIndex, System.Boolean active) [0x00007] in /Users/christian/Documents/repos/Unity3D/The Pirate Project/Assets/Opsive/UltimateCharacterController/Add-Ons/Multiplayer/PhotonPUN/Scripts/Character/PunCharacter.cs:171
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <eae584ce26bc40229c1b1aa476bfa589>:0
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00048] in <eae584ce26bc40229c1b1aa476bfa589>:0
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <eae584ce26bc40229c1b1aa476bfa589>:0
  at Photon.Pun.PhotonNetwork.ExecuteRpc (ExitGames.Client.Photon.Hashtable rpcData, Photon.Realtime.Player sender) [0x005d6] in /Users/christian/Documents/repos/Unity3D/The Pirate Project/Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:540
  at Photon.Pun.PhotonNetwork.OnEvent (ExitGames.Client.Photon.EventData photonEvent) [0x000ab] in /Users/christian/Documents/repos/Unity3D/The Pirate Project/Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:2199
  at (wrapper delegate-invoke) System.Action`1[ExitGames.Client.Photon.EventData].invoke_void_T(ExitGames.Client.Photon.EventData)
  at Photon.Realtime.LoadBalancingClient.OnEvent (ExitGames.Client.Photon.EventData photonEvent) [0x00524] in /Users/christian/Documents/repos/Unity3D/The Pirate Project/Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:3284
  at ExitGames.Client.Photon.PeerBase.DeserializeMessageAndCallback (ExitGames.Client.Photon.StreamBuffer stream) [0x002e1] in D:\Dev\Work\photon-dotnet-sdk\PhotonDotNet\PeerBase.cs:891
  at ExitGames.Client.Photon.EnetPeer.DispatchIncomingCommands () [0x003af] in D:\Dev\Work\photon-dotnet-sdk\PhotonDotNet\EnetPeer.cs:559
  at ExitGames.Client.Photon.PhotonPeer.DispatchIncomingCommands () [0x00034] in D:\Dev\Work\photon-dotnet-sdk\PhotonDotNet\PhotonPeer.cs:1837
  at Photon.Pun.PhotonHandler.Dispatch () [0x0002b] in /Users/christian/Documents/repos/Unity3D/The Pirate Project/Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:223
  at Photon.Pun.PhotonHandler.FixedUpdate () [0x00012] in /Users/christian/Documents/repos/Unity3D/The Pirate Project/Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:149
 
What is line 196? For me line 196 of ItemSetManagerBase is a } so that wouldn't be throwing the exception.
 
That's odd, I'm not sure. There's no using statement so that line shouldn't throw that error. But if you can tell me how to reproduce it within the demo scene I'll take a look.
 
Top