Ayende @ Rahien

My name is Oren Eini
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:


+972 52-548-6969

, @ Q c

Posts: 6,026 | Comments: 44,842

filter by tags archive

Rhino Mocks 3.6

time to read 2 min | 277 words

This release is mostly to put out all the patches & fixes that went into Rhino Mocks since the 3.5 release, almost a year ago.

The changes from the previous version are:

  • Dynamic mocks and stubs will now assume that a call is match by any number of expectation.
  • Recursive mocks (with help from webpaul)
  • Fixing an issue with ArgManager in multi threaded scenarios (patch from Stefan Steinegger)
  • Fixing problem with IgnoreArguments() after Do() erasing the Do()
  • Fixing an issue with SetPropertyWithArgument improperly using LastCall.
  • Allowing Rhino Mocks to raise events on VB6 dlls.
  • Adding support for AssertWasCalled for getters (patch from robin clowers)
  • Adding remoting mocks as static methods (patch from Peter Mounce)
  • Adding a way to access the method from MethodInvocation
  • Fixing an issue with recursive return types when making a call to record an event more than once.
  • Various spelling & grammar issues (patch from Peter van der Woude)
  • Fixing an issue with stubbing MarshalByReferenceObjects
  • Better integration with Pex
  • Making LambdaConstraint work better with polymorphic args
  • Better feature parity for AAA with Record & Playback: Partials, Multis, and Stricts
  • Fixing an issue with stubbing properties of generic interfaces implemented twice using different generic parameters (Alexander Groß)

As usual, the download is here.



as a Moq user how would you "sell" Rhino Mocks to me (no offense, just currious)?

I somehow skipped RhinoMocks (wasn't tdd guy before) but it already went away with the record-replay, and the 2 frameworks seems identical...so can you be a good salesman and persuade me to use it?

Rhino is your baby so I would like to have some comparison between the two. (I know google will spit something out but...)

or you can be a diplomat and say "try it, you'll love it" :D

Ayende Rahien


I wouldn't, use whatever fits your needs


I'm a little confused probably:

"Dynamic mocks and stubs will now assume that a call is match by any number of expectation."

Does this mean that from now on: myMock.Stub(...) == myMock.Stub(...).Repeat.Any()

and: myMock.Expect(...) == myMock.Expect(...).Repeat.Any() ?

Shane Courtrille

I'd sell you on Rhino Mocks by saying it doesn't do a MyMock.Object to get at the actual object. From what I've heard that's the main complaint.

I'd sell you on Moq by saying the API usage is MUCH cleaner. There aren't N ways to do one thing.

I'm still hoping that at some point we see a Rhino Mocks release that removes backwards compatibility for everything not AAA.


Shane, +1 to hoping for a release one day that removes the record/replay syntax.

It doesnt bother me, but I think its definitely an issue for getting new users on board

Noam Gal

I tried dropping in 3.6 over my 3.5 in a .NET 2.0 project. Apparently I now need system.core.dll 3.5 for the RhinoMocksExtensions calls.

Is it a conscious decision to stop supporting 2.0, or am I missing something?

Ayende Rahien


3.6 doesn't support 2.0 anymore

Noam Gal

Something worth mentioning...

In any case, I did manage to get it to run on my 2.0 project. Only had to add the above reference (I do have 3.5 installed). So far it worked, though I am not doing a whole lot of stuff with it yet, so maybe it'll fail on more complex scenarios.

The recursive mocks are very nice indeed.


Sounds like a test-breaking change. I'd say that would be ok for Stub but is too much change for Expect, but I'd also say to keep the behavior of both as similar as possible...

Any specific reasons for this?

Ayende Rahien

It was the expected behavior from the users point of view.

Kurt Harriger


I had a few dozen tests fail after upgrading to v 3.6 from code like this:

var mocks = new MockRepository();

var something = mocks.Stub <isomthing();

something.Stub(x=>x.DoSomething() ).Return(true);


The root cause of the problem appears that mock.Stub/Mock/etc no longer returns the mock in replay mode. To fix replaced mock.Stub with MockRepository.GenerateStub.

Ayende Rahien


That is actually expected, that should have never worked, you are mixing the two styles of working together

Jiho Han

w.r.t. .net 2.0 support, I tried to download v3.5 for 2.0 but they still required System.Core.dll

Like, Noam above, do I need to add reference to System.Core.dll in my 2.0 project?



Just to let you know that I'm having problems with rhino mocks 3.6 and nunit 2.5.*

I'm running nunit console using a project file containing 20 assemblies. All tests pass but it fails with the following:

Unhandled Exception:

System.AppDomainUnloadedException: Attempted to access an unloaded AppDomain.

at System.AppDomain.get_FriendlyName()

at NUnit.Util.DomainManager.DomainUnloader.Unload()

at NUnit.Util.DomainManager.Unload(AppDomain domain)

at NUnit.Util.TestDomain.Unload()

at NUnit.ConsoleRunner.ConsoleUi.Execute(ConsoleOptions options)

at NUnit.ConsoleRunner.Runner.Main(String[] args)

I can get it to succeed if I take out some of the assemblies under test but never consistently the same assembly so it doesn't look like my code. All assemblies are targeting 3.5. If I revert back to nunit 2.4.7 everything works fine.

It might be something to do with nunit but I thought I'd let you know.

Ayende Rahien

It is an NUnit thingie.

We had the same problem with Castle

Comment preview

Comments have been closed on this topic.


No future posts left, oh my!


  1. Technical observations from my wife (3):
    13 Nov 2015 - Production issues
  2. Production postmortem (13):
    13 Nov 2015 - The case of the “it is slow on that machine (only)”
  3. Speaking (5):
    09 Nov 2015 - Community talk in Kiev, Ukraine–What does it take to be a good developer
  4. Find the bug (5):
    11 Sep 2015 - The concurrent memory buster
  5. Buffer allocation strategies (3):
    09 Sep 2015 - Bad usage patterns
View all series


Main feed Feed Stats
Comments feed   Comments Feed Stats