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

Unable to inherit from interface with generic method #2281

Open
Warcaith opened this issue Nov 11, 2023 · 1 comment
Open

Unable to inherit from interface with generic method #2281

Warcaith opened this issue Nov 11, 2023 · 1 comment

Comments

@Warcaith
Copy link

Warcaith commented Nov 11, 2023

Environment

  • Pythonnet version: v3.0.3
  • Python version: 3.9
  • Operating System: Windows 10
  • .NET Runtime: .NET Framework

Details

  • Describe what you were trying to get done.

    There seems to be no way to create an implementation for an interface that has a method which is generic.

  • What commands did you run to trigger this issue? If you can provide a
    Minimal, Complete, and Verifiable example
    this will help us understand the issue.

namespace Namespace
{
    public interface IInterface
    {
        T GetSomething<T>() where T : class;
    }
}
class Implementation(IInterface):
    __namespace__ = "Namespace"

    def GetSomething(self):
        ...
class Implementation(IInterface):
    __namespace__ = "Namespace"

    def GetSomething(self, T):
        ...
  • If there was a crash, please include the traceback here.
TypeError: Method 'GetSomething' in type 'Namespace.Implementation' from assembly '...' does not have an implementation
@LeeDongGeon1996
Copy link

LeeDongGeon1996 commented Jan 26, 2024

same issue with me when trying to implement System.Collections.Generic.IEnumerable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants