Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Presence of unrecognized attributes on entities causes crashes #115

Open
Al12rs opened this issue Dec 10, 2024 · 0 comments
Open

Presence of unrecognized attributes on entities causes crashes #115

Al12rs opened this issue Dec 10, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@Al12rs
Copy link

Al12rs commented Dec 10, 2024

Outline:

If an entity has an attribute that isn't recognized, it causes the application to crash.

Details:

After rolling back from a version containing a simple attribute addition of two attributes NexusCollectionLoadoutGroup/Collection and NexusMods.Collections.NexusCollectionLoadoutGroup/Revision, the app crashes with the following stacktrace:

   00:00:10.612 [FATAL] Exception crashed the application!|System.InvalidOperationException: Attribute NexusMods.Collections.NexusCollectionLoadoutGroup/Collection not found
   at NexusMods.MnemonicDB.Abstractions.AttributeResolver.Resolve(Datom datom)
   at NexusMods.Abstractions.Loadouts.LoadoutItemWithTargetPath.ReadOnly.GetEnumerator()+MoveNext() in C:\Dev\Repos\NexusMods.App\src\Abstractions\NexusMods.Abstractions.Loadouts\obj\Debug\net9.0\NexusMods.MnemonicDB.SourceGenerator\NexusMods.MnemonicDB.SourceGenerator.ModelGenerator\NexusMods_Abstractions_Loadouts_LoadoutItemWithTargetPath.Generated.cs:line 287
   at NexusMods.Abstractions.Loadouts.LoadoutItemWithTargetPath.ReadOnly.Contains(IAttribute attribute) in C:\Dev\Repos\NexusMods.App\src\Abstractions\NexusMods.Abstractions.Loadouts\obj\Debug\net9.0\NexusMods.MnemonicDB.SourceGenerator\NexusMods.MnemonicDB.SourceGenerator.ModelGenerator\NexusMods_Abstractions_Loadouts_LoadoutItemWithTargetPath.Generated.cs:line 302
   at NexusMods.Abstractions.Loadouts.LoadoutItemWithTargetPath.ReadOnly.IsValid() in C:\Dev\Repos\NexusMods.App\src\Abstractions\NexusMods.Abstractions.Loadouts\obj\Debug\net9.0\NexusMods.MnemonicDB.SourceGenerator\NexusMods.MnemonicDB.SourceGenerator.ModelGenerator\NexusMods_Abstractions_Loadouts_LoadoutItemWithTargetPath.Generated.cs:line 323
   at NexusMods.Abstractions.Loadouts.LoadoutItemWithTargetPathExtensions.TryGetAsLoadoutItemWithTargetPath(ReadOnly model, ReadOnly& result) in C:\Dev\Repos\NexusMods.App\src\Abstractions\NexusMods.Abstractions.Loadouts\obj\Debug\net9.0\NexusMods.MnemonicDB.SourceGenerator\NexusMods.MnemonicDB.SourceGenerator.ModelGenerator\NexusMods_Abstractions_Loadouts_LoadoutItemWithTargetPath.Generated.cs:line 484
   at NexusMods.Abstractions.Loadouts.LoadoutItemWithTargetPathExtensions.OfTypeLoadoutItemWithTargetPath(IEnumerable`1 models)+MoveNext() in C:\Dev\Repos\NexusMods.App\src\Abstractions\NexusMods.Abstractions.Loadouts\obj\Debug\net9.0\NexusMods.MnemonicDB.SourceGenerator\NexusMods.MnemonicDB.SourceGenerator.ModelGenerator\NexusMods_Abstractions_Loadouts_LoadoutItemWithTargetPath.Generated.cs:line 499
   at System.Linq.Enumerable.IEnumerableWhereIterator`1.MoveNext()
   at System.Linq.Lookup`2.Create(IEnumerable`1 source, Func`2 keySelector, IEqualityComparer`1 comparer)
   at System.Linq.Enumerable.GroupByIterator`2.MoveNext()
   at System.Linq.Enumerable.IteratorSelectIterator`2.MoveNext()
   at System.Linq.Enumerable.IEnumerableWhereIterator`1.MoveNext()
   at NexusMods.Abstractions.Loadouts.LoadoutFileExtensions.OfTypeLoadoutFile(IEnumerable`1 models)+MoveNext() in C:\Dev\Repos\NexusMods.App\src\Abstractions\NexusMods.Abstractions.Loadouts\obj\Debug\net9.0\NexusMods.MnemonicDB.SourceGenerator\NexusMods.MnemonicDB.SourceGenerator.ModelGenerator\NexusMods_Abstractions_Loadouts_LoadoutFile.Generated.cs:line 512
   at NexusMods.Abstractions.Loadouts.Synchronizers.ALoadoutSynchronizer.BuildSyncTree[T](Entities`1 currentState, Entities`1 previousTree, IEnumerable`1 loadoutItems) in C:\Dev\Repos\NexusMods.App\src\Abstractions\NexusMods.Abstractions.Loadouts.Synchronizers\ALoadoutSynchronizer.cs:line 191
   at NexusMods.Abstractions.Loadouts.Synchronizers.ALoadoutSynchronizer.BuildSyncTree(Entities`1 currentState, Entities`1 previousTree, IEnumerable`1 loadoutItems) in C:\Dev\Repos\NexusMods.App\src\Abstractions\NexusMods.Abstractions.Loadouts.Synchronizers\ALoadoutSynchronizer.cs:line 182
   at NexusMods.Abstractions.Loadouts.Synchronizers.ALoadoutSynchronizer.LoadoutToDiskDiff(ReadOnly loadout, Entities`1 diskState) in C:\Dev\Repos\NexusMods.App\src\Abstractions\NexusMods.Abstractions.Loadouts.Synchronizers\ALoadoutSynchronizer.cs:line 710
   at NexusMods.DataModel.Synchronizer.SynchronizerService.GetApplyDiffTree(LoadoutId loadoutId) in C:\Dev\Repos\NexusMods.App\src\NexusMods.DataModel\Synchronizer\SynchronizerService.cs:line 45
   at NexusMods.DataModel.Synchronizer.SynchronizerService.<>c__DisplayClass17_0.<CreateStatusObservable>b__6() in C:\Dev\Repos\NexusMods.App\src\NexusMods.DataModel\Synchronizer\SynchronizerService.cs:line 194
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)

Even if we don't plan to support rolling back, we should still avoid outright crashing if some extra data is present on an entity.

@Al12rs Al12rs added the bug Something isn't working label Dec 10, 2024
@Al12rs Al12rs added this to MVP Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

2 participants