开发者

QTAgent32 Holding File Open

We're writting an app that will extract first text and then images from various files.

In our test scripts we are finding that once we have extracted the text and try to open the file for image extraction that the file is being held open by another process开发者_JAVA技巧.

We have closed all references to the file, disposed them and set them to null.

Using Process Explorer we found that it was QTAgent32 that was holding it open.

How can we tell this library to release the handle or is this a known bug and it won't affect the production code?


QTAgent32 is Visual Studio's test runner.

This means that your test has a FileStream that you forgot to close.


Try running the tests in debug, pausing execution, and seeing what you break on. (There's a good answer somewhere on stackoverflow about this "poor man's profiling" technique).

I solved my instance of this problem this way. On the first try, I was surprised to see execution break on a call to NetworkStream.Read. It was running on a background thread so the tests were still passing, but it was obviously not intended to be included in the tests. It was dead code anyway, so I completely removed it, restarted VS, and the tests are running smoothly again.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜