sarbian / ModuleManager

176 stars 96 forks source link

Patching Thread: Crash when :LAST[x] pass found and [x] is not a valid pass #159

Closed DRVeyl closed 4 years ago

DRVeyl commented 4 years ago

Attached logs provided by a player via Discord. Diagnosed from recent patches in RO, when SCANSat is not installed: @PART[scansat-radar-poseidon-3b-1]:LAST[SCANsat] consistently causes the following MM error, included in player.log:

Uploading Crash Report
[ModuleManager] The patching thread threw an exception: System.Collections.Generic.KeyNotFoundException: Mod 'SCANsat' not found
  at ModuleManager.PatchList.EnsureMod (System.String mod) [0x00051] in <6cc6df54448a4c2b97e086234872a67b>:0 
  at ModuleManager.PatchList..ctor (System.Collections.Generic.IEnumerable`1[T] modList, System.Collections.Generic.IEnumerable`1[T] patches, ModuleManager.Progress.IPatchProgress progress) [0x001fd] in <6cc6df54448a4c2b97e086234872a67b>:0 
  at ModuleManager.MMPatchLoader.Run () [0x0021e] in <6cc6df54448a4c2b97e086234872a67b>:0 
  at ModuleManager.MMPatchRunner+<>c__DisplayClass11_0.<Run>b__1 () [0x00001] in <6cc6df54448a4c2b97e086234872a67b>:0 
  at ModuleManager.Threading.BackgroundTask+<>c__DisplayClass0_0.<Start>g__RunAction|0 () [0x00002] in <6cc6df54448a4c2b97e086234872a67b>:0 

Guarding the patch with :NEEDS[SCANsat] fixes: @PART[scansat-radar-poseidon-3b-1]:LAST[SCANsat]:NEEDS[SCANsat]

Expected LAST[x] to behave like BEFORE[x] or AFTER[x] and imply NEEDS[x]

ModuleManager_ThreadCrash.zip

blowfishpro commented 4 years ago

Confirmed and a fix found. However, based on discussion in the original issue (#96) these patches will always run in order (but won't cause MM to consider the mod to exist for other purposes)