From 6d3744a1ebab751b51d47b8bba40f49950c650c8 Mon Sep 17 00:00:00 2001 From: Christoph Wille Date: Thu, 14 May 2026 10:05:36 +0200 Subject: [PATCH 1/2] Fix #3734: Search pane flickers when navigating to search result in large assembly --- ILSpy/Search/SearchPane.xaml.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ILSpy/Search/SearchPane.xaml.cs b/ILSpy/Search/SearchPane.xaml.cs index 206417a980..9316d9650d 100644 --- a/ILSpy/Search/SearchPane.xaml.cs +++ b/ILSpy/Search/SearchPane.xaml.cs @@ -19,6 +19,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; +using System.Linq; using System.Collections.ObjectModel; using System.ComponentModel; using System.Composition; @@ -75,14 +76,23 @@ public SearchPane(AssemblyTreeModel assemblyTreeModel, ITreeNodeFactory treeNode InitializeComponent(); ContextMenuProvider.Add(listBox); - MessageBus.Subscribers += (sender, e) => CurrentAssemblyList_Changed(); + MessageBus.Subscribers += (sender, e) => CurrentAssemblyList_Changed(e); MessageBus.Subscribers += (sender, e) => Settings_PropertyChanged(sender, e); CompositionTarget.Rendering += UpdateResults; } - void CurrentAssemblyList_Changed() + void CurrentAssemblyList_Changed(CurrentAssemblyListChangedEventArgs e) { + // Don't restart the search when only auto-loaded (dependency) assemblies are added; + // this avoids flickering when navigating to a result in a large assembly. + System.Collections.Specialized.NotifyCollectionChangedEventArgs collectionChange = e; + if (collectionChange.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add + && collectionChange.NewItems?.Cast().All(asm => asm.IsAutoLoaded) == true) + { + return; + } + if (IsVisible) { StartSearch(this.SearchTerm); From e2f6ff4618d9d1c76d69561b2903c9f78c65b43d Mon Sep 17 00:00:00 2001 From: Christoph Wille Date: Thu, 14 May 2026 10:33:45 +0200 Subject: [PATCH 2/2] Comment as per review request --- ILSpy/Search/SearchPane.xaml.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/ILSpy/Search/SearchPane.xaml.cs b/ILSpy/Search/SearchPane.xaml.cs index 9316d9650d..668787c353 100644 --- a/ILSpy/Search/SearchPane.xaml.cs +++ b/ILSpy/Search/SearchPane.xaml.cs @@ -86,6 +86,7 @@ void CurrentAssemblyList_Changed(CurrentAssemblyListChangedEventArgs e) { // Don't restart the search when only auto-loaded (dependency) assemblies are added; // this avoids flickering when navigating to a result in a large assembly. + // Explicit variable assignment necessary bc implicit operator T on WrappedEventArgs System.Collections.Specialized.NotifyCollectionChangedEventArgs collectionChange = e; if (collectionChange.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add && collectionChange.NewItems?.Cast().All(asm => asm.IsAutoLoaded) == true)