Skip to content

Conversation

@vb2ae
Copy link
Member

@vb2ae vb2ae commented Nov 3, 2025

Potential fix for https://github.com/Caliburn-Micro/Caliburn.Micro/security/code-scanning/79

To fix the problem, rewrite the foreach (var item in items) loop inside the RemoveRange local function (lines 253-260 in RemoveRange(IEnumerable<T> items)) to iterate directly over the indexes generated from the items using LINQ's .Select(item => IndexOf(item)). For each index, perform the conditional check and potential removal as before. This is accomplished by changing the loop to foreach (var index in items.Select(item => IndexOf(item))). Ensure that System.Linq is imported (if not already present) for .Select to function.

Edit only the affected method in src/Caliburn.Micro.Core/BindableCollection.cs, specifically lines 253-260 within RemoveRange(). No new method definitions are required. Double-check that using System.Linq; is imported at the top of the file (in the provided lines, it is not), so add it.


Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…se Select

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
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.

2 participants