- Notifications
You must be signed in to change notification settings - Fork750
Closed
Labels
Description
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.