Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Soft reload throws in deserialization in a common workflow #1250

Closed
@benoithudson

Description

@benoithudson

Environment

  • Pythonnet version: current master (with soft reload).

This is in context of Unity Editor.

Details

  1. Use the soft-reload branch of pythonnet within Unity.
  2. Create an asmdef called MyAssembly in Unity.
  3. In the same folder, create a file Foo.cs
namespace Foo{  public class Bar  {    public static void Quux() { UnityEngine.Debug.Log("quux"); }  }}
  1. In the Unity Python console:
import clrclr.AddReference("MyAssembly")import FooFoo.Bar.Quux()
  1. This will printquux in the Unity console.
  2. In Unity, modify Foo.cs e.g. add a space in it.
  3. Allow Unity to reload the domain.
  4. This works!
  5. In Unity, modify Foo.cs and rename Quux to Quux2.

Expected: Python for .NET is available after reload. Running Python code again will raise AttributeError.

Actual: Python for .NET throwsSerializationException: Cannot get the member 'Quux'. I can't even run the Python code again; it fails onimport clr. I must restart Unity.

Similarly if I rename the class, the namespace, or the assembly.

The problem appears to be in ManagedType subclasses. These are[Serializable] but they point to things likeType whose deserialization may fail, destroying everything.

I'm working on a proof of concept so that we control the deserialization and we can replace the failed deserialize with a dummy or anull, which only fails if this eventually gets used. I'll post results tomorrow hopefully on a first attempt.

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


      [8]ページ先頭

      ©2009-2025 Movatter.jp