NMock2 RemotingException ByRef value type parameter cannot be null

Posted by Marcus Hammarberg on January 22, 2009
OK this might be the most misleading error message I've seen. I cannot decide on how to describe it... What this means... or what this try to ...
Actually this happens when one of your mocked objects is mocking a method that returns something and your mocking doesn't return anything. Eeeeh - that was quite tricky. Got it?
Here is an example:
When I mock this method:
Public Class FacadeObject 
     Function CreateSomeThing(ByVal aName As String) As Long
               End Function

        End Class
by using the following code to do the mock 
an exception of RemotingException (ByRef value type parameter cannot be null) will be thrown.
Here is another description that you might find easier to understand

Published by Marcus Hammarberg on Last updated