diff --git a/dnSpy/dnSpy/Documents/TreeView/DocumentTreeView.cs b/dnSpy/dnSpy/Documents/TreeView/DocumentTreeView.cs index 709dde8297..b9622551df 100644 --- a/dnSpy/dnSpy/Documents/TreeView/DocumentTreeView.cs +++ b/dnSpy/dnSpy/Documents/TreeView/DocumentTreeView.cs @@ -477,7 +477,7 @@ public FieldNode Create(FieldDef field) => // Check for bundles foreach (var n in TopNodes.OfType()) { n.TreeNode.EnsureChildrenLoaded(); - foreach (var a in n.TreeNode.DataChildren.OfType()) { + foreach (var a in GetAllBundleAssemblies(n)) { if (a.Document.AssemblyDef == asm) return a; } @@ -506,8 +506,7 @@ public FieldNode Create(FieldDef field) => // Check for bundles foreach (var n in TopNodes.OfType()) { - n.TreeNode.EnsureChildrenLoaded(); - foreach (var a in n.TreeNode.DataChildren.OfType()) { + foreach (var a in GetAllBundleAssemblies(n)) { a.TreeNode.EnsureChildrenLoaded(); foreach (var m in a.TreeNode.DataChildren.OfType()) { if (m.Document.ModuleDef == mod) @@ -519,6 +518,18 @@ public FieldNode Create(FieldDef field) => return null; } + static IEnumerable GetAllBundleAssemblies(DocumentTreeNodeData bundleNode) { + bundleNode.TreeNode.EnsureChildrenLoaded(); + foreach (var a in bundleNode.TreeNode.DataChildren.OfType()) { + yield return a; + } + foreach (var b in bundleNode.TreeNode.DataChildren.OfType()) { + b.TreeNode.EnsureChildrenLoaded(); + foreach (var a in GetAllBundleAssemblies(b)) + yield return a; + } + } + public TypeNode? FindNode(TypeDef? td) { if (td is null) return null; @@ -683,8 +694,7 @@ public IEnumerable GetAllModuleNodes() { } if (node is BundleDocumentNode bundleNode) { - bundleNode.TreeNode.EnsureChildrenLoaded(); - foreach (var a in bundleNode.TreeNode.DataChildren.OfType()) { + foreach (var a in GetAllBundleAssemblies(bundleNode)) { a.TreeNode.EnsureChildrenLoaded(); foreach (var m in a.TreeNode.DataChildren.OfType()) { yield return m;