Skip to content

Commit

Permalink
Merge pull request #9620 from drewnoakes/fix-collection-modified-exce…
Browse files Browse the repository at this point in the history
…ption

Fix "collection modified" exception
  • Loading branch information
drewnoakes authored Dec 12, 2024
2 parents 24eabd0 + 2876142 commit d3666d9
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ public VsInfoBarService(
{
lock (s_entries)
{
foreach (InfoBar entry in s_entries)
// Copy the list to avoid "collection modified during enumeration" exceptions,
// as when the last project associated with an info bar is closed, we will
// remove that entry from the list.
foreach (InfoBar entry in s_entries.ToList())
{
entry.OnProjectClosed(_project);
}
Expand Down

0 comments on commit d3666d9

Please sign in to comment.