I have some code with unit tests that pass in a Debug build but fail in a Release build. On top of that, the tests only fail when using NUnits GUI but pass with TeamCitys NUnit runner even though they are both the same version.
Because of this we can't trust TeamCity until we've got it sorted.
I know this is not a .Net forum but here is the offending test code, just to give you in idea of why it's failing for a Release build - it's basically because of reduced stack information due to code optimization.
public class TestLogger
public void GetCurrentClassLoggerReturnsLoggerWithOwningTypeName()
var logger = Logger.GetCurrentClassLogger();
Assert.AreQueal(logger.Name, GetType().Name); }
public class Logger
public static ILogger GetCurrentClassLogger()
var declaringType = new StackFrame(1, false).GetMethod().DeclaringType;
return new Logger(declaringType.Name, declaringType.FullName);
Any ideas ?