Registry Mirror
Skip to content

Conversation

@siegfriedpammer

Copy link
Copy Markdown
Member

Clearing the assembly list left the last decompiled member on screen over an empty list.
Removing the same assemblies one at a time cleaned up correctly, which is what made it look
intermittent.

AssemblyList.Clear() raises a Reset, whose OldItems is null, and
DockWorkspace.OnAssemblyListChanged pruned the history and returned before the loop that
cancels the in-flight decompile, empties the main tab and closes the orphaned ones. Reset now
falls through to that loop with removed == null standing for "all of them", mirroring what
PruneHistoryAfterAssemblyListChange(null) already meant.

Sorting had to be fixed first

AssemblyList.Sort rebuilt the collection through Clear() plus AddRange, so it raised the
same Reset for an operation that removes nothing - which already dropped the entire
Back/Forward history as a side effect, and once Reset closes tabs would have closed every open
tab as well.

It now reorders in place with ObservableCollection.Move. A Move carries the moved entry in
OldItems, so both consumers - AssemblyTreeModel.OnActiveAssemblyListCollectionChanged and
DockWorkspace.OnAssemblyListChanged - now ignore it explicitly; otherwise the new events would
read as removals and re-create the same bug from the other direction.

Tests

AssemblyListResetTests, both written first and confirmed red against the current behaviour:
clearing the list empties the decompiled view, and sorting it keeps the navigation history.

ILSpy.Tests: 1268 tests, no failures.

Prepared by an AI agent (Claude, claude-opus-5, via Claude Code) and reviewed by @siegfriedpammer.

🤖 Generated with Claude Code

Removing assemblies one at a time cleaned up the tabs that showed them,
but clearing the whole list did not: Clear() raises a Reset whose
OldItems is null, and the handler pruned the history and returned before
the loop that empties the main tab and closes the orphaned ones. The
last decompiled member stayed on screen over an empty list.

Sorting had to be fixed first. It rebuilt the collection through Clear()
plus AddRange, so it raised the same Reset and dropped the whole
navigation history as a side effect - and once Reset closes tabs, it
would have closed all of those too. It now reorders in place, and a Move
is ignored where a removal would be handled, because a sort removes
nothing.

Assisted-by: Claude:claude-opus-5:Claude Code
@siegfriedpammer
siegfriedpammer merged commit 5db54eb into master Sep 7, 2026
17 checks passed
@siegfriedpammer
siegfriedpammer deleted the fix/stale-view-on-clear branch September 7, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant