Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Cannot implement an interface that extends another interface #1783

Closed
Assignees
filmor
Labels
@phxnsharp

Description

@phxnsharp

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.

fromclr_loaderimportget_coreclrrt=get_coreclr("conf.json")frompythonnetimportset_runtimeset_runtime(rt)importclrimportSystemimportSystem.BuffersclassMyDisposable(System.IDisposable):__namespace__="MyNamespace"defDispose(self)->None:print("Dispose")md=MyDisposable()md.Dispose()classMyBuffer(System.Buffers.IMemoryOwner):__namespace__="MyNamespace"defDispose(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.pyDisposeTraceback (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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp