none
Marshal.ReleaseComObject *without* closing Word? RRS feed

  • Question

  • I have an app that creates reports in Word (MS Office 2010, 32-bit). After the report has been created, I want to keep the document open in Word so the user can edit it.

    If I release COM objects (Word.Document, Word.Application) at this point, two different things happen on Windows XP and on Windows 7 development stations:

    - On Windows 7 (64-bit) any action in Word crashes it  with "Microsoft Word has stopped working"; trying to debug comes to "Unhandled exception at 0x773915de in WINWORD.EXE: 0xC0000374: A heap has been corrupted."

    - On Windows XP everything works fine, no crashes at all.

    Also: If I don't invoke ReleaseComObject, Word does not crash on Windows 7; if I close the document and exit Word, and then ReleaseComObject, it doesn't crash either.

    Well, I can imagine that releasing COM object (Word.Application) while Word is still running might be a bad idea, but why does it work on Win XP?

    Any suggestions? Unfortunately, quitting Word is not an option, as it will close any other open documents.

    Wednesday, May 29, 2013 9:35 AM

Answers

All replies