Skip to content

fix(il): preserve Size Map drill state across cross-assembly gd#161

Merged
willibrandon merged 1 commit into
mainfrom
fix/159-il-inspector-esc-loses-treemap-breadcrumb
May 1, 2026
Merged

fix(il): preserve Size Map drill state across cross-assembly gd#161
willibrandon merged 1 commit into
mainfrom
fix/159-il-inspector-esc-loses-treemap-breadcrumb

Conversation

@willibrandon

Copy link
Copy Markdown
Owner

Fixes: #159

Follow-on to #160. That PR fixed the cross-view back tab, so Esc from a cross-assembly gd lands on Size Map again — but the user's position within Size Map was still being wiped. PushAssemblyDirect → ResetViewState clears TreemapCurrentLevel, TreemapBreadcrumb, the selection/match indices, CachedSizeTree, and the Size Map SearchState. The IL back entry didn't snapshot any of it, so the second Esc returned the user to the Size Map root instead of the drilled type they came from.

Snapshot the full Size Map navigation state into a new TreemapBackState record on cross-assembly push and restore it on the cross-assembly branch of RestoreFromIlBackEntry after PopAssembly. CachedSizeTree is part of the snapshot so the lazy ??= rebuild on next render is a no-op and SizeNode references stay identity-consistent — drill-up via the restored breadcrumb walks the original object graph end-to-end. Tests use Assert.Same rather than Assert.Equal because SizeNode is a record, and value-equal duplicates would have hidden a "we restored a copy not the original" bug. Local-gd entries skip the snapshot to avoid retaining the tree on the back stack.

The state-level test is parameterized across the three external dispatch paths (call / ldsfld / castclass), so NavigateToExternalMethod, ExternalField, and ExternalType all run through the same restore branch. The UI integration test waits for the exact rendered breadcrumb (built from SizeNode.Name, joined with " > ") after two real Esc presses.

PR #160 fixed the cross-view back tab so Esc lands on Size Map. But
the user's position within Size Map was still wiped by ResetViewState
during PushAssemblyDirect: TreemapCurrentLevel, TreemapBreadcrumb,
TreemapSelectedIndex, TreemapMatchIndex, CachedSizeTree, and the Size
Map SearchState all reset to defaults. After Esc twice the user landed
at the root level instead of the drilled type they came from.

Snapshot the full Size Map navigation state into a new TreemapBackState
record on cross-assembly PushIlBackEntry, restore it after PopAssembly
in RestoreFromIlBackEntry's cross-assembly branch. CachedSizeTree is
snapshotted alongside the breadcrumb so restored SizeNode references
stay identity-consistent — the next render skips the lazy ??= rebuild
and keeps the user's original navigation graph. Search snapshot uses a
new internal SearchState.RestoreFrom helper. Local-gd entries skip the
snapshot to avoid retaining the SizeNode graph unnecessarily.

Coverage parameterizes the unit test as a Theory across all three
external dispatch paths (call/ldsfld/castclass) plus a "drilled to
root" identity case, a no-drill no-fabrication regression guard, a
local-gd regression guard, and a real-keys UI test asserting the
rendered breadcrumb after two Escapes.

Fixes #159
@willibrandon willibrandon added bug Something isn't working navigation Cross-view linking and tab navigation il IL disassembly and bytecode inspection size-map Size Map tab — treemap navigation, breadcrumb, and drill state labels May 1, 2026
@willibrandon willibrandon self-assigned this May 1, 2026
@willibrandon willibrandon merged commit c2562a4 into main May 1, 2026
4 checks passed
@willibrandon willibrandon deleted the fix/159-il-inspector-esc-loses-treemap-breadcrumb branch May 1, 2026 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working il IL disassembly and bytecode inspection navigation Cross-view linking and tab navigation size-map Size Map tab — treemap navigation, breadcrumb, and drill state

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Esc on IL Inspector loses Size Map back target after gd into external method

1 participant