From 93db1041b13a27c7d53042a6f4aba9c751e797ba Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Wed, 10 Jun 2026 15:50:17 +0200 Subject: [PATCH] Decompile a single method in the slow Options tests Two Options tests selected the whole System.Linq.Enumerable type and then awaited WaitForDecompiledTextAsync. That decompile takes >15 s in headless and overran the 60 s wait on a loaded CI runner, so the suite flaked intermittently (green in one run of a commit, red in another). The behaviours under test -- that a re-decompile setting refreshes the active tab, and that the refresh does not steal focus from the Options tab -- fire on whatever the tab shows, so a single small method exercises them just as well and decompiles near-instantly. Assisted-by: Claude:claude-opus-4-8:Claude Code --- ILSpy.Tests/Options/DisplaySettingsReactionTests.cs | 9 ++++++++- ILSpy.Tests/Options/OptionsTabTests.cs | 9 +++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ILSpy.Tests/Options/DisplaySettingsReactionTests.cs b/ILSpy.Tests/Options/DisplaySettingsReactionTests.cs index 5b09ca435..7646fb32e 100644 --- a/ILSpy.Tests/Options/DisplaySettingsReactionTests.cs +++ b/ILSpy.Tests/Options/DisplaySettingsReactionTests.cs @@ -59,9 +59,16 @@ public class DisplaySettingsReactionTests public async Task Toggling_A_Decompiler_Output_Setting_Re_Decompiles_The_Active_Tab() { var (_, vm) = await TestHarness.BootAsync(); + // Decompile a single small method rather than the whole Enumerable type: the full type + // takes >15 s in headless and times out WaitForDecompiledTextAsync under CI load. The + // re-decompile reaction under test fires on whatever the active tab shows, so one method + // exercises it just as well. var typeNode = vm.AssemblyTreeModel.FindNode( "System.Linq", "System.Linq", "System.Linq.Enumerable"); - vm.AssemblyTreeModel.SelectedItem = typeNode; + typeNode.IsExpanded = true; + var method = typeNode.Children.OfType() + .First(m => m.MethodDefinition.Name == "Empty"); + vm.AssemblyTreeModel.SelectNode(method); var tab = await vm.DockWorkspace.WaitForDecompiledTextAsync(); int decompileStarts = 0; diff --git a/ILSpy.Tests/Options/OptionsTabTests.cs b/ILSpy.Tests/Options/OptionsTabTests.cs index 98e451bee..5722fd809 100644 --- a/ILSpy.Tests/Options/OptionsTabTests.cs +++ b/ILSpy.Tests/Options/OptionsTabTests.cs @@ -309,10 +309,15 @@ public class OptionsTabTests // pull focus back to MainTab and yank the user off the Options page they are editing. var (_, vm) = await TestHarness.BootAsync(3); - // Show some decompiled content first, so there is a decompiler tab to refresh. + // Show some decompiled content first, so there is a decompiler tab to refresh. Use a single + // small method, not the whole Enumerable type: the full type takes >15 s in headless and + // times out WaitForDecompiledTextAsync under CI load. var typeNode = vm.AssemblyTreeModel.FindNode( "System.Linq", "System.Linq", "System.Linq.Enumerable"); - vm.AssemblyTreeModel.SelectNode(typeNode); + typeNode.IsExpanded = true; + var method = typeNode.Children.OfType() + .First(m => m.MethodDefinition.Name == "Empty"); + vm.AssemblyTreeModel.SelectNode(method); await vm.DockWorkspace.WaitForDecompiledTextAsync(); // Open Options and confirm it is the active document.