I can't quite figure out the root cause of why its failing, but found this working and broken cases for ToArray() on IEnumerable.
https://deck.net/a664ebec105b796041f8ab8ea6e496c0
https://deck.net/a664ebec105b796041f8ab8ea6e496c0
public static void Broken(string[] strings)
{
var stringEnumerable = new string[]{"_"}.Concat(strings);
var stringArray = stringEnumerable.ToArray();
}
public static void Works(string[] strings)
{
var stringEnumerable = Enumerable.Repeat("_", 1).Concat(strings);
var stringArray = stringEnumerable.ToArray();
}
Its strange that string[] breaks while Enumerable.Repeat side steps whatever the issue is-- Hopefully these two cases help track it down more easily.
Comment