diff --git a/ILSpy/TreeNodes/BaseTypesEntryNode.cs b/ILSpy/TreeNodes/BaseTypesEntryNode.cs index 138c86e52da..a2603579b6b 100644 --- a/ILSpy/TreeNodes/BaseTypesEntryNode.cs +++ b/ILSpy/TreeNodes/BaseTypesEntryNode.cs @@ -58,7 +58,7 @@ internal static bool ActivateItem(SharpTreeNode node, ITypeDefinition def) public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) { - language.WriteCommentLine(output, language.TypeToString(type, includeNamespace: true)); + language.DecompileType(type, output, options); } IEntity IMemberTreeNode.Member => type; diff --git a/ILSpy/TreeNodes/BaseTypesTreeNode.cs b/ILSpy/TreeNodes/BaseTypesTreeNode.cs index d2d79650c53..1b65d9fc8b6 100644 --- a/ILSpy/TreeNodes/BaseTypesTreeNode.cs +++ b/ILSpy/TreeNodes/BaseTypesTreeNode.cs @@ -71,7 +71,8 @@ public override void Decompile(Language language, ITextOutput output, Decompilat App.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(EnsureLazyChildren)); foreach (ILSpyTreeNode child in this.Children) { - child.Decompile(language, output, options); + if (child is IMemberTreeNode { Member: ITypeDefinition childType }) + language.WriteCommentLine(output, language.TypeToString(childType, includeNamespace: true)); } } } diff --git a/ILSpy/TreeNodes/DerivedTypesEntryNode.cs b/ILSpy/TreeNodes/DerivedTypesEntryNode.cs index fa4fa0c9a7a..372ebfa805e 100644 --- a/ILSpy/TreeNodes/DerivedTypesEntryNode.cs +++ b/ILSpy/TreeNodes/DerivedTypesEntryNode.cs @@ -96,7 +96,7 @@ public override void ActivateItem(System.Windows.RoutedEventArgs e) public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) { - language.WriteCommentLine(output, language.TypeToString(type, includeNamespace: true)); + language.DecompileType(type, output, options); } IEntity IMemberTreeNode.Member => type; diff --git a/ILSpy/TreeNodes/DerivedTypesTreeNode.cs b/ILSpy/TreeNodes/DerivedTypesTreeNode.cs index 46dcbf6d70c..930f95ae8f2 100644 --- a/ILSpy/TreeNodes/DerivedTypesTreeNode.cs +++ b/ILSpy/TreeNodes/DerivedTypesTreeNode.cs @@ -16,9 +16,11 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. +using System; using System.Collections.Generic; using System.Linq; using System.Threading; +using System.Windows.Threading; using ICSharpCode.Decompiler; using ICSharpCode.Decompiler.TypeSystem; @@ -101,7 +103,13 @@ static bool IsSameType(SRM.MetadataReader referenceMetadata, SRM.EntityHandle ty public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) { - threading.Decompile(language, output, options, EnsureLazyChildren); + App.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(EnsureLazyChildren)); + for (int i = 0; i < Children.Count; i++) + { + // LazyChildren are async and will not be ready on first call, so avoid foreach. + if (Children[i] is IMemberTreeNode { Member: ITypeDefinition childType }) + language.WriteCommentLine(output, language.TypeToString(childType, includeNamespace: true)); + } } } } \ No newline at end of file