Skip to content

Conversation

@michaelnebel
Copy link
Contributor

No description provided.

@michaelnebel michaelnebel force-pushed the csharp/deprecatecapturedforeachvariable branch from 21e98ca to 186e42b Compare September 10, 2025 12:04
@michaelnebel michaelnebel marked this pull request as ready for review September 10, 2025 12:25
@michaelnebel michaelnebel requested a review from a team as a code owner September 10, 2025 12:25
Copilot AI review requested due to automatic review settings September 10, 2025 12:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR deprecates the C# query cs/captured-foreach-variable which detected issues with capturing foreach variables in lambdas. The deprecation is warranted since C# version 5 stabilized the semantics of capturing foreach variables, making this query obsolete for modern C# development.

Key changes:

  • Added deprecation documentation explaining the rationale
  • Marked the query as deprecated with appropriate JSDoc annotation

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
csharp/ql/src/change-notes/2025-09-10-deprecate-foreach-capture.md Documents the deprecation of the foreach capture query
csharp/ql/src/Language Abuse/ForeachCapture.ql Adds @deprecated annotation to the query header

@michaelnebel michaelnebel changed the title C#: Add change note. C#: Deprecate cs/captured-foreach-variable. Sep 10, 2025
@michaelnebel michaelnebel merged commit 0b43203 into github:main Sep 11, 2025
24 checks passed
@michaelnebel michaelnebel deleted the csharp/deprecatecapturedforeachvariable branch September 11, 2025 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants