O-n-y / oxy.mods

Oxy.BugTracker
18 stars 2 forks source link

NoDrop ArgumentOutOfRangeException #16

Closed PsychoDad9999 closed 3 years ago

PsychoDad9999 commented 4 years ago

Hi,

I had the following crash a couple of times caused by your mod

System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at :0) System.ThrowHelper.ThrowArgumentOutOfRangeException () (at :0) System.Collections.Generic.List`1[T].RemoveAt (System.Int32 index) (at :0) Ony.OxygenNotIncluded.NoDrop.CarriedItemsComponent.FixedUpdate () (at :0)

I checked the code and there is an issue at the end of the FixedUpdate() Method where you use the List.RemoveAt function inside of a for-loop to remove the game objects. This will not work once an element has been removed, because the index of the game objects and the index of the list used in the loop will no longer match (either the wrong element is removed or an element outside of the range of the list is removed, which will cause the crash)

Replacing the List.RemoveAt call with List.Remove should fix the issue. Hope that helps.

O-n-y commented 4 years ago

provide information need for ticket: (How to report bug) https://github.com/O-n-y/oxy.mods

PsychoDad9999 commented 4 years ago

Bug report relates to mod version 1.0.5.57

Let me know if you need additional information.

PsychoDad9999 commented 4 years ago

Just a quick update.

I've patched your mod with the changes I've described in the first post and didn't had a single crash after that. I've played for 300 cycles, so it definitely fixed the crashing issues I had before.

Tenelia commented 4 years ago

Issue still persists on my end. Hoping the fix will get pushed out. Anna's mods were crashing, so I had to remove them all...

System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at :0) System.ThrowHelper.ThrowArgumentOutOfRangeException () (at :0) System.Collections.Generic.List`1[T].RemoveAt (System.Int32 index) (at :0) Ony.OxygenNotIncluded.NoDrop.CarriedItemsComponent.FixedUpdate () (at :0)

O-n-y commented 4 years ago

There was no update yet for this mod, so there is no need to report same issue multiple times, as it was already reported

tsunamilx commented 3 years ago

Just a quick update.

I've patched your mod with the changes I've described in the first post and didn't had a single crash after that. I've played for 300 cycles, so it definitely fixed the crashing issues I had before.

Hi @PsychoDad9999 would be much appreciated if you can share your patch here?

O-n-y commented 3 years ago

Modifying code is not allowed, you have to wait for the new version to be release version to be pushed.

I am back from the hospital and hoping to push an update soon.

O-n-y commented 3 years ago

Should be fixed in 1.0.6.60

tsunamilx commented 3 years ago

Thanks a lot for the update, hoping you are well. I just tried the new version, and just got another crash... NullReferenceException at (wrapper managed-to-native) UnityEngine.Object.GetName(UnityEngine.Object) at UnityEngine.Object.get_name () [0x00001] in :0 at Ony.OxygenNotIncluded.NoDrop.DropManager.Drop (UnityEngine.GameObject gameObject, System.Int32 cell, UnityEngine.GameObject item) [0x00017] in :0 at Ony.OxygenNotIncluded.NoDrop.CarriedItemsComponent.FixedUpdate () [0x00190] in :0

O-n-y commented 3 years ago

have you checked you have exactly the last version? (version number in mod manager)

O-n-y commented 3 years ago

also the exception looks different, us it possible for you to provide save file where it can be replicated?

tsunamilx commented 3 years ago

Yes, I am using the Mod Manger, and the version is 1.0.6.60. I am not sure a save file would help as I have tons of mods installed. I just got another try today, and haven't got any crash, so will update here if I got a crash again.

O-n-y commented 3 years ago

from my tests, i didn't manage to replicate this issue currently

O-n-y commented 3 years ago

From 5 hours stress on test map, i am still not able to reproduce this, it is possible some mod (maybe for speed or some other) cause this to happen. So I am waiting for save file from you and instructions on how to reproduce it (including which mods should be activated for this to happen).

tsunamilx commented 3 years ago

Never mind, I ran the game like 100 cycles, no crash, either it is super super rare issue or is caused by other mods. If no one else is reporting this issue, I would consider this as a good fix. Thanks a lot, really appreciated.

O-n-y commented 3 years ago

i will close for now then