Skip to content

Remove document protection before comparing#48

Merged
SimonCropp merged 1 commit into
mainfrom
Remove-document-protection-before-comparing
Jul 13, 2026
Merged

Remove document protection before comparing#48
SimonCropp merged 1 commit into
mainfrom
Remove-document-protection-before-comparing

Conversation

@SimonCropp

Copy link
Copy Markdown
Member

Word.CompareDocuments blocks indefinitely on a document with enforced editing protection: Word waits on a "remove protection to compare the documents" prompt that DisplayAlerts cannot suppress. Because Launch only sets word.Visible after the compare, this leaves WINWORD.EXE alive with no visible window.

Word.Open now strips protection from each in-memory copy before the compare. The documents are opened ReadOnly and never saved, so the files on disk are untouched. The empty-password Unprotect overload throws rather than showing its own blocking prompt, so a password- protected input surfaces as a logged failure instead of another hang.

Also fixes two pre-existing test-suite issues that this surfaced:

  • SourceDocumentsVisibleTests leaked a WINWORD process (unreleased child-document COM references prevented Quit from reaping it); it now tracks and kills the process it spawns.
  • The process-counting ProcessCleanupTests ran in parallel with the Word-spawning tests and observed their processes; the Word-touching classes now share [NotInParallel("MicrosoftWord")].

Word.CompareDocuments blocks indefinitely on a document with enforced
editing protection: Word waits on a "remove protection to compare the
documents" prompt that DisplayAlerts cannot suppress. Because Launch
only sets word.Visible after the compare, this leaves WINWORD.EXE alive
with no visible window.

Word.Open now strips protection from each in-memory copy before the
compare. The documents are opened ReadOnly and never saved, so the
files on disk are untouched. The empty-password Unprotect overload
throws rather than showing its own blocking prompt, so a password-
protected input surfaces as a logged failure instead of another hang.

Also fixes two pre-existing test-suite issues that this surfaced:
- SourceDocumentsVisibleTests leaked a WINWORD process (unreleased
  child-document COM references prevented Quit from reaping it); it now
  tracks and kills the process it spawns.
- The process-counting ProcessCleanupTests ran in parallel with the
  Word-spawning tests and observed their processes; the Word-touching
  classes now share [NotInParallel("MicrosoftWord")].
@SimonCropp SimonCropp added this to the 1.0.1 milestone Jul 13, 2026
@SimonCropp SimonCropp merged commit ec61c91 into main Jul 13, 2026
3 of 5 checks passed
@SimonCropp SimonCropp deleted the Remove-document-protection-before-comparing branch July 13, 2026 08:06
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