Use the correct streams instead of UI methods to in PrintValidationInfo
powercode opened this issue · 0 comments
powercode commented
When using
foreach (ValidationInfo validationInfo in validationList.Where(c => c.Severity == Severity.Warning))
{
this.Host.UI.WriteWarningLine(validationInfo.Message);
}
foreach (ValidationInfo validationInfo in validationList.Where(c => c.Severity == Severity.Error))
{
this.Host.UI.WriteErrorLine(validationInfo.Message);
}
instead of Cmdlet.WriteWarning
/Cmdlet.WriteError
, we don't get capture the information. The validation info is lost (i.e. only outputted to the console.
The warning and error streams should be used instead. In that way the user can capture and act on the information using the WarningVariable and ErrorVariable parameters.