Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QTAgent32.exe keeps a handle to a DLL open after execution

I have run into a bit of a problem using Visual Studio 2010's unit test framework. Currently the QTAgent32 will maintain a reference to a DLL after the execution of a test has finished.

The DLL in question is a c++/cli wrapper around some native c++ code. The object exposed by the wrapper is actually never assigned to by the managed code. The only reference it makes is a final check during disposal to see if it has been set during the class's life time.

If(_obj != null)
{
  _obj.Dispose();
  _obj = null;
}

I know this for a fact since if i step through the code and watch the debugger console output I can see the symbols for the DLL are not loaded until hitting the if (which makes sense). All managed objects involved implement IDisposable to make sure that all native objects are taken care to avoid memory leaks.

Based on this question: QTAgent32 Holding File Open I made sure that no filestreams were explicitly opened (including Console) and no files are even used yet the problem remains. I am running out of ideas on what to do.

Can anyone help?

TL;DR: QTAgent32.exe keeps an open reference to a c++/cli wrapper that is never instantiated.

like image 978
JMcCarty Avatar asked Jun 02 '11 19:06

JMcCarty


1 Answers

I ran into the same problem while using a Fortran DLL. The problem persisted even if the DLL function was completely empty.

I still don't know what the issue is, but an easy workaround is to specify the killing of the QTAgent32 process as a pre-build event in your project.

taskkill /f /im QTAgent32.exe
exit 0
like image 167
rybo103 Avatar answered Nov 15 '22 22:11

rybo103