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?