Nexus-Mods / NexusMods.App

Home of the development of the Nexus Mods App
https://nexus-mods.github.io/NexusMods.App/
GNU General Public License v3.0
1.1k stars 52 forks source link

App can't handle game updates #1093

Closed erri120 closed 8 months ago

erri120 commented 8 months ago
System.Collections.Generic.KeyNotFoundException: The given key 'Game' was not present in the dictionary.
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at NexusMods.Abstractions.GameLocators.GameLocationsRegister.get_Item(LocationId id) in /ssd-pool/projects/NexusMods/app/main/src/Abstractions/NexusMods.Abstractions.GameLocators/GameLocationsRegister.cs:line 20
   at NexusMods.DataModel.Loadouts.DiskStateRegistry.MakeId(GameInstallation installation) in /ssd-pool/projects/NexusMods/app/main/src/NexusMods.DataModel/Loadouts/DiskStateRegistry.cs:line 61
   at NexusMods.DataModel.Loadouts.DiskStateRegistry.GetState(GameInstallation gameInstallation) in /ssd-pool/projects/NexusMods/app/main/src/NexusMods.DataModel/Loadouts/DiskStateRegistry.cs:line 74
   at NexusMods.DataModel.Loadouts.DiskStateRegistry.GetLastAppliedLoadout(GameInstallation gameInstallation) in /ssd-pool/projects/NexusMods/app/main/src/NexusMods.DataModel/Loadouts/DiskStateRegistry.cs:line 90
   at NexusMods.DataModel.ApplyService.<>c__DisplayClass7_0.<LastAppliedRevisionFor>b__0() in /ssd-pool/projects/NexusMods/app/main/src/NexusMods.DataModel/ApplyService.cs:line 135
   at System.Reactive.Linq.ObservableImpl.Defer`1.Eval()
   at System.Reactive.TailRecursiveSink`1.<Drain>g__Unpack|7_0[T](IObservable`1 source)
   at System.Reactive.TailRecursiveSink`1.Drain()

Curiously, the installation is Unknown Game (stardewvalley) v1.6.0.24077 (unknown).

Al12rs commented 8 months ago

I have had this happen to me sometimes if the App crashed or was forcefully closed before

Sewer56 commented 8 months ago

I've had this happen in a different context.

I store my games on the Windows partition I use for testing/writing DLL mods. Sometimes when I reboot, Windows leaves the dirty flag (e.g. due to updates), so my NTFS mounts fail on boot. Then it leaves the same stack trace.

It's user error in this case obviously, but the UX around this isn't very graceful.

erri120 commented 8 months ago

This is whack. The game just disappeared.

2024-03-20_11-12-26

erri120 commented 8 months ago

This issue comes from the fact that we serialize the currently managed by using the following values:

If the user updates the game from whatever version we have saved, this check will fail and the user will get an UnknownGame:

https://github.com/Nexus-Mods/NexusMods.App/blob/eef096dd19e7524caeb554c3540335c69556f642/src/NexusMods.StandardGameLocators/GameInstallationConverter.cs#L38-L42

In my case, I updated Stardew Valley from 1.6.0.24077 to 1.6.0.24079.