icsharpcode / AvaloniaILSpy

Avalonia-based .NET Decompiler (port of ILSpy)
1.52k stars 171 forks source link

Crashes at "open file" dialog related to escaped chars in media paths (?) #48

Closed jnj16180340 closed 3 years ago

jnj16180340 commented 3 years ago

ILSpy version: 5.0.2.1.rc
OS: KDE + Linux 5.8.0-7630-generic #32~1609193707~20.10~781bb80-Ubuntu SMP Tue Jan 5 21:29:56 UTC 2 x86_64 x86_64 x86_64 GNU/Linux (PopOS / Ubuntu 20.10)
KDE version: Qt: 5.14.2 KDE Frameworks: 5.74.0 kf5-config: 1.0

When I open ILSpy and click the "open" menu item, it crashes with System.IO.DirectoryNotFoundException: Could not find a part of the path '/media/nate/Seagate\040Expansion\040Drive'.

~I think I opened a file at that path some time ago, or maybe it comes from KDE "recent files". Anyway,~ the path is now missing because the drive was unmounted.

Actually the bad path is related to media/drive names, it works fine with space-containing paths on /. And the file picker click-to-navigate to external media with spaces in the name goes to the wrong destination

Screenshot_20210202_160325

trace

Tmds.DBus.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name com.canonical.AppMenu.Registrar was not provided by any .service files
   at Tmds.DBus.DBusConnection.CallMethodAsync(Message msg, Boolean checkConnected, Boolean checkReplyType)
   at Tmds.DBus.Connection.CallMethodAsync(Message message)
   at Tmds.DBus.CodeGen.DBusObjectProxy.SendMethodReturnReaderAsync(String iface, String member, Nullable`1 inSignature, MessageWriter writer)
   at Avalonia.FreeDesktop.DBusMenuExporter.DBusMenuExporterImpl.Init()
Tmds.DBus.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name com.canonical.AppMenu.Registrar was not provided by any .service files
   at Tmds.DBus.DBusConnection.CallMethodAsync(Message msg, Boolean checkConnected, Boolean checkReplyType)
   at Tmds.DBus.Connection.CallMethodAsync(Message message)
   at Tmds.DBus.CodeGen.DBusObjectProxy.SendMethodReturnReaderAsync(String iface, String member, Nullable`1 inSignature, MessageWriter writer)
   at Avalonia.FreeDesktop.DBusMenuExporter.DBusMenuExporterImpl.Init()
Sorry, we crashed
System.IO.DirectoryNotFoundException: Could not find a part of the path '/media/nate/Seagate\040Expansion\040Drive'.
   at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound)
   at System.IO.Enumeration.FileSystemEnumerator`1.Init()
   at System.IO.Enumeration.FileSystemEnumerator`1..ctor(String directory, Boolean isNormalized, EnumerationOptions options)
   at System.IO.Enumeration.FileSystemEnumerable`1..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized)
   at System.IO.Enumeration.FileSystemEnumerableFactory.UserFiles(String directory, String expression, EnumerationOptions options)
   at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
   at System.IO.Directory.GetFiles(String path)
   at Avalonia.Dialogs.ManagedFileChooserSources.<>c.<DefaultGetFileSystemRoots>b__17_0(MountedVolumeInfo x)
   at System.Linq.Enumerable.SelectIListIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.ToArray()
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Avalonia.Dialogs.ManagedFileChooserSources.DefaultGetFileSystemRoots()
   at Avalonia.Dialogs.ManagedFileChooserSources.DefaultGetAllItems(ManagedFileChooserSources sources)
   at Avalonia.Dialogs.ManagedFileChooserSources.GetAllItems()
   at Avalonia.Dialogs.ManagedFileChooserViewModel.RefreshQuickLinks(ManagedFileChooserSources quickSources)
   at Avalonia.Dialogs.ManagedFileChooserViewModel..ctor(FileSystemDialog dialog)
   at Avalonia.Dialogs.ManagedFileDialogExtensions.ManagedSystemDialogImpl`1.Show(SystemDialog d, IWindowImpl parent)
   at Avalonia.Dialogs.ManagedFileDialogExtensions.ManagedSystemDialogImpl`1.ShowFileDialogAsync(FileDialog dialog, IWindowImpl parent)
   at ICSharpCode.ILSpy.MainWindow.OpenCommandExecuted(Object sender, ExecutedRoutedEventArgs e) in /Users/jeffreye/Documents/Projects/AvaloniaILSpy/ILSpy.Core/MainWindow.xaml.cs:line 1105
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__139_0(Object state)
   at Avalonia.Threading.AvaloniaSynchronizationContext.<>c__DisplayClass5_0.<Post>b__0()
   at Avalonia.Threading.JobRunner.RunJobs(Nullable`1 priority)
   at Avalonia.X11.X11Window.<ScheduleInput>b__97_0()
   at Avalonia.Threading.JobRunner.RunJobs(Nullable`1 priority)
   at Avalonia.X11.X11PlatformThreading.HandleX11(CancellationToken cancellationToken)
   at Avalonia.X11.X11PlatformThreading.RunLoop(CancellationToken cancellationToken)
   at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken)
   at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args)
   at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode)
   at ICSharpCode.ILSpy.Program.Main(String[] args) in /Users/jeffreye/Documents/Projects/AvaloniaILSpy/ILSpy/Program.cs:line 23
jeffreye commented 3 years ago

pls check if this still happens in the latest build

TheDerevtso commented 3 years ago

I'm stuck with the same problem. Program crashes on 'Open...' click. ILSpy version 7.0.1.1.rc Linux 5.10.30.1, Manjaro 21.0.2, KDE Plasma 5.21.4.

Tmds.DBus.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name com.canonical.AppMenu.Registrar was not provided by any .service files
   at Tmds.DBus.DBusConnection.CallMethodAsync(Message msg, Boolean checkConnected, Boolean checkReplyType)
   at Tmds.DBus.Connection.CallMethodAsync(Message message)
   at Tmds.DBus.CodeGen.DBusObjectProxy.SendMethodReturnReaderAsync(String iface, String member, Nullable`1 inSignature, MessageWriter writer)
   at Avalonia.FreeDesktop.DBusMenuExporter.DBusMenuExporterImpl.Init() in /_/src/Avalonia.FreeDesktop/DBusMenuExporter.cs:line 59
Tmds.DBus.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name com.canonical.AppMenu.Registrar was not provided by any .service files
   at Tmds.DBus.DBusConnection.CallMethodAsync(Message msg, Boolean checkConnected, Boolean checkReplyType)
   at Tmds.DBus.Connection.CallMethodAsync(Message message)
   at Tmds.DBus.CodeGen.DBusObjectProxy.SendMethodReturnReaderAsync(String iface, String member, Nullable`1 inSignature, MessageWriter writer)
   at Avalonia.FreeDesktop.DBusMenuExporter.DBusMenuExporterImpl.Init() in /_/src/Avalonia.FreeDesktop/DBusMenuExporter.cs:line 59
Sorry, we crashed
System.ArgumentException: The output byte buffer is too small to contain the encoded data, encoding 'Unicode (UTF-8)' fallback 'System.Text.EncoderReplacementFallback'. (Parameter 'bytes')
   at System.Text.Encoding.ThrowBytesOverflow()
   at System.Text.Encoding.ThrowBytesOverflow(EncoderNLS encoder, Boolean nothingEncoded)
   at System.Text.Encoding.GetBytesWithFallback(ReadOnlySpan`1 chars, Int32 originalCharsLength, Span`1 bytes, Int32 originalBytesLength, EncoderNLS encoder)
   at System.Text.Encoding.GetBytesWithFallback(Char* pOriginalChars, Int32 originalCharCount, Byte* pOriginalBytes, Int32 originalByteCount, Int32 charsConsumedSoFar, Int32 bytesWrittenSoFar)
   at System.Text.UTF8Encoding.GetBytes(String s, Int32 charIndex, Int32 charCount, Byte[] bytes, Int32 byteIndex)
   at Avalonia.FreeDesktop.NativeMethods.ReadLink(String path) in /_/src/Avalonia.FreeDesktop/NativeMethods.cs:line 25
   at Avalonia.FreeDesktop.LinuxMountedVolumeInfoListener.GetSymlinkTarget(String x) in /_/src/Avalonia.FreeDesktop/LinuxMountedVolumeInfoListener.cs:line 37
   at Avalonia.FreeDesktop.LinuxMountedVolumeInfoListener.<Poll>b__8_7(FileInfo x) in /_/src/Avalonia.FreeDesktop/LinuxMountedVolumeInfoListener.cs:line 57
   at System.Linq.Enumerable.SelectArrayIterator`2.MoveNext()
   at System.Linq.Lookup`2.CreateForJoin(IEnumerable`1 source, Func`2 keySelector, IEqualityComparer`1 comparer)
   at System.Linq.Enumerable.GroupJoinIterator[TOuter,TInner,TKey,TResult](IEnumerable`1 outer, IEnumerable`1 inner, Func`2 outerKeySelector, Func`2 innerKeySelector, Func`3 resultSelector, IEqualityComparer`1 comparer)+MoveNext()
   at System.Linq.Enumerable.SelectManyIterator[TSource,TCollection,TResult](IEnumerable`1 source, Func`2 collectionSelector, Func`3 resultSelector)+MoveNext()
   at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
   at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Avalonia.FreeDesktop.LinuxMountedVolumeInfoListener.Poll(Int64 _) in /_/src/Avalonia.FreeDesktop/LinuxMountedVolumeInfoListener.cs:line 59
   at Avalonia.FreeDesktop.LinuxMountedVolumeInfoListener..ctor(ObservableCollection`1& target) in /_/src/Avalonia.FreeDesktop/LinuxMountedVolumeInfoListener.cs:line 35
   at Avalonia.FreeDesktop.LinuxMountedVolumeInfoProvider.Listen(ObservableCollection`1 mountedDrives) in /_/src/Avalonia.FreeDesktop/LinuxMountedVolumeInfoProvider.cs:line 13
   at Avalonia.Dialogs.ManagedFileChooserViewModel..ctor(FileSystemDialog dialog, ManagedFileDialogOptions options) in /_/src/Avalonia.Dialogs/ManagedFileChooserViewModel.cs:line 116
   at Avalonia.Dialogs.ManagedFileDialogExtensions.ManagedSystemDialogImpl`1.Show(SystemDialog d, Window parent, ManagedFileDialogOptions options) in /_/src/Avalonia.Dialogs/ManagedFileDialogExtensions.cs:line 14
   at Avalonia.Dialogs.ManagedFileDialogExtensions.ManagedSystemDialogImpl`1.ShowFileDialogAsync(FileDialog dialog, Window parent) in /_/src/Avalonia.Dialogs/ManagedFileDialogExtensions.cs:line 42
   at ICSharpCode.ILSpy.MainWindow.OpenCommandExecuted(Object sender, ExecutedRoutedEventArgs e) in /home/runner/work/AvaloniaILSpy/AvaloniaILSpy/ILSpy.Core/MainWindow.xaml.cs:line 1105
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__139_0(Object state)
   at Avalonia.Threading.AvaloniaSynchronizationContext.<>c__DisplayClass5_0.<Post>b__0() in /_/src/Avalonia.Base/Threading/AvaloniaSynchronizationContext.cs:line 33
   at Avalonia.Threading.JobRunner.Job.Avalonia.Threading.JobRunner.IJob.Run() in /_/src/Avalonia.Base/Threading/JobRunner.cs:line 178
   at Avalonia.Threading.JobRunner.RunJobs(Nullable`1 priority) in /_/src/Avalonia.Base/Threading/JobRunner.cs:line 37
   at Avalonia.X11.X11PlatformThreading.HandleX11(CancellationToken cancellationToken)
   at Avalonia.X11.X11PlatformThreading.RunLoop(CancellationToken cancellationToken) in /_/src/Avalonia.X11/X11PlatformThreading.cs:line 245
   at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken) in /_/src/Avalonia.Base/Threading/Dispatcher.cs:line 62
   at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 117
   at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 148
   at ICSharpCode.ILSpy.Program.Main(String[] args) in /home/runner/work/AvaloniaILSpy/AvaloniaILSpy/ILSpy/Program.cs:line 22
jeffreye commented 3 years ago

Looks like something different. Could you repost your issue to https://github.com/AvaloniaUI/Avalonia?


From: TheDerevtso @.> Sent: Monday, April 26, 2021 4:11:03 AM To: icsharpcode/AvaloniaILSpy @.> Cc: Jeffrey Ye @.>; Comment @.> Subject: Re: [icsharpcode/AvaloniaILSpy] Crashes at "open file" dialog related to escaped chars in media paths (?) (#48)

I'm stuck with the same problem. Program crushes on 'Open...' click. ILSpy version 7.0.1.1.rc Linux 5.10.30.1, Manjaro 21.0.2, KDE Plasma 5.21.4.

Tmds.DBus.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name com.canonical.AppMenu.Registrar was not provided by any .service files at Tmds.DBus.DBusConnection.CallMethodAsync(Message msg, Boolean checkConnected, Boolean checkReplyType) at Tmds.DBus.Connection.CallMethodAsync(Message message) at Tmds.DBus.CodeGen.DBusObjectProxy.SendMethodReturnReaderAsync(String iface, String member, Nullable1 inSignature, MessageWriter writer) at Avalonia.FreeDesktop.DBusMenuExporter.DBusMenuExporterImpl.Init() in /_/src/Avalonia.FreeDesktop/DBusMenuExporter.cs:line 59 Tmds.DBus.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name com.canonical.AppMenu.Registrar was not provided by any .service files at Tmds.DBus.DBusConnection.CallMethodAsync(Message msg, Boolean checkConnected, Boolean checkReplyType) at Tmds.DBus.Connection.CallMethodAsync(Message message) at Tmds.DBus.CodeGen.DBusObjectProxy.SendMethodReturnReaderAsync(String iface, String member, Nullable1 inSignature, MessageWriter writer) at Avalonia.FreeDesktop.DBusMenuExporter.DBusMenuExporterImpl.Init() in //src/Avalonia.FreeDesktop/DBusMenuExporter.cs:line 59 Sorry, we crashed System.ArgumentException: The output byte buffer is too small to contain the encoded data, encoding 'Unicode (UTF-8)' fallback 'System.Text.EncoderReplacementFallback'. (Parameter 'bytes') at System.Text.Encoding.ThrowBytesOverflow() at System.Text.Encoding.ThrowBytesOverflow(EncoderNLS encoder, Boolean nothingEncoded) at System.Text.Encoding.GetBytesWithFallback(ReadOnlySpan1 chars, Int32 originalCharsLength, Span1 bytes, Int32 originalBytesLength, EncoderNLS encoder) at System.Text.Encoding.GetBytesWithFallback(Char pOriginalChars, Int32 originalCharCount, Byte pOriginalBytes, Int32 originalByteCount, Int32 charsConsumedSoFar, Int32 bytesWrittenSoFar) at System.Text.UTF8Encoding.GetBytes(String s, Int32 charIndex, Int32 charCount, Byte[] bytes, Int32 byteIndex) at Avalonia.FreeDesktop.NativeMethods.ReadLink(String path) in //src/Avalonia.FreeDesktop/NativeMethods.cs:line 25 at Avalonia.FreeDesktop.LinuxMountedVolumeInfoListener.GetSymlinkTarget(String x) in /_/src/Avalonia.FreeDesktop/LinuxMountedVolumeInfoListener.cs:line 37 at Avalonia.FreeDesktop.LinuxMountedVolumeInfoListener.b87(FileInfo x) in //src/Avalonia.FreeDesktop/LinuxMountedVolumeInfoListener.cs:line 57 at System.Linq.Enumerable.SelectArrayIterator2.MoveNext() at System.Linq.Lookup2.CreateForJoin(IEnumerable1 source, Func2 keySelector, IEqualityComparer1 comparer) at System.Linq.Enumerable.GroupJoinIterator[TOuter,TInner,TKey,TResult](IEnumerable1 outer, IEnumerable1 inner, Func2 outerKeySelector, Func2 innerKeySelector, Func3 resultSelector, IEqualityComparer1 comparer)+MoveNext() at System.Linq.Enumerable.SelectManyIterator[TSource,TCollection,TResult](IEnumerable1 source, Func2 collectionSelector, Func3 resultSelector)+MoveNext() at System.Collections.Generic.LargeArrayBuilder1.AddRange(IEnumerable1 items) at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source) at Avalonia.FreeDesktop.LinuxMountedVolumeInfoListener.Poll(Int64 ) in //src/Avalonia.FreeDesktop/LinuxMountedVolumeInfoListener.cs:line 59 at Avalonia.FreeDesktop.LinuxMountedVolumeInfoListener..ctor(ObservableCollection1& target) in /_/src/Avalonia.FreeDesktop/LinuxMountedVolumeInfoListener.cs:line 35 at Avalonia.FreeDesktop.LinuxMountedVolumeInfoProvider.Listen(ObservableCollection1 mountedDrives) in //src/Avalonia.FreeDesktop/LinuxMountedVolumeInfoProvider.cs:line 13 at Avalonia.Dialogs.ManagedFileChooserViewModel..ctor(FileSystemDialog dialog, ManagedFileDialogOptions options) in //src/Avalonia.Dialogs/ManagedFileChooserViewModel.cs:line 116 at Avalonia.Dialogs.ManagedFileDialogExtensions.ManagedSystemDialogImpl1.Show(SystemDialog d, Window parent, ManagedFileDialogOptions options) in /_/src/Avalonia.Dialogs/ManagedFileDialogExtensions.cs:line 14 at Avalonia.Dialogs.ManagedFileDialogExtensions.ManagedSystemDialogImpl1.ShowFileDialogAsync(FileDialog dialog, Window parent) in /_/src/Avalonia.Dialogs/ManagedFileDialogExtensions.cs:line 42 at ICSharpCode.ILSpy.MainWindow.OpenCommandExecuted(Object sender, ExecutedRoutedEventArgs e) in /home/runner/work/AvaloniaILSpy/AvaloniaILSpy/ILSpy.Core/MainWindow.xaml.cs:line 1105 at System.Threading.Tasks.Task.<>c.b__139_0(Object state) at Avalonia.Threading.AvaloniaSynchronizationContext.<>cDisplayClass5_0.b_0() in //src/Avalonia.Base/Threading/AvaloniaSynchronizationContext.cs:line 33 at Avalonia.Threading.JobRunner.Job.Avalonia.Threading.JobRunner.IJob.Run() in //src/Avalonia.Base/Threading/JobRunner.cs:line 178 at Avalonia.Threading.JobRunner.RunJobs(Nullable`1 priority) in //src/Avalonia.Base/Threading/JobRunner.cs:line 37 at Avalonia.X11.X11PlatformThreading.HandleX11(CancellationToken cancellationToken) at Avalonia.X11.X11PlatformThreading.RunLoop(CancellationToken cancellationToken) in //src/Avalonia.X11/X11PlatformThreading.cs:line 245 at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken) in //src/Avalonia.Base/Threading/Dispatcher.cs:line 62 at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args) in //src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 117 at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode) in //src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 148 at ICSharpCode.ILSpy.Program.Main(String[] args) in /home/runner/work/AvaloniaILSpy/AvaloniaILSpy/ILSpy/Program.cs:line 22

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/icsharpcode/AvaloniaILSpy/issues/48#issuecomment-826749297, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AANIHUAFYT62PCKZSQ2X4LLTKVC4PANCNFSM4W7TH3LA.

TheDerevtso commented 3 years ago

Looks like something different. Could you repost your issue to https://github.com/AvaloniaUI/Avalonia?

OK. ) I'll try investigate more details about this case before that.

christophwille commented 3 years ago

Duplicate of #60