Avoid duplicate messages

This commit is contained in:
Mihai Codoban 2016-03-30 18:22:35 -07:00
parent 8a3ddc9c8a
commit 4c84e686d0

View file

@ -300,13 +300,19 @@ namespace Microsoft.DotNet.ProjectModel
private static string ComposeMessageFromInnerExceptions(Exception exception)
{
var sb = new StringBuilder();
var messages = new HashSet<string>();
while (exception != null)
{
sb.AppendLine(exception.Message);
messages.Add(exception.Message);
exception = exception.InnerException;
}
foreach (var message in messages)
{
sb.AppendLine(message);
}
return sb.ToString();
}