I ran into a strange issue today when I was trying to figure out why my TFS Build was reporting that the build was partially successful even though every test was passing. The normal build report really did not give any good reason why it was partially successful other than the fact that it was something related to the unit tests (I am using MS Test in this case). So I cracked open the build log and peeled through the entries. I noticed that when the code coverage was attempting to instrument the assemblies it reported that several of the assemblies could not be located. Then I remembered I did some refactoring and I renamed and consolidated some assemblies.
Well that should be an easy fix all I had to do was remove these assemblies from the test run config in the Code Coverage section. So I opened up the LocalTestRun.testrunconfig file in Visual Studio 2008 and selected the Code Coverage section to make my changes. As soon as I did this the config editor closed down (crashed). Wow that was weird I never saw that before. Hmmm I wonder what it could be. Well here is what I did to try and locate the issue.
- Perhaps the Test Run Config file needs to be checked out of source control for write access. Nope that wasn't it.
- Well if I cant edit it in VS 2008 then I might as well try notepad. I removed the offending assemblies using notepad in the LocalTestRun.testrunconfig. However once I opened up the Test Run Config editor and selected the Code Coverage the editor still crashed.
- Perhaps I malformed the Test Run Config xml file. So I opened it up again in notepad and the XML looked fine. Besides if this XML was malformed I don't think the Test Run Config editor would not open at all.
- Consult almighty search engine. Wow look what I found http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=391255 and it was only reported 2 days ago.
So to be sure that I got the Test Run Config file right I removed my Database project from my solution made my edits for Code Coverage in the Test Run Config editor, then added the database project back into the solution.
After fixing the Test Run Config file my build ran successfully.