From 47a47016f30f949eaacc28aceec41d36c22e3e9b Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Thu, 4 Oct 2012 16:10:00 +0200 Subject: [PATCH] Add support for empty namespaces in the C# type system. --- ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpAssembly.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpAssembly.cs b/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpAssembly.cs index bda16fc326..181099b29c 100644 --- a/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpAssembly.cs +++ b/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpAssembly.cs @@ -99,6 +99,10 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem root = new NS(this); Dictionary dict = new Dictionary(compilation.NameComparer); dict.Add(string.Empty, root); + // Add namespaces declared in C# files, even if they're empty: + foreach (var usingScope in projectContent.Files.OfType().SelectMany(f => f.UsingScopes)) { + GetOrAddNamespace(dict, usingScope.NamespaceName); + } foreach (var pair in GetTypes()) { NS ns = GetOrAddNamespace(dict, pair.Key.Namespace); if (ns.types != null)