Below is a simple test fixture. It succeeds in Debug builds and fails in Release builds (VS2010, .NET4 solution, x64):
[TestFixture]
public sealed class Test
{
This bug already came up in this SO question by Jacob Stanley. Jacob has already reported the bug, and Microsoft has confirmed that it is indeed a bug in the CLR JIT. Microsoft had this to say:
This bug will be fixed in a future version of the runtime. I'm afraid it's too early to tell if that will be in a service pack or the next major release.
Thank you again for reporting the issue.
You should be able to work around the bug by adding the following attribute to TestChecker()
:
[MethodImpl(MethodImplOptions.NoInlining)]