- Notifications
You must be signed in to change notification settings - Fork750
Description
Environment
Pythonnet version: latest master commit as of 2018-08-09 (fb84cd2 )
Python version:
Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)] on win32Operating System:
Windows 10In the context of running in Unity, but also reproducible in a simple standalone app made from scratch
Details
Unity, whenever a C# script is changed, the AppDomain in which the Assemblies are loaded gets unloaded. Then, Unity creates a fresh AppDomain, recompiles the C# assemblies and loads them again.
The Python.Runtime assembly gets unloaded, but the Python interpreter survives (it is a native library). This results in an inconsistent state between the Python .NET Engine/Runtime classes (which are not initialized) and the Python interpreter (which is initialized).
An exception is raised when Python .NET accesses the interpreter (System.AppDomainUnloadedException: Attempted to access an unloaded AppDomain.)
- Describe what you were trying to get done.
See above
- 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.
I will attach my standalone application which reproduces this crash along with the repro steps. (either ere or on the pull request if I cannot attach here)