Skip to content

FieldBuilder.BuildForType<T>() is returning a fixed size collection #11584

Closed

Description

The changes made here 9 month ago introduced a change whereby the collection of Field objects used to be an actual List<Field> that was returned and projected as an IList<Field> to what is now an Array.

The line below shows that .ToArray() was used when returning the collection of Field objects which doesn't allow modifying the data structure at runtime. We use dynamic properties on our Index schema so that when we call .Add(field) our runtime fails with a NotSupportedException: Collection was of a fixed size

return contract.Properties.Select(BuildField).Where(field => field != null).ToArray();

I believe simply changing ToArray() to ToList() would solve this problem. Going to follow up with a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

ClientThis issue points to a problem in the data-plane of the library.Searchcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions