Browse Source

Fix SD-1874 - Attribute code completion not working for assemblies that reference assemblies using a different .NET framework version to those referenced by the project.

pull/22/merge
Matt Ward 14 years ago
parent
commit
69c7dde1e3
  1. 4
      src/Main/Base/Project/Src/Services/ParserService/ParseProjectContent.cs
  2. 25
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ProjectContent/ReflectionProjectContent.cs

4
src/Main/Base/Project/Src/Services/ParserService/ParseProjectContent.cs

@ -104,7 +104,7 @@ namespace ICSharpCode.SharpDevelop @@ -104,7 +104,7 @@ namespace ICSharpCode.SharpDevelop
}
foreach (IProjectContent referencedContent in referencedContents) {
if (referencedContent is ReflectionProjectContent) {
((ReflectionProjectContent)referencedContent).InitializeReferences();
((ReflectionProjectContent)referencedContent).InitializeReferences(referencedContents);
}
}
}
@ -262,7 +262,7 @@ namespace ICSharpCode.SharpDevelop @@ -262,7 +262,7 @@ namespace ICSharpCode.SharpDevelop
foreach (IProjectContent referencedContent in referencedContents) {
if (referencedContent is ReflectionProjectContent) {
((ReflectionProjectContent)referencedContent).InitializeReferences();
((ReflectionProjectContent)referencedContent).InitializeReferences(referencedContents);
}
}

25
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ProjectContent/ReflectionProjectContent.cs

@ -4,8 +4,8 @@ @@ -4,8 +4,8 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using ICSharpCode.SharpDevelop.Dom.ReflectionLayer;
namespace ICSharpCode.SharpDevelop.Dom
@ -162,12 +162,17 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -162,12 +162,17 @@ namespace ICSharpCode.SharpDevelop.Dom
List<DomAssemblyName> missingNames;
public void InitializeReferences()
{
InitializeReferences(new IProjectContent[0]);
}
public void InitializeReferences(IProjectContent[] existingContents)
{
bool changed = false;
if (initialized) {
if (missingNames != null) {
for (int i = 0; i < missingNames.Count; i++) {
IProjectContent content = registry.GetExistingProjectContent(missingNames[i]);
IProjectContent content = GetExistingProjectContent(existingContents, missingNames[i]);
if (content != null) {
changed = true;
lock (ReferencedContents) {
@ -200,6 +205,22 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -200,6 +205,22 @@ namespace ICSharpCode.SharpDevelop.Dom
OnReferencedContentsChanged(EventArgs.Empty);
}
IProjectContent GetExistingProjectContent(IProjectContent[] existingProjectContents, DomAssemblyName fullAssemblyName)
{
IProjectContent content = registry.GetExistingProjectContent(fullAssemblyName);
if (content != null) {
return content;
} else if (existingProjectContents.Any()) {
return GetExistingProjectContentForShortName(existingProjectContents, fullAssemblyName.ShortName);
}
return null;
}
IProjectContent GetExistingProjectContentForShortName(IProjectContent[] existingProjectContents, string shortName)
{
return existingProjectContents.FirstOrDefault(pc => pc.AssemblyName == shortName);
}
public override string ToString()
{
return string.Format("[{0}: {1}]", GetType().Name, assemblyFullName);

Loading…
Cancel
Save