-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add support for bool, strings and arrays in Configuration settings #3135
Conversation
This comment has been minimized.
This comment has been minimized.
src/Microsoft.Management.Configuration.Processor/Extensions/ValueSetExtensions.cs
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
arrayValues.end(), | ||
[](const IKeyValuePair<winrt::hstring, winrt::Windows::Foundation::IInspectable>& a, const IKeyValuePair<winrt::hstring, winrt::Windows::Foundation::IInspectable>& b) | ||
{ | ||
return a.Key() < b.Key(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These keys are strings and won't sort numerically.
{ | ||
if (input.empty()) | ||
{ | ||
return {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This returns an empty optional, which isn't what I would expect. It should return an optional with an empty string in it.
template <typename T> | ||
std::optional<T> try_as() const | ||
{ | ||
Require(Type::Scalar); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will throw if the node isn't a scalar. Should it just return an empty optional instead?
src/AppInstallerSharedLib/Yaml.cpp
Outdated
// Avoid THROW_HR to don't log. | ||
if (Utility::CaseInsensitiveEquals(m_scalar, "true") || | ||
Utility::CaseInsensitiveEquals(m_scalar, "false")) | ||
else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would continue to use the early return pattern rather than an else
.
{ | ||
return true; | ||
return std::optional{ static_cast<int>(std::stoll(m_scalar, 0, 0)) }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return std::optional{ static_cast<int>(std::stoll(m_scalar, 0, 0)) }; | |
return std::optional{ static_cast<int>(std::stol(m_scalar, 0, 0)) }; |
{ | ||
if (!valueSet.ContainsKey(TreatAsArray)) | ||
{ | ||
throw new InvalidOperationException(); | ||
} | ||
|
||
var result = new List<object>(); | ||
var sortedList = new SortedList<string, object>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string sort won't work once we hit 11 items.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Microsoft Reviewers: Open in CodeFlow