I want to encapsulate the use of Excel Interop to make it easier to use in a reusable library.
So far I have written several tests that work well, except that between each test I force Excel to have no descriptor for the test file in order to be able to delete.
As soon as I exit the application instance after each of my tests, Excel seems to no longer respond, causing Windows to display
"Excel stops working and looking for a solution"
message. This message lasts several seconds while Excel closes, causing the file to freeze, and my tests throw an exception, for example
"Cannot access the file because it is being used by another process ..."
message. Otherwise, each of my tests is individually performed just fine!
Is there a key to solving this problem?
Am I abusing the method ApplicationClass.Quit()?
Exiting Excel only after testing using my tests leads to the fact that files created for testing purposes cannot be deleted.
Thank! =)
source
share