Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel release problem - Dr Watson error

Status
Not open for further replies.

Custom24

Programmer
Nov 27, 2001
591
GB
Hi
My vb.net app uses Excel 97 (MSO97.DLL) through com interop as normal. The problem is when it comes to releasing the reference.

Here is the sequence for instantiating excel

Dim xlApp as Excel.Application
xlApp = CType(CreateObject("Excel.Application"), Excel.Application)

(I always require a new instance so as not to interfere with what the user is doing)

Here is the sequence for the destruction

xlApp.DisplayAlerts = False
xlApp.Workbooks.Close()
xlApp.Quit()
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlApp)
xlApp = Nothing
GC.Collect()
this next line fires a doctor watson - excel com interop problem.
GC.WaitForPendingFinalizers()

I know that the bit about the GC is not a good idea, but the Dr Watson error occurs without the Marshal.Release, or the two GC lines anyway. I simply put these in to nail it down to one line of code, and it is the WaitForPendingFinalizers which does it.

PS The Dr Watson message is a normal one

excel.exe - Application Error
The instruction at "0x30032ff9" referenced memory at "0x65177f98". The memory could not be "read".

Has anyone else had similar problems?
 
hi, i know it's an old thread, but, do you remember the solution to your problem ?
i do have the same

thanks

regards,
Elise
(author of french .NET tutorial like
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top