Error with void expression in 3.1 RC [573]


in the following example Resharper does not detect the illegal void
expression as a parameter to a method call:

using System;
using NUnit.Framework;
using Rhino.Mocks;

namespace RhinoMocks2

public class ResharperError
private MockRepository mocks;
private ISomething something;

public void Setup() {
mocks = new MockRepository();
something = mocks.DynamicMock]]>();

public void TestSomething() {
// Error in following line is not detected by Resharper
// Compiler throws:
// 1) The best overloaded method match for
// 'Rhino.Mocks.Expect.Call(Rhino.Mocks.Expect.Action)'
// has some invalid arguments
// 2) Argument '1': cannot convert from 'void' to
// 'Rhino.Mocks.Expect.Action'
Expect.Call(something.Changed += null).IgnoreArguments();

// This is the correct code
Expect.Call(delegate {
something.Changed += null;

public interface ISomething
event EventHandler Changed;

Stefan Lieser

1 comment
Comment actions Permalink


We appreciate your feedback.

The corresponding JIRA request has been created, and you are welcome to monitor
its status at

Best regards,
- Development Team.


Please sign in to leave a comment.