From 593fb49c77ac1aff9d7531e0c2f961ed9269d028 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sat, 4 Feb 2012 16:26:47 +0100 Subject: [PATCH] fix assembly resolver bugs --- src/AddIns/Analysis/CodeQuality/Engine/AssemblyAnalyzer.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/AddIns/Analysis/CodeQuality/Engine/AssemblyAnalyzer.cs b/src/AddIns/Analysis/CodeQuality/Engine/AssemblyAnalyzer.cs index 300440e53a..604311a3ee 100644 --- a/src/AddIns/Analysis/CodeQuality/Engine/AssemblyAnalyzer.cs +++ b/src/AddIns/Analysis/CodeQuality/Engine/AssemblyAnalyzer.cs @@ -4,6 +4,8 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; using System.Linq; using ICSharpCode.CodeQuality.Engine.Dom; using ICSharpCode.NRefactory.TypeSystem; @@ -226,7 +228,8 @@ namespace ICSharpCode.CodeQuality.Engine void AddRelationshipsForAttributes(IList attributes, NodeBase node) { foreach (var attr in attributes) { - node.AddRelationship(methodMappings[attr.Constructor]); + if (attr.Constructor != null) + node.AddRelationship(methodMappings[attr.Constructor]); } } @@ -258,6 +261,8 @@ namespace ICSharpCode.CodeQuality.Engine IEnumerable LoadAssemblies() { var resolver = new AssemblyResolver(); + foreach (var path in fileNames.Select(f => Path.GetDirectoryName(f)).Distinct(StringComparer.OrdinalIgnoreCase)) + resolver.AddSearchDirectory(path); List assemblies = new List(); foreach (var file in fileNames.Distinct(StringComparer.OrdinalIgnoreCase)) assemblies.Add(resolver.LoadAssemblyFile(file));