Skip to content

COR_E_INVALIDOPERATION when running release branch #34

@rogerlord

Description

@rogerlord

Environment

  • Pythonnet version: release branch
  • Python version: 3.7.14
  • Operating System: Debian Bullseye (running under Windows Subsystem for Linux 2, Ubuntu 20.04, on Windows 10 21H2)
  • .NET Runtime: .NET Core 3.1.29

Details

I am trying to load the CoreCLR with the following statements:

from pythonnet import load  
load("coreclr", runtime_config="pythonnet.json")     

where pythonnet.json contains the following:

{
  "runtimeOptions": {
   "tfm": "netcoreapp3.1",
   "framework": {
    "name": "Microsoft.NETCore.App",
    "version": "3.1.29"
    }
   }
}

The error message I get is as follows (note - the same happens if I try using .NET 6.0 instead of .NET Core 3.1):

Python 3.7.14 (default, Sep 13 2022, 02:30:55)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pythonnet import load
>>> load("coreclr", runtime_config="pythonnet.json")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/root/pythonnet/pythonnet/__init__.py", line 137, in load
    func = assembly.get_function("Python.Runtime.Loader.Initialize")
  File "/usr/local/lib/python3.7/site-packages/clr_loader/types.py", line 94, in get_function
    return ClrFunction(self._runtime, self._path, name, func)
  File "/usr/local/lib/python3.7/site-packages/clr_loader/types.py", line 58, in __init__
    self._callable = runtime._get_callable(assembly, typename, func_name)
  File "/usr/local/lib/python3.7/site-packages/clr_loader/hostfxr.py", line 101, in _get_callable
    check_result(res)
  File "/usr/local/lib/python3.7/site-packages/clr_loader/util/__init__.py", line 42, in check_result
    raise error
clr_loader.util.clr_error.ClrError: 0x80131509: COR_E_INVALIDOPERATION => An operation is not legal in the current state.

Attached the docker file I am using to build PythonNet and subsequently run the above statements in it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions