Project

General

Profile

Bug #5337

Error in Part.OnDestroy method

Added by DMagic over 8 years ago. Updated over 7 years ago.

Status:
Closed
Severity:
Low
Assignee:
Category:
Parts
Target version:
-
Start date:
08/21/2015
% Done:

100%

Version:
Platform:
Win32
Expansion:
Language:
English (US)
Mod Related:
No
Votes:
Arrow u r green
Arrow d r red

Description

The Part.OnDestroy method seems to have a C# error. Under certain conditions a UnityEngine.Collider List is modified (an element is deleted, added, or the list is cleared) while enumerating the list; this is a common and well known C# problem. The error causes an invalid operation exception and interrupts the Part.OnDestroy method.

This can be easily and repeatably be triggered.

Steps:
1: Create and launch a new vessel, it doesn't matter if the vessel is left on the launch pad or landed on Minmus, this can be done anywhere.
2: Take a Kerbal out on EVA.
3: Do something to make the Kerbal fall down (ie trigger the rag doll animation); on the launch pad this can be done by either climbing on top of and jumping off of a command pod, or by diving off the edge of the launch pad, on a low gravity moon the jet pack can be used to crash into the surface or vessel.
4: Return to the command pod and re-board.
5: The following error message will be displayed in the debug log:

InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.Collections.Generic.List`1+Enumerator[UnityEngine.Collider].VerifyState () [0x00000] in <filename unknown>:0
at System.Collections.Generic.List`1+Enumerator[UnityEngine.Collider].MoveNext () [0x00000] in <filename unknown>:0
at Part.OnDestroy () [0x00000] in <filename unknown>:0

The included output_log file displays this error twice, triggered on Minmus and on the launch pad, on lines 10701 and 11035.

The save file was used to generate the log file and the Minmus landing craft is included, the launch pad craft is a Mk1-2 command pod by itself.

output_log.txt (479 KB) output_log.txt Error on lines 10701 and 11035 DMagic, 08/21/2015 12:03 AM
persistent.sfs (94.9 KB) persistent.sfs Contains vessels used for testing on Minmus and the launch pad DMagic, 08/21/2015 12:03 AM
Minmus Tester.craft (99.5 KB) Minmus Tester.craft [email protected] DMagic, 08/21/2015 12:03 AM

History

#1 Updated by Squelch over 8 years ago

  • Status changed from New to Confirmed
  • % Done changed from 0 to 10

The Kerbal must have entered "ragdoll" state before entering the craft for this error to appear. Confirmed and passed on.

#3 Updated by Squelch over 8 years ago

  • Platform Win32 added
  • Platform deleted (Windows)

#4 Updated by TriggerAu almost 8 years ago

  • Status changed from Confirmed to Needs Clarification
  • % Done changed from 10 to 0

#5 Updated by TriggerAu over 7 years ago

  • Status changed from Needs Clarification to Closed
  • Assignee set to TriggerAu
  • % Done changed from 0 to 100

This one is no longer occuring with the changes in code in the foreach cleanup

Also available in: Atom PDF