WalletWasabi: System.InvalidOperationException: Call from invalid thread

Edit: how to reproduce: https://github.com/zkSNACKs/WalletWasabi/issues/7956#issuecomment-1138750418

  1. Type “ff” in the SearchBar
  2. Click on Settings
  3. Toggle the Theme
  4. Click on the SearchBar
  5. Hit the Delete button (to remove the “ff”

This does not happen always but Wasabi crashes while typing and deleting in the SearchBar.

2022-05-10 10:50:06.205 [1] CRITICAL    Program.Main (97)       System.InvalidOperationException: Call from invalid thread
   at Avalonia.Threading.Dispatcher.VerifyAccess() in /_/src/Avalonia.Base/Threading/Dispatcher.cs:line 48
   at Avalonia.AvaloniaObject.set_InheritanceParent(IAvaloniaObject value) in /_/src/Avalonia.Base/AvaloniaObject.cs:line 70
   at Avalonia.StyledElement.Avalonia.Controls.ISetLogicalParent.SetParent(ILogical parent) in /_/src/Avalonia.Styling/StyledElement.cs:line 412
   at Avalonia.StyledElement.ClearLogicalParent(IList children) in /_/src/Avalonia.Styling/StyledElement.cs:line 751
   at Avalonia.Visual.LogicalChildrenCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) in /_/src/Avalonia.Visuals/Visual.cs:line 383
   at Avalonia.Collections.AvaloniaList`1.NotifyRemove(T item, Int32 index) in /_/src/Avalonia.Base/Collections/AvaloniaList.cs:line 726
   at Avalonia.Collections.AvaloniaList`1.Remove(T item) in /_/src/Avalonia.Base/Collections/AvaloniaList.cs:line 493
   at Avalonia.Controls.ItemsControl.OnContainersDematerialized(ItemContainerEventArgs e) in /_/src/Avalonia.Controls/ItemsControl.cs:line 285
   at Avalonia.Controls.Generators.ItemContainerGenerator.RemoveRange(Int32 startingIndex, Int32 count) in /_/src/Avalonia.Controls/Generators/ItemContainerGenerator.cs:line 127
   at Avalonia.Controls.Presenters.ItemContainerSync.<ItemsChanged>g__Remove|0_1(<>c__DisplayClass0_0& ) in /_/src/Avalonia.Controls/Presenters/ItemContainerSync.cs:line 37
   at Avalonia.Controls.Presenters.ItemContainerSync.ItemsChanged(ItemsPresenterBase owner, IEnumerable items, NotifyCollectionChangedEventArgs e) in /_/src/Avalonia.Controls/Presenters/ItemContainerSync.cs:line 47
   at Avalonia.Controls.Presenters.ItemVirtualizerNone.ItemsChanged(IEnumerable items, NotifyCollectionChangedEventArgs e) in /_/src/Avalonia.Controls/Presenters/ItemVirtualizerNone.cs:line 59
   at Avalonia.Controls.Presenters.ItemsPresenterBase.ItemsCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) in /_/src/Avalonia.Controls/Presenters/ItemsPresenterBase.cs:line 265
   at Avalonia.Collections.NotifyCollectionChangedExtensions.<>c__DisplayClass1_0.<WeakSubscribe>b__0(NotifyCollectionChangedEventArgs e) in /_/src/Avalonia.Base/Collections/NotifyCollectionChangedExtensions.cs:line 40
   at Avalonia.Reactive.LightweightObservableBase`1.PublishNext(T value) in /_/src/Avalonia.Base/Reactive/LightweightObservableBase.cs:line 118
   at Avalonia.Collections.NotifyCollectionChangedExtensions.WeakCollectionChangedObservable.OnEvent(Object sender, WeakEvent ev, NotifyCollectionChangedEventArgs e) in /_/src/Avalonia.Base/Collections/NotifyCollectionChangedExtensions.cs:line 75
   at Avalonia.Utilities.WeakEvent`2.Subscription.OnEvent(Object sender, TEventArgs eventArgs) in /_/src/Avalonia.Base/Utilities/WeakEvent.cs:line 149
   at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.Collection`1.Remove(T item)
   at DynamicData.Binding.ObservableCollectionAdaptor`2.DoUpdate(IChangeSet`2 updates, IObservableCollection`1 list) in D:\a\DynamicData\DynamicData\src\DynamicData\Binding\ObservableCollectionAdaptor.cs:line 125
   at DynamicData.Binding.ObservableCollectionAdaptor`2.Adapt(IChangeSet`2 changes, IObservableCollection`1 collection) in D:\a\DynamicData\DynamicData\src\DynamicData\Binding\ObservableCollectionAdaptor.cs:line 121
   at DynamicData.ObservableCacheEx.<>c__DisplayClass25_0`2.<Bind>b__1(IChangeSet`2 changes) in D:\a\DynamicData\DynamicData\src\DynamicData\Cache\ObservableCacheEx.cs:line 625
   at System.Reactive.Linq.ObservableImpl.Select`2.Selector._.OnNext(TSource value) in /_/Rx.NET/Source/src/System.Reactive/Linq/Observable/Select.cs:line 48
--- End of stack trace from previous location ---
   at System.Reactive.PlatformServices.ExceptionServicesImpl.Rethrow(Exception exception) in /_/Rx.NET/Source/src/System.Reactive/Internal/ExceptionServicesImpl.cs:line 19
   at System.Reactive.ExceptionHelpers.Throw(Exception exception) in /_/Rx.NET/Source/src/System.Reactive/Internal/ExceptionServices.cs:line 16
   at System.Reactive.Stubs.<>c.<.cctor>b__2_1(Exception ex) in /_/Rx.NET/Source/src/System.Reactive/Internal/Stubs.cs:line 16
   at System.Reactive.AnonymousSafeObserver`1.OnError(Exception error) in /_/Rx.NET/Source/src/System.Reactive/AnonymousSafeObserver.cs:line 62
   at System.Reactive.Sink`1.ForwardOnError(Exception error) in /_/Rx.NET/Source/src/System.Reactive/Internal/Sink.cs:line 60
   at System.Reactive.ObserveOnObserverNew`1.DrainStep(ConcurrentQueue`1 q) in /_/Rx.NET/Source/src/System.Reactive/Internal/ScheduledObserver.cs:line 559
   at System.Reactive.ObserveOnObserverNew`1.DrainShortRunning(IScheduler recursiveScheduler) in /_/Rx.NET/Source/src/System.Reactive/Internal/ScheduledObserver.cs:line 513
   at Avalonia.Threading.AvaloniaScheduler.<>c__DisplayClass4_1`1.<Schedule>b__1() in /_/src/Avalonia.Base/Threading/AvaloniaScheduler.cs:line 45
   at Avalonia.Threading.JobRunner.RunJobs(Nullable`1 priority) in /_/src/Avalonia.Base/Threading/JobRunner.cs:line 37
   at Avalonia.Win32.Win32Platform.WndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam) in /_/src/Windows/Avalonia.Win32/Win32Platform.cs:line 278
   at Avalonia.Win32.Interop.UnmanagedMethods.DispatchMessage(MSG& lpmsg)
   at Avalonia.Win32.Win32Platform.RunLoop(CancellationToken cancellationToken) in /_/src/Windows/Avalonia.Win32/Win32Platform.cs:line 205
   at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken) in /_/src/Avalonia.Base/Threading/Dispatcher.cs:line 65
   at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 120
   at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 209
   at WalletWasabi.Fluent.Desktop.Program.Main(String[] args) in WalletWasabi.Fluent.Desktop\Program.cs:line 78

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (2 by maintainers)

Most upvoted comments

@SuperJMN has found how to reproduce this:

hey! I have found a 100% repro on the threading issue!

  1. Type “ff” in the SearchBar
  2. Click on Settings
  3. Toggle the Theme
  4. Click on the SearchBar
  5. Hit the Delete button (to remove the “ff”

@yahiheb how much time did it take to reproduce it? Do you just type random characters one by one? do you delete one by one? Do you make random pauses between each char?

Thanks!

Honestly it is hard for me to reproduce it, but I simply type a bunch of characters then delete them. I do also change the theme back and forth I don’t know if that is related.

I tried a couple of times but I cannot reproduce this.

@SuperJMN please investigate this