Code is behaving differently in Release vs Debug Mode

后端 未结 6 1462
一向
一向 2020-12-19 03:52

We have some unit tests that fail when run in Release mode vs debug mode. If I attach a debugger in release mode the tests pass. There is way too much code to publish here s

6条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-19 04:12

    Just to add my two cents to this, I recently found that I had a date comparison in an sql procedure that the testing called. The dates were all auto-generated prior in the test procedure and values were inserted into the DB, and so occasionally they were exactly the same (when using RunTests) causing a null to be returned on a table join. Not what I was expecting. Obviously, in debug mode, since I'm slowly progressing through it, there will be a difference in the auto-generated times which meant that I never bumped into the error. I resolved this by inserting

    Threading.Thread.Sleep(520)

    wherever there would definitely be a delay between actions. Problem fixed.

提交回复
热议问题