diff --git a/csharp/ql/src/Language Abuse/ForeachCapture.ql b/csharp/ql/src/Language Abuse/ForeachCapture.ql index 0148796a2e72..2f8346817a6f 100644 --- a/csharp/ql/src/Language Abuse/ForeachCapture.ql +++ b/csharp/ql/src/Language Abuse/ForeachCapture.ql @@ -1,4 +1,6 @@ /** + * @deprecated This query is no longer relevant as the semantics of capturing a 'foreach' variable + * and using it outside the loop has been stable since C# version 5. * @name Capturing a foreach variable * @description Code that captures a 'foreach' variable and uses it outside the loop behaves differently in C# version 4 and C# version 5 * @kind problem diff --git a/csharp/ql/src/change-notes/2025-09-10-deprecate-foreach-capture.md b/csharp/ql/src/change-notes/2025-09-10-deprecate-foreach-capture.md new file mode 100644 index 000000000000..5628e9496286 --- /dev/null +++ b/csharp/ql/src/change-notes/2025-09-10-deprecate-foreach-capture.md @@ -0,0 +1,4 @@ +--- +category: deprecated +--- +* The query `cs/captured-foreach-variable` has been deprecated as the semantics of capturing a 'foreach' variable and using it outside the loop has been stable since C# version 5.