Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Make sure the enumerable is a List #390

Merged
merged 2 commits into from
Jun 23, 2023

Conversation

sandercox
Copy link
Contributor

@sandercox sandercox commented Jun 23, 2023

This allows to setup the Tags field which is a List. IEnumerable of the SelectListIterator does not convert to a List. An IEnumerable of List does.


After PR#373 the code was introduced to Trim installer URLs, and trim these properties.

Apparently this works for these URLs that get set to a property of IEnumerable<string> but when trying to set the Tags when setting optional default locale fields, this threw an Exception:

System.ArgumentException: 'Object of type 'System.Linq.Enumerable+SelectListIterator`2[System.String,System.String]' cannot be converted to type 'System.Collections.Generic.List`1[System.String]'.'

Apparently an IEnumerable<string> can be set to a List<string> when the enumerable comes from an actual List<string> but not from a Linq based List.

Turning the Trimmed list back into a real List (it originates from Prompt.List()) it seems to work for both URLs and the Tags.

Microsoft Reviewers: codeflow:open?pullrequest=#390

This allows to setup the `Tags` field which is a List<T>.
IEnumerable<T> of the SelectListIterator does not convert
to a List<T>. An IEnumerable<T> of List<T> does.
@sandercox sandercox requested a review from a team as a code owner June 23, 2023 11:28
@sandercox sandercox requested review from yao-msft and ryfu-msft and removed request for a team June 23, 2023 11:28
@ryfu-msft
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@ryfu-msft ryfu-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this :)

@ryfu-msft
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants