private IReadOnlyList<ProjectRuleSetConflict> FindConflicts(RuleSetInformation[] aggregatedRuleSet)
{
List<ProjectRuleSetConflict> conflicts = new List<ProjectRuleSetConflict>();
IRuleSetInspector inspector = this.serviceProvider.GetService<IRuleSetInspector>();
inspector.AssertLocalServiceIsNotNull();
// At the moment single threaded, if needed this could be done in parallel
foreach (RuleSetInformation aggregate in aggregatedRuleSet)
{
try
{
RuleConflictInfo conflict = inspector.FindConflictingRules(aggregate.BaselineFilePath, aggregate.RuleSetFilePath, aggregate.RuleSetDirectories);
Debug.Assert(conflict != null);
if (conflict?.HasConflicts ?? false)
{
conflicts.Add(new ProjectRuleSetConflict(conflict, aggregate));
}
}
catch (Exception ex)
{
if (ErrorHandler.IsCriticalException(ex))
{
throw;
}
this.WriteWarning(Strings.ConflictsManagerFailedInFindConflicts, aggregate.RuleSetFilePath, aggregate.BaselineFilePath, ex.Message);
Debug.Fail("Failed to resolve conflict for " + aggregate.RuleSetFilePath, ex.ToString());
}
}
return conflicts;
}