Visual Studio project using the Quality Center API remains in memory

Posted by Traveling Tech Guy on Stack Overflow See other posts from Stack Overflow or by Traveling Tech Guy
Published on 2010-05-04T15:53:16Z Indexed on 2010/05/04 15:58 UTC
Read the original article Hit count: 489

Hi, Currently developing a connector DLL to HP's Quality Center. I'm using their (insert expelative) COM API to connect to the server. An Interop wrapper gets created automatically by VStudio.

My solution has 2 projects: the DLL and a tester application - essentially a form with buttons that call functions in the DLL. Everything works well - I can create defects, update them and delete them. When I close the main form, the application stops nicely.

But when I call a function that returns a list of all available projects (to fill a combo box), if I close the main form, VStudio still shows the solution as running and I have to stop it.

I've managed to pinpoint a single function in my code that when I call, the solution remains "hung" and if I don't, it closes well. It's a call to a property in the TDC object get_VisibleProjects that returns a List (not the .Net one, but a type in the COM library) - I just iterate over it and return a proper list (that I later use to fill the combo box):

    public List<string> GetAvailableProjects()
    {
        List<string> projects = new List<string>();
        foreach (string project in this.tdc.get_VisibleProjects(qcDomain))
        {
            projects.Add(project);
        }
        return projects;
    }

My assumption is that something gets retained in memory. If I run the EXE outside of VStudio it closes - but who knows what gets left behind in memory?

My question is - how do I get rid of whatever calling this property returns? Shouldn't the GC handle this? Do I need to delve into pointers?

Things I've tried:

  1. getting the list into a variable and setting it to null at the end of the function
  2. Adding a destructor to the class and nulling the tdc object
  3. Stepping through the tester function application all the way out, whne the form closes and the Main function ends - it closes, but VStudio still shows I'm running.

Thanks for your assistance!

© Stack Overflow or respective owner

Related posts about debug

Related posts about com