From 2e777201f3160b9c96b2872299f08fd38f9c4776 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Fri, 15 Mar 2024 22:01:16 +0100 Subject: [PATCH] Fix bug in UnknownType: FullName of nested unknown types did not contain the outer type name(s), but only namespace and nested type name. --- .../TypeSystem/FullTypeName.cs | 16 ++++++++++++++++ .../TypeSystem/Implementation/UnknownType.cs | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/ICSharpCode.Decompiler/TypeSystem/FullTypeName.cs b/ICSharpCode.Decompiler/TypeSystem/FullTypeName.cs index 9df4bf8a41..36712ee645 100644 --- a/ICSharpCode.Decompiler/TypeSystem/FullTypeName.cs +++ b/ICSharpCode.Decompiler/TypeSystem/FullTypeName.cs @@ -165,6 +165,22 @@ public string ReflectionName { } } + public string FullName { + get { + if (nestedTypes == null) + return topLevelType.Namespace + "." + topLevelType.Name; + StringBuilder b = new StringBuilder(topLevelType.Namespace); + b.Append('.'); + b.Append(topLevelType.Name); + foreach (NestedTypeName nt in nestedTypes) + { + b.Append('.'); + b.Append(nt.Name); + } + return b.ToString(); + } + } + /// /// Gets the total type parameter count. /// diff --git a/ICSharpCode.Decompiler/TypeSystem/Implementation/UnknownType.cs b/ICSharpCode.Decompiler/TypeSystem/Implementation/UnknownType.cs index 28a0f33b7e..9489194bf4 100644 --- a/ICSharpCode.Decompiler/TypeSystem/Implementation/UnknownType.cs +++ b/ICSharpCode.Decompiler/TypeSystem/Implementation/UnknownType.cs @@ -95,6 +95,10 @@ public override string ReflectionName { get { return namespaceKnown ? fullTypeName.ReflectionName : "?"; } } + public override string FullName { + get { return namespaceKnown ? fullTypeName.FullName : "?"; } + } + public FullTypeName FullTypeName => fullTypeName; public override int TypeParameterCount => fullTypeName.TypeParameterCount;