Disposing of Microsoft.Office.Interop.Word.Application
Do you not need to call Quit
?
app.Quit();
Perhaps try setting doc = null
and calling GC.Collect()
Edit, not really my own code I forget where I got it but this is what I use to dispose of Excel, and it does the job maybe you can glean something from this:
public void DisposeExcelInstance()
{
app.DisplayAlerts = false;
workBook.Close(null, null, null);
app.Workbooks.Close();
app.Quit();
if (workSheet != null)
System.Runtime.InteropServices.Marshal.ReleaseComObject(workSheet);
if (workBook != null)
System.Runtime.InteropServices.Marshal.ReleaseComObject(workBook);
if (app != null)
System.Runtime.InteropServices.Marshal.ReleaseComObject(app);
workSheet = null;
workBook = null;
app = null;
GC.Collect(); // force final cleanup!
}