public void SimpleAtomicityTest3b() { racyvariable = 0; Thread t = new Thread((Object irrelevant) => { ChessAPI.RunWithoutPreemptions(() => { racyvariable++; }); }); t.Start(); try { ChessAPI.RunWithoutPreemptions(() => ((Object)(null)).GetHashCode()); } catch (NullReferenceException) { } racyvariable++; t.Join(); Assert.AreEqual(2, racyvariable); }