none
Why would Marshal.FinalReleaseComObject take several minutes to respond? RRS feed

  • Question

  • Hi, I am new to .NET programming and writing a simple C# application. There is a dispose I am having problems with as follows:

                if (disposing && _editor != null)
                {
                    Marshal.FinalReleaseComObject(_editor);
                    _editor = null;
                }

    Sometimes the program gets hung up waiting on the Marshal.FinalReleaseComObject(). If I let it sit there for several minutes, it appears to finally return and the code runs again.

    What might cause this sort of behavior and what steps should I take to debug this further? Any help is greatly appreciated.
    Thursday, May 28, 2009 5:33 AM

Answers

  • You'll need to find out more about what that COM class does when you release its component.  There's no way to tell from this end of the Intertube.  It has nothing to do with .NET.
    Hans Passant.
    • Marked as answer by Zhi-Xin Ye Wednesday, June 3, 2009 10:49 AM
    Friday, May 29, 2009 3:30 PM
    Moderator

All replies

  • That would be your COM class taking its merry time in its destructor.  If it takes minutes, it usually has something to do with a network timeout.  Contact the vendor for support.

    Hans Passant.
    Thursday, May 28, 2009 9:59 AM
    Moderator
  • Thanks for the response. I tried disabling my network adapters, but the code still hangs waiting for the destructor.
    Friday, May 29, 2009 2:07 PM
  • You'll need to find out more about what that COM class does when you release its component.  There's no way to tell from this end of the Intertube.  It has nothing to do with .NET.
    Hans Passant.
    • Marked as answer by Zhi-Xin Ye Wednesday, June 3, 2009 10:49 AM
    Friday, May 29, 2009 3:30 PM
    Moderator