creewick / uWidgets

Standalone .NET application with a variety of customizable widgets
Other
191 stars 8 forks source link

Adding clock widget crashes the app and its only possible to add 1 clock #33

Closed Dadangdut33 closed 3 months ago

Dadangdut33 commented 3 months ago

Describe the bug While trying out the widgets i found out that if you try to add a clock widget the app will crash. The widget will shows up if you try to restart the app but you cannot add any more clock widgets as the widgets in the option is gone.

To Reproduce Steps to reproduce the behavior:

  1. Go to Settings
  2. Click on Clock widgets
  3. Add desired type of clock
  4. See error happens

Expected behavior It should not crash the app and we should be able to add multiple clock widgets.

Screenshots image

Desktop

Crash log

Sequence contains no matching element
   at System.Linq.ThrowHelper.ThrowNoMatchException()
   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
   at uWidgets.Core.Services.AssemblyProvider.LoadAssembly(String name)
   at uWidgets.Services.WidgetFactory.CreateInternal(WidgetLayout widgetLayout)
   at uWidgets.Views.Pages.Gallery.Button_OnClick(Object sender, RoutedEventArgs e)
   at Avalonia.Interactivity.EventRoute.RaiseEventImpl(RoutedEventArgs e)
   at Avalonia.Interactivity.EventRoute.RaiseEvent(Interactive source, RoutedEventArgs e)
   at Avalonia.Interactivity.Interactive.RaiseEvent(RoutedEventArgs e)
   at Avalonia.Controls.Button.OnClick()
   at Avalonia.Controls.Button.OnPointerReleased(PointerReleasedEventArgs e)
   at Avalonia.Reactive.LightweightObservableBase`1.PublishNext(T value)
   at Avalonia.Interactivity.EventRoute.RaiseEventImpl(RoutedEventArgs e)
   at Avalonia.Interactivity.EventRoute.RaiseEvent(Interactive source, RoutedEventArgs e)
   at Avalonia.Interactivity.Interactive.RaiseEvent(RoutedEventArgs e)
   at Avalonia.Input.MouseDevice.MouseUp(IMouseDevice device, UInt64 timestamp, IInputRoot root, Point p, PointerPointProperties props, KeyModifiers inputModifiers, IInputElement hitTest)
   at Avalonia.Input.MouseDevice.ProcessRawEvent(RawPointerEventArgs e)
   at Avalonia.Threading.Dispatcher.Send(SendOrPostCallback action, Object arg, Nullable`1 priority)
   at Avalonia.Controls.TopLevel.HandleInput(RawInputEventArgs e)
   at Avalonia.Win32.WindowImpl.AppWndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam)
   at Avalonia.Win32.WindowImpl.WndProcMessageHandler(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam)
   at Avalonia.Win32.Interop.UnmanagedMethods.DispatchMessage(MSG& lpmsg)
   at Avalonia.Win32.Win32DispatcherImpl.RunLoop(CancellationToken cancellationToken)
   at Avalonia.Threading.DispatcherFrame.Run(IControlledDispatcherImpl impl)
   at Avalonia.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken)
   at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args)
   at uWidgets.Program.Main(String[] args)
creewick commented 3 months ago

@amir1387aht I removed your comment and asking you not to post any executables in the comment section. If you have a fix, consider creating a Pull Request.

creewick commented 3 months ago

@Dadangut33 There was some breaking changes, that I haven't mention in the release notes. Please try to remove any Clock items from the layout.json or just replace that file with the new version. Let me know if that helped

Dadangdut33 commented 3 months ago

That was weird. I copied the layout and appsettings from the release but it still crashes. But then i just delete all the stuff and using the release version directly and it works. I guess it was just some sort of settings problem or maybe the dll does not get replaced properly when i copied it before.

It works now! But i suggest that you should add some sort of setting validation and maybe make an installer for future updates so this mistake could be avoided. Thanks for the fix

creewick commented 3 months ago

Yeah, we discussed this idea today in another issue: https://github.com/creewick/uWidgets/issues/34 Automatic updates would be a nice step towards better usability.