Test passes in ReSharper test runner, fails in NUnit and TeamCity

First of all, is it possible to search the forums?

I have an NUnit unit test that passes in the ReSharper runner but fails in the NUnit GUI runner and on TeamCity. The test throws an exception:

Test(s) failed. System.InvalidOperationException :  Collection was modified; enumeration operation may not execute.
at  System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource  resource)
at  System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator.MoveNext()
at  NHibernate.Impl.Printer.ToString(IEnumerator enumerator, EntityMode  entityMode)
at  NHibernate.Event.Default.AbstractFlushingEventListener.FlushEverythingToExecutions(FlushEvent  event)
at  NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent  event)
at NHibernate.Impl.SessionImpl.Flush()
at  VEIC.Hero.Tests.WapTests.project_cascade_delete() in  c:\TeamCity\buildAgent\work\f92cc1e38d5b4f68\src\Hero.Tests\WapTests.cs:line  254


What could be causing this?


Thanks, Jamie
5 comments

In my case I'm running into this NHibernate bug: http://nhjira.koah.net/browse/NH-1597

From what I've read, the bug does not occur if log4net is disabled for NHibernate. Is it possible that the ReSharper test runner is disabling log4net and allowing this test to pass? I've looked at the calls in SQL Profiler and the NUnit runner hits the exception at a delete call and no delete commands are issued to the database. The delete commands are issued when running in the ReSharper runner. That's reassuring because it means that the test really is passing in ReSharper and not some other weirdness.

0

Hello,

ReSharper doesn't use log4net and doesn't disable it. Is it possible ReSharper
calls Dispose on something like TestFixture, SetupFixture or anything else,
whereas other runners don't? May be AppDomain configuration is different?
Or may be ReSharper's handling of trace/debug messages doesn't crash in some
edge cases, unlike other runners? What is the exception? We may need more
context to understand an issue.

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


IR> In my case I'm running into this NHibernate bug:
IR> http://nhjira.koah.net/browse/NH-1597
IR>
IR> From what I've read, the bug does not occur if log4net is disabled
IR> for NHibernate. Is it possible that the ReSharper test runner is
IR> disabling log4net and allowing this test to pass? I've looked at the
IR> calls in SQL Profiler and the NUnit runner hits the exception at a
IR> delete call and no delete comman
IR>
IR> ds are issued to the database. The delete commands are issued when
IR> running in the ReSharper runner. That's reassuring because it means
IR> that the test really is passing in ReSharper and not some other
IR> weirdness.
IR>
IR> ---
IR> Original message URL:
IR> http://www.jetbrains.net/devnet/message/5233481#5233481


0

Hello,

Ah, sorry, missed exception in original message. How do you have your app.config
set up?

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


IR> In my case I'm running into this NHibernate bug:
IR> http://nhjira.koah.net/browse/NH-1597
IR>
IR> From what I've read, the bug does not occur if log4net is disabled
IR> for NHibernate. Is it possible that the ReSharper test runner is
IR> disabling log4net and allowing this test to pass? I've looked at the
IR> calls in SQL Profiler and the NUnit runner hits the exception at a
IR> delete call and no delete comman
IR>
IR> ds are issued to the database. The delete commands are issued when
IR> running in the ReSharper runner. That's reassuring because it means
IR> that the test really is passing in ReSharper and not some other
IR> weirdness.
IR>
IR> ---
IR> Original message URL:
IR> http://www.jetbrains.net/devnet/message/5233481#5233481


0

This is a test project, so the only thing that's in App.config is a connection string.

0

I know it's several days later ... but I recently had this same problem.  In my case anyway, the problem was with the test - some test were only passing based on the ordering that NUnit does.  Resharper orders the tests based on the order they show up in the file, but NUnit will order the tests alphabetically.  That may be one thing you'll want to take a look at.

0

Please sign in to leave a comment.