This repository has been archived on 2024-06-23. You can view files and clone it, but cannot push or open issues or pull requests.
OctobotStealth/src/Services
Octol1ttle 438ecfb41b
Force enumeration of global collections before using them (#106)
This PR closes #105 

This PR fixes exceptions caused by changing a collection's contents
while it is being enumerated. This can often happen with Guild- and
MemberDatas. By using `ToArray()` on these global collections and using
it in the `foreach` loop, we create a new copy of the collection,
preventing any modification to it.

While this does introduce a lot of memory allocations, there is no
fixing that. Usually, the fix to these exceptions would be to convert
the `foreach` to a reverse-`for`. However, because indices cannot be
used on these collections, that is not possible.

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-09-12 16:28:46 +03:00
..
Update Force enumeration of global collections before using them (#106) 2023-09-12 16:28:46 +03:00
BackgroundGuildDataSaverService.cs Add periodic guild data saving (every 5 minutes) (#99) 2023-08-22 07:44:05 +00:00
GuildDataService.cs Force enumeration of global collections before using them (#106) 2023-09-12 16:28:46 +03:00
UtilityService.cs Add a new .editorconfig and reformat code (#76) 2023-08-02 20:51:16 +00:00