Closed jake-carpenter closed 3 weeks ago
Build failures seem to be based on new mac images with .NET 6 not installed, which is probably not something I should address with code here.
Hello
This works fine only if "Parameter Type" for "Generic Array Type" is set to IEnumerable, however if it set to ICollection it will fail. And by fail I mean it will generate Count() and ElementAt() which are not supported by ICollection
The only way I was able to fix this is by adding namespance System.Linq
Using the
Length
property assumes the collection will be a C# array, but that is based on theparameterArrayType
setting for the C# client generator. By default,IEnumerable
is used and the majority of other collection types won't accept Length.For now, this fix utilizes the LINQ
Count()
, which theoretically should check forLength
orCount
properties on it's own before enumerating. This seems like it is still an improvement to the enumeration that was present before the linked changeset. I'm open to solving this a different way if there are ways to access the C# type during generation.There are likely other templates where this is also a problem, but this fix is focused on path parameter generation.