files-community / Files

A modern file manager that helps users organize their files and folders.
https://files.community
MIT License
34.59k stars 2.2k forks source link

Bug: Applying a tag to a folder will cause Files to crash #10054

Closed rospirit closed 2 years ago

rospirit commented 2 years ago

Description

Adding tags to folders causes the app to crash

Steps To Reproduce

  1. select a file.
  2. right click
  3. add a new tag
  4. observe that the app crashes

Steps to fix

Files Version

2.3.11.0

Windows Version

10.0.22000.1042

Relevant Assets/Logs

https://user-images.githubusercontent.com/81501083/192501517-f06ccae0-4551-4fc3-99ef-09aa8246cb55.mp4

2022-09-23 23:55:09.2408|ERROR|AppUnhandledException|Index key must be less than 512 bytes.
    LiteDB.LiteException: Index key must be less than 512 bytes.
   at LiteDB.IndexService.AddNode(CollectionIndex, BsonValue, Byte, IndexNode) + 0x597
   at LiteDB.IndexService.AddNode(CollectionIndex, BsonValue, IndexNode) + 0x97
   at LiteDB.LiteEngine.<>c__DisplayClass17_0.<EnsureIndex>b__0(CollectionPage) + 0x286
   at LiteDB.LiteEngine.Transaction[T](String, Boolean, Func`2) + 0xe9
   at LiteDB.LiteEngine.EnsureIndex(String, String, String, Boolean) + 0x13c
   at LiteDB.LiteCollection`1.EnsureIndex(String, String, Boolean) + 0x47
   at LiteDB.LiteCollection`1.EnsureIndex[K](Expression`1, String, Boolean) + 0x72
   at Common.FileTagsDb.SetTags(String, Nullable`1, String[]) + 0x2be
   at Files.Uwp.Filesystem.ListedItem.set_FileTags(String[]) + 0x227
   at Files.Uwp.UserControls.Menus.FileTagsContextMenu.AddFileTag(IEnumerable`1, FileTagViewModel) + 0x1da
   at Files.Uwp.UserControls.Menus.FileTagsContextMenu.TagItem_Click(Object, RoutedEventArgs) + 0x6b
   at Microsoft.Toolkit.Uwp.UI.Controls.InAppNotificationOpeningEventHandler.Invoke(Object, InAppNotificationOpeningEventArgs) + 0x2e
   at __Interop.Intrinsics.HasThisCall__22[TArg0](Object, IntPtr, Object, TArg0) + 0x36
   at Files!<BaseAddress>+0x1454480
   at System.Runtime.InteropServices.McgMarshal.ThrowOnExternalCallFailed(Int32, RuntimeTypeHandle) + 0x21
   at __Interop.ComCallHelpers.Call(__ComObject, RuntimeTypeHandle, Int32) + 0xb8
   at __Interop.ForwardComStubs.Stub_10[TThis](__ComObject, Int32) + 0x24
   at Microsoft.AppCenter.Utils.ApplicationLifecycleHelper.<.ctor>b__17_1(Object, UnhandledErrorDetectedEventArgs) + 0x3d
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x21
   at Microsoft.AppCenter.Utils.ApplicationLifecycleHelper.<.ctor>b__17_1(Object, UnhandledErrorDetectedEventArgs) + 0x75
   at System.EventHandler`1.Invoke(Object, TEventArgs) + 0x2e
   at __Interop.Intrinsics.HasThisCall__22[TArg0](Object, IntPtr, Object, TArg0) + 0x36
   at Files!<BaseAddress>+0x1454480
Josh65-2201 commented 2 years ago

You can export your settings including the tags in Files settings > about > import/export settings. Don't believe there is a way to download older versions.

Josh65-2201 commented 2 years ago

Asking @yaichenbaum for approval.

rospirit commented 2 years ago

https://user-images.githubusercontent.com/81501083/192734083-244814db-2dbb-4117-8f62-ca891e46d48b.mp4

ferrariofilippo commented 2 years ago

@rospirit Files' DetailsLayout shows only one tag in that column. You have to remove other tags to see the latter

sthivaios commented 2 years ago

Works fine for me.

Image

yaira2 commented 2 years ago

Is this still an issue in the preview version? https://files.community/download/preview

QuaintMako commented 2 years ago

Cannot reproduce on the Dev version nor Preview version of 2.3.57.