This time a leak from my professional life (read “what I am making money with”). I have habit of writing unit tests for all the business logic code, which leads sometimes to over-relying on the outcome of the unit tests, but that is not what I want to share now. In this case the tests that were running happily for several months, but then ‘suddenly’ stopped working on my test machine puzzling me with the following exception:
System.Configuration.ConfigurationErrorsException : The configuration section for Logging cannot be found in the configuration source.
What? I have copied all the files (that’s a ‘normal’ mistake), recompiled, re-checked the contents of them. No luck. So the last resort was to check the opinion of the NUnit (upgraded from NUnit 2.5.2 from 2.5.7) regarding the configuration file to be loaded for the test DLL. While it seemed all OK several times, when I really looked in the details I was not delighted. And here is why.
Open the NUnit configuration under
NUnit | Project | Edit | General | Configuration File Name and check carefully what file name it expects to find.
By default NUnit seem to take <dll_name_without_extension>.config, while we had <dll_name>.dll.config. It all worked fine months before, but now it didn’t.
Just changing the file name to the correct one restored the happy green bar in NUnit.
This cost me about half-an-hour of compile-debug-stare-pull-hair exercise :(. Arggghhhh…