NUnit [TearDown] fails — what process is accessing my files?

前端 未结 11 2597
你的背包
你的背包 2021-02-12 14:17

Final Edit: I found a solution to the problem (at the bottom of the question).

I\'ve got an Nunit problem that\'s causing me grief. Edit:

11条回答
  •  盖世英雄少女心
    2021-02-12 14:57

    I know this answer is over a year late, but for anyone reading in the future...

    I had a similar problem to yours - attempting to delete test databases in between tests failed because of the SQLite database file remaining open. I traced the problem in my code to a SQLiteDataReader object not being explicitly closed.

    SQLiteDataReader dr = cmd_.ExecuteReader();
    while (dr.Read())
    {
        // use the DataReader results
    }
    dr.Close();  //  <-- necessary for database resources to be released
    

提交回复
热议问题