For my project I am using the integrated Visual Studio unit-testing framework but I am having some issues that I never saw before.
One of my classes is causing VSTestHost to crash. So first I though it was because there was a bunch of code causing a stack overflow. What is really strange is that now, even if I create a new project or use older projects that were working before, VSTestHost is crashing immediately (1/2 second after I clicking on the run tests button). In fact I just cannot unit-test anymore... This is really driving me crazy.
I tried many solutions found on the Internet to fix that problem but nothing worked. I had to restore Windows to my last update to get it back working normally. What is sure is that it is one particular test class which cause the unit-test framework to go mad. When I run this test class for the first time everything goes well and all the tests pass, and then every time I try to run a unit-test, VSTestHost is crashing preventing me from unit-testing in any project.
Here I show you the test that is supposedely making the program to crash. My LoadFromExe() method is just using ConfigurationManager.OpenExeConfiguration() method. It makes now some month I a using this AlphaProjectConfiguration whithout any issue.
[TestMethod()]
public void LoadGoodConfigurationFromExeTest()
{
using (StreamWriter sw = new StreamWriter(ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).FilePath))
{
sw.Write(Resources.GoodConfiguration);
}
AlphaProjectConfiguration actual = new AlphaProjectConfiguration();
actual.LoadFromExe();
Assert.IsNotNull(actual);
}
I just put all my efforts in solving this issue and I am really getting rid of it now. It is why I am asking some help from the community now. Thanks.
Edit: This test class contains 3 other tests that almost do the same thing. I tried this on Windows 7 x64 and Windows XP x86 with VSTS 2008 SP1. Crash happens on both systems.