Skip to content

Unhandled exception. System.InvalidOperationException: GIL must always be released #2544

@tarunsk1998

Description

@tarunsk1998

I have an dotnet application that uses pythonnet to invoke a python script.

I am facing the below issue while I am testing the application.

Error:
Unhandled exception. System.InvalidOperationException: GIL must always be released, and it must be released from the same thread that acquired it.
at Python.Runtime.Py.GILState.Finalize()

There is another error printing in the logs:
error message: The type initializer for 'Delegates' threw an exception.

I am facing this issue for both python 3.11 and 3.12 versions.

Has anyone faced this issue or help me debug this issue?

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