dkgv / pinpoint

Keystroke launcher and personal command central. Alternative to Spotlight and Alfred for Windows. Alternative to Wox, PowerToys.
https://usepinpoint.com
GNU General Public License v3.0
153 stars 17 forks source link

Crash on startup if no ~/Pinpoint folder exists #214

Closed mgrandi closed 10 months ago

mgrandi commented 11 months ago

https://github.com/dkgv/pinpoint/blob/acfd03a6b83bb138314fd4539edf43040ba55482/Pinpoint.Core/AbstractPlugin.cs#L79

this doesn't check to see if the pinpoint or the settings for the current plugin exist before trying to load it

deleting the ~/Pinpoint folder results in this crash:

   at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
   at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
   at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
   at System.IO.File.ReadAllText(String path, Encoding encoding)
   at Pinpoint.Core.AbstractPlugin..ctor() in C:\Users\auror\Code\ThirdParty\git\pinpoint\Pinpoint.Core\AbstractPlugin.cs:line 19
   at Pinpoint.Plugin.Everything.EverythingPlugin..ctor() in C:\Users\auror\Code\ThirdParty\git\pinpoint\Pinpoint.Plugin.Everything\EverythingPlugin.cs:line 47
   at Pinpoint.Win.Views.MainWindow.LoadPlugins() in C:\Users\auror\Code\ThirdParty\git\pinpoint\Pinpoint.Win\Views\MainWindow.xaml.cs:line 136
   at Pinpoint.Win.Views.MainWindow.Window_Loaded(Object sender, RoutedEventArgs e) in C:\Users\auror\Code\ThirdParty\git\pinpoint\Pinpoint.Win\Views\MainWindow.xaml.cs:line 227
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at Pinpoint.Win.App.Main()
dkgv commented 10 months ago

Yikes... I've fixed the problem for the next release.

Issues like this are indicative of the (questionable) codebase that makes up the core of Pinpoint. Both it and the UI were originally designed with a specific scope and entirely different use case in mind so I'm considering a major overhaul when time permits.

In any case, thanks for raising this @mgrandi 👍