alena-karnauhova / ONI-Mods

Mods for Oxygen Not Included
https://steamcommunity.com/profiles/76561199075424056/myworkshopfiles/?appid=457140
0 stars 0 forks source link

CTD while building an electric wire on/behind drywall? #3

Closed Greggho closed 1 month ago

Greggho commented 1 month ago

Had this CTD error once, happened offscreen while dupes were building a lot of things unsupervised. I know for sure there were some wiring going on (regular 1kW wires) and some drywall was queued/built in that place as well - this was happening in space exposed areas if that's of any relevance.

Could be wire and drywall were built in same place at same time?

Happened just once and it may as well have been a one off, unfortunately I had autosave off and couldn't reproduce it. I had just installed "block decor" mod, was running for about an hour or so. There's a huge modlist going on this colony, hard to say if there's some conflict, but this was the first CTD I had in ~500h of heavily modded gameplay...

Klei's debugger pointed to "Block Decor Effects Behind Walls" mod as the source and gave the log below. Fortunately I also got the log from when this happened, attached below.

Player-prev.log

from .log (see attached for details)

[16:55:54.658] [1] [INFO] Block Decor Effects Behind Walls's assembly declared the method BlockDecorBehindWalls.BlockDecorBehindWalls:CheckBackwall in the stack trace, adding to referenced mods list

from ONI CTD debug

Error in WireComplete.DecorProvider.OnSpawn at (138.5, 226.0, -10.5)

System.NullReferenceException
  at (wrapper managed-to-native) UnityEngine.GameObject.GetComponentFastPath(UnityEngine.GameObject,System.Type,intptr)
  at UnityEngine.GameObject.GetComponent[T] () [0x00021] in <72b60a3dd8cd4f12a155b761a1af9144>:0 
  at BlockDecorBehindWalls.BlockDecorBehindWalls.CheckBackwall (System.Int32 cell) [0x00018] in <9a05c17dd5d343218683aca303293500>:0 
  at System.Linq.Enumerable.All[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) [0x0002c] in <351e49e2a5bf4fd6beabb458ce2255f3>:0 
  at BlockDecorBehindWalls.BlockDecorBehindWalls+DecorProviderPatches.Prefix (DecorProvider __instance) [0x00041] in <9a05c17dd5d343218683aca303293500>:0 
  at (wrapper dynamic-method) DecorProvider.DecorProvider.AddDecor_Patch1(DecorProvider)
  at DecorProvider.Refresh () [0x00006] in <ade4ebd17f71495b9476a7e52f977fe6>:0 
  at DecorProvider.OnSpawn () [0x000a0] in <ade4ebd17f71495b9476a7e52f977fe6>:0 
  at KMonoBehaviour.Spawn () [0x0005d] in <42a58da1d7eb4994b452d944564c213e>:0 
Build: U52-626616-SC
alena-karnauhova commented 1 month ago

Crash log says it's an exception in Unity's code. No idea what's going on there, I'm afraid.

akriv commented 1 month ago

Hi, had the same exact issue when building Heavy Watt conductive jointplate on a tile with temp shift plate that is surrounded by empty tiles. I've been able to reproduce it 100% of the time. (save for reference, just build a jointplate on top of the middle temp shift plate) The Radical Bunker.zip

Error in WireRefinedBridgeHighWattageComplete.DecorProvider.OnSpawn at (232.5, 178.0, -11.5)

System.NullReferenceException
  at (wrapper managed-to-native) UnityEngine.GameObject.GetComponentFastPath(UnityEngine.GameObject,System.Type,intptr)
  at UnityEngine.GameObject.GetComponent[T] () [0x00021] in <72b60a3dd8cd4f12a155b761a1af9144>:0 
  at BlockDecorBehindWalls.BlockDecorBehindWalls.CheckBackwall (System.Int32 cell) [0x00018] in <9a05c17dd5d343218683aca303293500>:0 
  at System.Linq.Enumerable.All[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) [0x0002c] in <351e49e2a5bf4fd6beabb458ce2255f3>:0 
  at BlockDecorBehindWalls.BlockDecorBehindWalls+DecorProviderPatches.Prefix (DecorProvider __instance) [0x00041] in <9a05c17dd5d343218683aca303293500>:0 
  at (wrapper dynamic-method) DecorProvider.DecorProvider.AddDecor_Patch1(DecorProvider)
  at DecorProvider.Refresh () [0x00006] in <ade4ebd17f71495b9476a7e52f977fe6>:0 
  at DecorProvider.OnSpawn () [0x000a0] in <ade4ebd17f71495b9476a7e52f977fe6>:0 
  at KMonoBehaviour.Spawn () [0x0005d] in <42a58da1d7eb4994b452d944564c213e>:0 
Build: U52-626616-SC

Briefly looking at the code, it seems that the method CheckBackwall that calls Grid.Objects[cell, int]?.GetComponent(). I don't have any ONI modding or unity experience, but if I had to guess, it may have something to do with jointplate replacing the tempshift plate. Hope this helps.

alena-karnauhova commented 1 month ago

Good catch, an always reproducible case helps a lot. It seems the replaced building is destroyed earlier than it is replaced with a new one in Grid.Objects. Thus, we get an already destroyed object there, but we can't get component from it. Problem solved by adding a check that the object still exists.