Windsor: Test fail when run using Visual Studio 15.7.5 and Resharper 2018.1.3 but not from build.cmd for net45

When running test inside Visual Studio using Resharper I noticed that 13 tests are failing. However when I run the test from build.cmd everything passes. I just updated my Visual Studio and Resharper today and noticed this to be the case.

image

image

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 19 (9 by maintainers)

Most upvoted comments

Got all tests passing in ReSharper! https://github.com/castleproject/Windsor/pull/440

Reproing on VS 15.8.7 and ReSharper 2018.2.3 which are current as of today.

In every case, the problem is that the WeakReference the test creates is alive when the test expects it not to be.

In particular, this trivial test (which follows the same pattern that the real tests depend on) fails when run via ReSharper:

		[Test]
		public void SimpleRepro()
		{
			var weak = new WeakReference(new object());
			GC.Collect();
			Assert.IsFalse(weak.IsAlive);
		}

Therefore, all the real tests have some hidden assumptions about the timeframe in which GC will certainly happen. There should probably be a test helper which actually ensures GC.

The answer is upgrade, and upgrade often. Works for …

image

image