-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error with events and IEnumerable<T> #27
Comments
Hi @Portikus, Thanks for reporting this issue! Should be a quick fix. |
The issue has been resolved in master. I will publish the fix with the next NuGet. |
Hi! When can we expect the updated nuget with this fix? This bug is a blocker for me. Thanks! |
Sorry for the delay. I will publish the NuGet this week. |
Just released 2.3.4 which fixes this issue. Please reopen if you have any problems. |
I am still seeing the same issue with the 2.3.4 release. Can someone please verify? Here is my test interface and the generated stub that fails to build: public interface ISomeInterface
{
event EventHandler<IEnumerable<string>> SomeEvent;
} This fails with "Argument 2: cannot convert from 'System.Collections.IEnumerable' to 'System.Collections.Generic.IEnumerable'": [CompilerGenerated]
public class StubISomeInterface : ISomeInterface
{
private readonly StubContainer<StubISomeInterface> _stubs = new StubContainer<StubISomeInterface>();
public event global::System.EventHandler<global::System.Collections.Generic.IEnumerable<string>> SomeEvent;
protected void On_SomeEvent(object sender, IEnumerable args)
{
global::System.EventHandler<global::System.Collections.Generic.IEnumerable<string>> handler = SomeEvent;
if (handler != null) { handler(sender, args); }
}
public void SomeEvent_Raise(object sender, IEnumerable args)
{
On_SomeEvent(sender, args);
}
} |
I just created a class library and installed 2.3.4 to it. I am getting: [CompilerGenerated]
public class StubISomeInterface : ISomeInterface
{
private readonly StubContainer<StubISomeInterface> _stubs = new StubContainer<StubISomeInterface>();
public MockBehavior MockBehavior { get; set; }
public event global::System.EventHandler<global::System.Collections.Generic.IEnumerable<string>> SomeEvent;
protected void On_SomeEvent(object sender, global::System.Collections.Generic.IEnumerable<string> args)
{
global::System.EventHandler<global::System.Collections.Generic.IEnumerable<string>> handler = SomeEvent;
if (handler != null) { handler(sender, args); }
}
public void SomeEvent_Raise(object sender, global::System.Collections.Generic.IEnumerable<string> args)
{
On_SomeEvent(sender, args);
}
public StubISomeInterface(MockBehavior mockBehavior = MockBehavior.Loose)
{
MockBehavior = mockBehavior;
}
} |
My bad. It does seem to work. I guess when it updated my nuget reference, there was a lingering nuget .targets file which looked to be referencing the previous version of SimpleStubs. Probably something to do with my recent upgrade to VS 2017, who knows... Thanks! |
Hi I have an Inteface with the following event:
When SimpleStubs is now generating the stubs it generates the following:
It generates methods for
IEnumerable
not forIEnumerable<string>
which wont compile.The text was updated successfully, but these errors were encountered: