Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Cannot implement an interface that extends another interface #1783

Copy link
Copy link
@phxnsharp

Description

@phxnsharp
Issue body actions

Environment

  • Pythonnet version: 3.0.0a2
  • Python version: 3.8.10
  • Operating System: Ubuntu 20.04.4 LTS (docker run --rm -it ubuntu:20.04)
  • .NET Runtime: .NET Core 6.0.202

Details

  • Describe what you were trying to get done.

    Attempting to implement interfaces defined in .NET. Works fine for simple interfaces but I receive a weird error when the interface extends IDisposable

  • 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.

from clr_loader import get_coreclr
rt = get_coreclr("conf.json")
from pythonnet import set_runtime
set_runtime(rt)
import clr

import System
import System.Buffers


class MyDisposable(System.IDisposable):
    __namespace__ = "MyNamespace"

    def Dispose(self) -> None:
        print("Dispose")

md = MyDisposable()
md.Dispose()


class MyBuffer(System.Buffers.IMemoryOwner):
    __namespace__ = "MyNamespace"


    def Dispose(self) -> None:
        print("Dispose")


mb = MyBuffer()
mb.Dispose()    

conf.json:

{
  "runtimeOptions": {
    "tfm": "net6.0",
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "6.0.4"
    }
  }
}
  • If there was a crash, please include the traceback here.
(venv) root@ca20f043eef5:/t# python demo.py
Dispose
Traceback (most recent call last):
  File "demo.py", line 21, in <module>
    class MyBuffer(System.Buffers.IMemoryOwner):
TypeError: Method 'Dispose' in type 'MyNamespace.MyBuffer' from assembly 'Python.Runtime.Dynamic, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
iBavtovich

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.