Version Used:
Version 17.14.13 (August 2025)
Steps to Reproduce:
Having the following code:
class Command: List<int>;
var commands = new[] {1,2,3,4,5,6,7,8 }
.Chunk(3)
.Select(chunk => {
Command command = [..chunk];
return command;
})
.ToList();
'Inline temporary variable' suggest the following code:
var commands = new[] {1,2,3,4,5,6,7,8 };
.Chunk(3)
.Select(chunk => {
return (Command)[.. chunk];
})
.ToList();
Unfortunately, this code is invalid.
Diagnostic Id:
'Inline temporary variable' refactoring.
Expected Behavior:
I think it should suggest (Command)([.. batch]) option.
Actual Behavior:
'Inline temporary variable' suggests invalid code.