← Winnitude! Search  ·  Reader Mode (975 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 8 LINKS

Exception thrown when initializing Python .NET after a domain unload · Issue #714 · pythonnet/pythonnet

Repository navigation

Exception thrown when initializing Python .NET after a domain unload  #714


New issue

New issue

Closed

Closed
Exception thrown when initializing Python .NET after a domain unload #714

Description

@lassond's profile lassond opened on Aug 9, 2018

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 win32

  • Operating System:
    Windows 10

  • In 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

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)

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