Skip to content
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 same name of methods problem #372

Closed
MaLiN2223 opened this issue Mar 9, 2018 · 3 comments
Closed

Interface same name of methods problem #372

MaLiN2223 opened this issue Mar 9, 2018 · 3 comments
Labels
bug Reported problem with NSubstitute behaviour

Comments

@MaLiN2223
Copy link

I believe I encountered a bug. I'm working on .NET Core 2.0.

Those are my interfaces:

  public interface A<T>
  {
  }
  public interface B<T>
  {
  }
  public interface X
  {
    Task<K> Foo<K>(B<K> bar);
    Task<K> Foo<K>(A<K> bar);
  }

When I'm trying to substitute X this is an exception that occurs:
System.TypeLoadException : Method 'Foo' in type 'Castle.Proxies.XProxy' from assembly 'DynamicProxyGenAssembly2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.

I think it has something to do with the fact that those methods have the same name because when I change second method's name to Foo2 everything works.
Is there anything I can do to make this example work without changing an interface?

@MaLiN2223 MaLiN2223 changed the title Argument interface inheritance Interface same name of methods problem Mar 9, 2018
alexandrnikitin added a commit to alexandrnikitin/NSubstitute that referenced this issue Mar 9, 2018
@alexandrnikitin alexandrnikitin added the bug Reported problem with NSubstitute behaviour label Mar 9, 2018
@alexandrnikitin
Copy link
Member

Good catch! It's related to Castle.Core issue castleproject/Core#309
I'll update the version constraint.
Thank you!

@zvirja
Copy link
Contributor

zvirja commented Mar 9, 2018

@alexandrnikitin If I got it clear, issue has been already fixed in v4.2.1. Therefore, as a temporary fix, @MaLiN2223 could update the Castle.Core dependency to the most recent one.

Should NSubstitute also change the minimum Castle.Core version in v4?

@alexandrnikitin
Copy link
Member

alexandrnikitin commented Mar 9, 2018

Yes, correct. Updating Castle.Core to 4.2.1 should fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Reported problem with NSubstitute behaviour
Projects
None yet
Development

No branches or pull requests

3 participants