Skip to content

Conversation

@aelfsyg
Copy link

@aelfsyg aelfsyg commented Jul 4, 2024

It is possible that service bus messages will share a message id. This was causing issues when deleting messages as it called .Single(pred) yet there were multiple matching messages. This PR matches on message id and sequence number when deleting messages instead.

System.InvalidOperationException: Sequence contains more than one matching element
   at System.Linq.ThrowHelper.ThrowMoreThanOneMatchException()
   at System.Linq.Enumerable.TryGetSingle[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
   at PurpleExplorer.Models.MessageCollection.RemoveMessage(String messageId) in /home/ae/src/ext/PurpleExplorer/PurpleExplorer/Models/MessageCollection.cs:line 53
   at PurpleExplorer.ViewModels.MessageDetailsWindowViewModel.DeleteMessage(Window window) in /home/ae/src/ext/PurpleExplorer/PurpleExplorer/ViewModels/MessageDetailsWindowViewModel.cs:line 83
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_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 181
   at Avalonia.Threading.JobRunner.RunJobs(Nullable`1 priority) in /_/src/Avalonia.Base/Threading/JobRunner.cs:line 37
   at Avalonia.X11.X11PlatformThreading.CheckSignaled() in /_/src/Avalonia.X11/X11PlatformThreading.cs:line 164
   at Avalonia.X11.X11PlatformThreading.RunLoop(CancellationToken cancellationToken) in /_/src/Avalonia.X11/X11PlatformThreading.cs:line 244
   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 PurpleExplorer.Program.Main(String[] args) in /home/ae/src/ext/PurpleExplorer/PurpleExplorer/Program.cs:line 13

timabell added a commit to timabell/PurpleExplorer that referenced this pull request Jan 20, 2025
telstrapurple#99

* delete-dup-msg-id:
  When deleting messages, match by message id and seq no.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant