Error with void expression in 3.1 RC [573]
Hi,
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;
}).IgnoreArguments();
}
}
public interface ISomething
{
event EventHandler Changed;
}
}
Regards,
Stefan Lieser
--
http://www.lieser-online.de
Please sign in to leave a comment.
Hello,
We appreciate your feedback.
The corresponding JIRA request has been created, and you are welcome to monitor
its status at http://www.jetbrains.net/jira/browse/RSRP-54397.
Best regards,
- Development Team.