79330505

Date: 2025-01-05 09:51:07
Score: 3
Natty:
Report link

I've got an odd "Doesn't seem to close" problem in my XUnit tests. I have tests for both in-memory and on-disk databases. If I run the in-memory test by itself it succeeds - writing data to the in-memory db and then reading it back correctly. The on-disk test creates a Database file with tables but no data and disposes of the DbContext at the test end. If it runs then my in-memory read/write test fails (it writes out without throwing but reading in reads nothing) UNLESS I wait one second at the start of the in-memory test which then succeeds. The GC.Collect() doesn't work for me but I haven't really created all that much garbage so I'm wondering if the GC.Collect() is just running long enough in other people's code to take up the time that my one second wait does (well, obviously not a second but long enough). I have pooling off but it appears that some sort of async thing is happening after the DbContext disposal in my on-disk test that causes my other test to fail and waiting out whatever that async process is causes things to work.

Reasons:
  • RegEx Blacklisted phrase (2): doesn't work for me
  • Long answer (-1):
  • No code block (0.5):
  • Single line (0.5):
  • Low reputation (1):
Posted by: user2183130