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
Interface method does not have an implementation exception #1257
Comments
@skarum, thanks for raising this. A couple of quick questions.
|
I've reproduced using the .NET Framework flavours of FakeItEasy, both under 4.1 and 4.1.1: public class UserQuery
{
public interface Test
{
void Test1<T>(IEnumerable<T> enumerable);
void Test1<T>(IList<T> enumerable);
}
[NUnit.Framework.Test]
public void MakeAFake()
{
var fake = A.Fake<Test>();
}
} |
It's probably in a LINQPad query. I suspected it might be related to the fact the public interface IFoo
{
int Bar<T>(I1<T> x);
int Bar<T>(I2<T> x);
}
public interface I1<T> { }
public interface I2<T> { } The problem occurs only if both interfaces are generic. My guess is that it's a bug in Castle.Core, since FakeItEasy doesn't really go into the details of creating the proxy type. @jonorossi have you ever seen this? |
My guess is that it's related to castleproject/Core#310. I haven't examined the details of the changes, but it has all the right buzzwords. |
LinqPad is running 4.6 framework. It makes sense if you IL merge that is a Castle bug |
Indeed. I can reproduce the bug with Castle.Core 4.2.0, but not with 4.2.1. So upgrading to 4.2.1 should fix the problem in FakeItEasy as well. |
I can work on the fix, unless someone on the thread prefers to. |
I can do that :) I'll look at it tonight (Europe time) and make a PR. If it''s faster for you to make it yourself, then just go ahead. |
Oh, it's nearly always faster for us to do it, but we very much enjoy community contributions (and assume that the community members enjoy making them - if I'm wrong here, please correct me). If nothing else, I'm in mid-East Canada time, so you can always report back tonight with your progress and/or feelings, and I'll be awake. ;-) I will warn you, though, that I'd enjoy a new spec for the use case. I would add a new The only tricky part about the test would be that since Again, thanks for raising the issue and for agreeing to help us fix it! |
@blairconrad, this issue makes me wonder if we should really ILMerge Castle.Core... We probably discussed it before, but there's a compelling argument against it: in such a case when there's a bug in Castle.Core, the end-user can't just work around the issue by upgrading to the next version of Castle.Core where the issue is fixed. They have to wait for us to release a version that uses the newer Castle.Core. |
@thomaslevesque, I see your point. I think the original reason for merging was to work around situations where users' production code required a different version of Castle.Core than we liked. What's the lesser of the two evils? |
I'm not sure... if they want a more recent version, fine, but if they need an older one, they're in trouble. Maybe we should offer a separate package where Castle.Core is not ILMerged. In fact, if we do that, it would be more consistent to stop using ILMerge in the main package, and do it only in the new one (which would only target net40/net45, since ILMerge doesn't work with .NET Standard). Anyway, it's just a random idea, and a bit off-topic... |
Updated Castle.Core from 4.2.0 to 4.2.1 to fix issue described in #1257.
This change has been released as part of FakeItEasy 4.2.0. Thanks for your help with this, @skarum. Look for your name in the release notes! 🏆 |
When I upgraded a project today from 3.X to latests version
4.1.1
i got a odd error.I have an interface like below and got the following error when calling
A.Fake<Test>();
*ERROR
This works fine prior to
4.1.0
(both3.X
and4.0.0
).I suspect it's the upgrade of
Castle.Core 4.1
to4.2
, but I'm unsure, because if I add a reference toCastle.Core 4.2.1
in my project it still work withFakeItEasy 4.0.0
and earlier.The text was updated successfully, but these errors were encountered: