Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/Microsoft.DotNet.PackageTesting/VerifyClosure.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ private void AddSourceFile(string file)

private void LoadIgnoredReferences()
{
foreach (var ignoredReference in IgnoredReferences.DefaultIfEmpty())
if (IgnoredReferences == null || IgnoredReferences.Length == 0) return;

foreach (var ignoredReference in IgnoredReferences)
{
var name = ignoredReference.ItemSpec;
var versionString = ignoredReference.GetMetadata("Version");
Expand Down Expand Up @@ -174,9 +176,9 @@ void CheckDependencies(Stack<AssemblyInfo> depStack)
AssemblyInfo assm = depStack.Peek();

// check module references
if (assm.State == CheckState.Unchecked && CheckModuleReferences)
if (assm.State == CheckState.Unchecked && CheckModuleReferences && assm.ModuleReferences != null)
{
foreach(var moduleReference in assm.ModuleReferences.DefaultIfEmpty())
foreach(var moduleReference in assm.ModuleReferences)
{
if (ShouldIgnore(moduleReference))
{
Expand Down
5 changes: 3 additions & 2 deletions src/Microsoft.DotNet.PackageTesting/VerifyTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Metadata;
using System.Reflection.PortableExecutable;
Expand Down Expand Up @@ -125,7 +124,9 @@ private void AddSourceFile(string file)

private void LoadIgnoredTypes()
{
foreach(var ignoredType in IgnoredTypes.DefaultIfEmpty())
if (IgnoredTypes == null || IgnoredTypes.Length == 0) return;

foreach(var ignoredType in IgnoredTypes)
{
ignoredTypes.Add(ignoredType.ItemSpec);
}
Expand Down