-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Open
Labels
Description
Version Used:
From #error version: Compiler version: '5.5.0-2.26153.17 (68f89b7e2593bb313560a7b612739ae7f8ffd128)'. Language version: 14.0.
Steps to Reproduce:
(Minimal reproduction solution here)
- Create a new C# console project with a
net10.0target,<LangVersion>Preview</LangVersion>. - Add the following code.
using System.Collections.Immutable;
Dictionary<int, ImmutableList<int>> original = new() { { 1, [1, 1] } };
Dictionary<int, ImmutableList<int>> shallowClone = new(original);
Console.WriteLine(shallowClone[1].Count);
Note the analyzer message: IDE0028 Collection initialization can be simplified
3. Apply the Codefix.
Note the buildable result: Dictionary<int, ImmutableList<int>> shallowClone = [with(original)];
Expected Behavior:
No analyzer result OR codefix that produces buildable code.
Actual Behavior:
Analyzer result with invalid codefix.
Reactions are currently unavailable