From 4c8e606a6a8378b1e416c8a3d01600076160c395 Mon Sep 17 00:00:00 2001 From: Christoph Wille Date: Sun, 26 Apr 2026 10:24:35 +0200 Subject: [PATCH] Fix #3705: Code window is empty when select a .baml and refresh --- ILSpy/AssemblyTree/AssemblyTreeModel.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ILSpy/AssemblyTree/AssemblyTreeModel.cs b/ILSpy/AssemblyTree/AssemblyTreeModel.cs index 0d22f9b28..c2de7768e 100644 --- a/ILSpy/AssemblyTree/AssemblyTreeModel.cs +++ b/ILSpy/AssemblyTree/AssemblyTreeModel.cs @@ -946,12 +946,31 @@ namespace ICSharpCode.ILSpy.AssemblyTree } private void RefreshInternal() + { + _ = RefreshInternalAsync(); + } + + private async Task RefreshInternalAsync() { using (Keyboard.FocusedElement.PreserveFocus()) { var path = GetPathForNode(SelectedItem); ShowAssemblyList(settingsService.AssemblyListManager.LoadList(AssemblyList.ListName)); + + // Ensure assembly loaded before FindNodeByPath to allow lazy-loaded resource nodes to be found + if (path?.Length > 0) + { + foreach (var asm in AssemblyList.GetAssemblies()) + { + if (asm.FileName == path[0]) + { + await asm.GetMetadataFileAsync().Catch(_ => { }); + break; + } + } + } + SelectNode(FindNodeByPath(path, true), inNewTabPage: false); RefreshDecompiledView();