goatcorp / Dalamud

FFXIV plugin framework and API
GNU Affero General Public License v3.0
1.14k stars 270 forks source link

Plugin installer: very rare InvalidOperationException #1087

Open Limiana opened 1 year ago

Limiana commented 1 year ago

Once in a while, there will be this error when working with plugin installer window:

2023-01-16 09:34:01.610 +03:00 [ERR] [Dalamud] Error during OnDraw
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
   at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
   at Dalamud.Interface.Internal.Windows.PluginInstaller.PluginInstallerWindow.DrawAvailablePluginList() in C:\goatsoft\companysecrets\dalamud\Interface\Internal\Windows\PluginInstaller\PluginInstallerWindow.cs:line 881
   at Dalamud.Interface.Internal.Windows.PluginInstaller.PluginInstallerWindow.DrawPluginCategoryContent() in C:\goatsoft\companysecrets\dalamud\Interface\Internal\Windows\PluginInstaller\PluginInstallerWindow.cs:line 1094
   at Dalamud.Interface.Internal.Windows.PluginInstaller.PluginInstallerWindow.DrawPluginCategories() in C:\goatsoft\companysecrets\dalamud\Interface\Internal\Windows\PluginInstaller\PluginInstallerWindow.cs:line 1013
   at Dalamud.Interface.Internal.Windows.PluginInstaller.PluginInstallerWindow.Draw() in C:\goatsoft\companysecrets\dalamud\Interface\Internal\Windows\PluginInstaller\PluginInstallerWindow.cs:line 224
   at Dalamud.Interface.Windowing.Window.DrawInternal() in C:\goatsoft\companysecrets\dalamud\Interface\Windowing\Window.cs:line 274
   at Dalamud.Interface.Windowing.WindowSystem.Draw() in C:\goatsoft\companysecrets\dalamud\Interface\Windowing\WindowSystem.cs:line 144
   at Dalamud.Interface.Internal.DalamudInterface.OnDraw() in C:\goatsoft\companysecrets\dalamud\Interface\Internal\DalamudInterface.cs:line 455

The error has been happening since a long while but it is rare and I can't reliably reproduce it too. I've been rarely seeing it in some other people's log. I'm personally most likely to encounter it when enabling/disabling dev plugins. It also causes style var leaking: image (perhaps if issue can't be easily identified and fixed - wrap code between style var push/pop in try-catch block as a temporary solution?)

Aireil commented 1 year ago

I tried adding the temporary try catch (that would have became permanent, let's be real) to avoid it breaking style in #1026 , but goat didn't like it. Also tried fixing some of the concurrency issues a while ago, which did decrease the chance of it happening, but didn't remove it completely.

Aireil commented 1 year ago

There's an attempt to fix this on staging, hopefully this doesn't happen anymore, but I can't reproduce it before or after the fix, hard to tell if it worked.

goaaats commented 1 year ago

Seems to be a lot better nowadays but there are still bugs like this in the installer and profile manager. I'm planning a rewrite but it's still a while out, probably.