Example #1
0
        public IEnumerable <BreakingChangeDependency> FindBreakingChanges(IEnumerable <FrameworkName> targets,
                                                                          IDictionary <MemberInfo, ICollection <AssemblyInfo> > dependencies,
                                                                          IEnumerable <AssemblyInfo> assembliesToIgnore,
                                                                          IEnumerable <string> breakingChangesToSuppress,
                                                                          ICollection <string> submittedAssemblies,
                                                                          bool showRetargettingIssues = false)
        {
            // Only proceed to find breaking changes for full .NET Framework (that's where they are applicable)
            var fullFrameworkVersions = targets
                                        .Where(t => string.Equals(t.Identifier, FullFrameworkIdentifier, StringComparison.OrdinalIgnoreCase))
                                        .Select(t => t.Version)
                                        .ToList();

            if (!fullFrameworkVersions.Any())
            {
                yield break;
            }

            foreach (var kvp in dependencies)
            {
                if (MemberIsInFramework(kvp.Key, submittedAssemblies))
                {
                    var breakingChanges = _recommendations.GetBreakingChanges(kvp.Key.MemberDocId).Distinct();
                    foreach (var b in breakingChanges)
                    {
                        if (!showRetargettingIssues && b.IsRetargeting)
                        {
                            continue;
                        }

                        if (BreakingChangeIsInVersionRange(fullFrameworkVersions, b) && !(breakingChangesToSuppress?.Contains(b.Id) ?? false))
                        {
                            foreach (var a in kvp.Value)
                            {
                                // If the assembly referencing the broken API is on the ignore list, continue
                                if (assembliesToIgnore != null && assembliesToIgnore.Contains(a))
                                {
                                    continue;
                                }

                                yield return(new BreakingChangeDependency
                                {
                                    Break = b,
                                    DependantAssembly = a,
                                    Member = kvp.Key
                                });
                            }
                        }
                    }
                }
            }
        }