I've been using RhinoMocks lately but I keep running into an issue. If I break into the debugger and step over code while a mock is in Record mode, I end up getting an exception along the lines of:
System.InvalidOperationException: Previous method 'SuchAndSuch.ToString();'
requires a return value or an exception to throw.
But if I execute the same code without breaking into the debugger it will execute successfully and create the mock.
I'm pretty sure that the reason for this is that the debugger calls ToString() on objects to display them in the Locals and other Watch windows. But since the mock is in record mode RhinoMocks considers a call to ToString() to be a setup of expectations which then isn't completely correctly. Obviously this only happens with partial mocks on concrete classes. Mocks against interfaces do not exhibit this behavior.
Have other people run into this issue? Is there any simple remedy? Do other frameworks such as moq or TypeMock have this issue?
Thanks,
~ Justin