Skip to content

Fix Move Diagrams to Separate File and Model Browser restore - #2

Merged
robertmclaws merged 1 commit into
mainfrom
fix/diagram-migration-and-model-browser-restore
Aug 9, 2026
Merged

Fix Move Diagrams to Separate File and Model Browser restore#2
robertmclaws merged 1 commit into
mainfrom
fix/diagram-migration-and-model-browser-restore

Conversation

@robertmclaws

Copy link
Copy Markdown
Collaborator

Move Diagrams to Separate File

  • Resolved the project from the artifact instead of the Solution Explorer selection — ItemOperations.AddExistingItem threw when invoked from anywhere else
  • Diagram file now nests under the EDMX, matching how the shipping designer records it
  • Skips the add for Misc Files and already-globbed SDK-style projects; logs and continues if the project system refuses
  • Captured the document name before migrating — the reload resets the current context, so CurrentDocData came back null on the save
  • Replaced a Debug.Assert and an unchecked cast with real guards; both were live NREs in Release
  • Guarded IsLinkProjectItem against project items exposing no DTE properties

Designer surface context menu

  • Added the command under Show Data Types, using KnownMonikers.MoveToFolder
  • Hidden once the diagrams already live in a .edmx.diagram file
  • Shares one eligibility predicate and one execution path with the Model Browser command, so the two can't disagree

Model Browser startup exception

  • Marked the tool window transient so the shell stops restoring a frame ModelingPackage cannot resolve
  • EntityDesignExplorerWindow is a shell ToolWindowPane; the DSL registry that CreateToolWindow reads is typed to DSL ToolWindow, so its slot can never be registered
  • Behaviour change: the window no longer reappears docked at startup. It previously did, as an exception box that was dead until a model loaded
  • specs/model-browser-toolwindow-restore.md records the four approaches ruled out against the compiler, and the IVsPackage.CreateTool route if restore-at-startup is ever needed

Tests

  • 3 tests, each mutation-checked by reverting its fix and confirming it fails
  • A 4th was written and deleted: it passed with the guard removed, and reached VsUtils.ShowMessageBox, which degrades to a blocking modal dialog with no shell — it would have hung CI rather than failed
  • The migration, status handler and tool window restore need the Exp hive; verification steps are in the spec

🤖 Generated with Claude Code

- Resolve the diagram file's project from the artifact instead of the
  Solution Explorer selection, which threw when invoked outside it
- Skip the project add for Misc Files and already-globbed SDK-style
  items; log and continue if the project system refuses
- Capture the document name before migrating; the reload resets the
  current context and CurrentDocData came back null
- Guard IsLinkProjectItem against project items with no DTE properties
- Add the command to the designer surface WPF context menu, sharing one
  eligibility predicate and one execution path with the Model Browser
- Mark the Model Browser tool window transient so the shell stops
  restoring a frame ModelingPackage cannot resolve

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@robertmclaws
robertmclaws merged commit b22fdd2 into main Aug 9, 2026
4 checks passed
@robertmclaws
robertmclaws deleted the fix/diagram-migration-and-model-browser-restore branch August 9, 2026 11:01
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