-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
Description
Version Used:
Version 17.14.0 Preview 2.0 [35828.13.main]
Steps to Reproduce:
using System.Collections.Concurrent;
ConcurrentQueue<int> queue = new ConcurrentQueue<int>();
BlockingCollection<int> bc = new(queue);
bc.Add(42);
Console.WriteLine(queue.Count);
Running that outputs 1
. Then run the fixer, which changes the code to:
using System.Collections.Concurrent;
ConcurrentQueue<int> queue = new ConcurrentQueue<int>();
BlockingCollection<int> bc = [.. queue, 42];
Console.WriteLine(queue.Count);
and that outputs 0
.
Diagnostic Id:
IDE0028
Expected Behavior:
Either a note in the fixer that program behavior might be changed meaningfully, ala what IDE0028 provides in other cases:
or somehow not fire in the cases of ownership transfer semantics.