Skip to content

InvalidOperationException: Collection was modified; enumeration operation may not execute. #626

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Otiel opened this issue May 4, 2021 · 2 comments
Labels
Bug Issues which are bug reports Confirmed Confirmed issues released

Comments

@Otiel
Copy link

Otiel commented May 4, 2021

Describe the bug
The following MessageBox was displayed:

It seems SoundSwitch has crashed.

Collection was modified; enumeration operation may not execute.

Log content:

[16:31:52.076 INF] [Active] Refreshed all devices. 1/rec, 3/play (at SoundSwitch.Framework.Audio.Lister.CachedAudioDeviceLister.Refresh)
[16:31:52.239 INF] [Active, Unplugged] Refreshed all devices. 3/rec, 7/play (at SoundSwitch.Framework.Audio.Lister.CachedAudioDeviceLister.Refresh)
[19:38:42.684 INF] [Active, Unplugged] Refreshing all devices (at SoundSwitch.Framework.Audio.Lister.CachedAudioDeviceLister.Refresh)
[19:38:42.684 INF] [Active] Refreshing all devices (at SoundSwitch.Framework.Audio.Lister.CachedAudioDeviceLister.Refresh)
[19:38:43.002 INF] [Active] Refreshed all devices. 1/rec, 3/play (at SoundSwitch.Framework.Audio.Lister.CachedAudioDeviceLister.Refresh)
[19:38:43.002 INF] [Active] Refreshing all devices (at SoundSwitch.Framework.Audio.Lister.CachedAudioDeviceLister.Refresh)
[19:38:43.137 INF] [Active, Unplugged] Refreshed all devices. 3/rec, 6/play (at SoundSwitch.Framework.Audio.Lister.CachedAudioDeviceLister.Refresh)
[19:38:43.137 INF] [Active, Unplugged] Refreshing all devices (at SoundSwitch.Framework.Audio.Lister.CachedAudioDeviceLister.Refresh)
[19:38:43.334 INF] [Active] Refreshed all devices. 1/rec, 4/play (at SoundSwitch.Framework.Audio.Lister.CachedAudioDeviceLister.Refresh)
[19:38:43.565 INF] [Active, Unplugged] Refreshed all devices. 3/rec, 7/play (at SoundSwitch.Framework.Audio.Lister.CachedAudioDeviceLister.Refresh)
[19:40:13.938 FTL] Exception Occurred  (at SoundSwitch.Program.HandleException)
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
   at System.Collections.Generic.HashSet`1.Enumerator.MoveNext()
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
   at SoundSwitch.Framework.TrayIcon.TooltipInfoManager.TootipInfo.TooltipInfoPlayback.TextToDisplay() in C:\Users\Antoine\source\repos\SoundSwitch\SoundSwitch\Framework\TrayIcon\TooltipInfoManager\TootipInfo\TooltipInfoPlayback.cs:line 34
   at SoundSwitch.Framework.TrayIcon.TooltipInfoManager.TootipInfo.TooltipInfoBoth.TextToDisplay() in C:\Users\Antoine\source\repos\SoundSwitch\SoundSwitch\Framework\TrayIcon\TooltipInfoManager\TootipInfo\TooltipInfoBoth.cs:line 36
   at SoundSwitch.Framework.TrayIcon.TooltipInfoManager.TooltipInfoManager.ShowTooltipInfo() in C:\Users\Antoine\source\repos\SoundSwitch\SoundSwitch\Framework\TrayIcon\TooltipInfoManager\TooltipInfoManager.cs:line 89
   at System.Windows.Forms.NotifyIcon.WndProc(Message& msg)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam)

Version
SoundSwitch v5.9.0

To Reproduce
Not sure, came back to my PC after several hours and the MessageBox was displayed.

SoundSwitch-crashlog-4_5_2021.zip

@Otiel Otiel added the Bug Issues which are bug reports label May 4, 2021
@Belphemur Belphemur added the Confirmed Confirmed issues label May 5, 2021
@Belphemur
Copy link
Owner

It's a race condition, clicking on the dropdown while it's refreshing the devices ...
I'll see what I can do.

github-actions bot pushed a commit that referenced this issue May 8, 2021
### [5.9.1](v5.9.0...v5.9.1) (2021-05-08)

### Bug Fixes

* **DeviceLister:** Fix concurrency issue with the TrayIcon ([84ddc78](84ddc78)), closes [#626](#626) [#622](#622)
* **DeviceLister:** Fix concurrency issue with the TrayIcon ([a73a0de](a73a0de)), closes [#626](#626) [#625](#625)

### Languages

* **Hebrew:** Translated Settings using Weblate ([96225dd](96225dd))
* **Hebrew:** Translated Update Download using Weblate ([a8acb4f](a8acb4f))
* **Portuguese:** Translated About using Weblate ([c58c3c7](c58c3c7))
* **Portuguese:** Translated Settings using Weblate ([e29ab0d](e29ab0d))
* **Portuguese:** Translated Tray Icon using Weblate ([908c67d](908c67d))
* **Portuguese:** Translated Update Download using Weblate ([b0c9ddc](b0c9ddc))
* **Spanish:** Translated About using Weblate ([d66c9b8](d66c9b8))
* **Spanish:** Translated Settings using Weblate ([8eb75b3](8eb75b3))
* **Spanish:** Translated Tray Icon using Weblate ([a97ff96](a97ff96))
* **Spanish:** Translated Update Download using Weblate ([1bf75ca](1bf75ca))
* **Turkish:** Translated Settings using Weblate ([e789a62](e789a62))
* **Turkish:** Translated Tray Icon using Weblate ([19e2829](19e2829))
* **Turkish:** Translated Update Download using Weblate ([5e4921c](5e4921c))

### Enhancements

* **ErrorReporting:** Add proper error reporting ([44efc90](44efc90)), closes [#546](#546)
* **Profile::TrayIcon:** Update the menu to have the profile directly in the menu ([54003ea](54003ea)), closes [#628](#628)
@github-actions
Copy link
Contributor

github-actions bot commented May 8, 2021

🎉 This issue has been resolved in version 5.9.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues which are bug reports Confirmed Confirmed issues released
Projects
None yet
Development

No branches or pull requests

2 participants