stride3d / stride3d/stride

Using undo on an assembly reload causes various problems

Open
#2,107 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
7.8k
Forks
1.2k
Avg merge
2d 17h
Merged PRs (30d)
49

Description

Release Type: GitHub or normal release

Version: 4.2.0.2067 and a recent github version

Platform(s): Editor

Describe the bug
You can undo an assembly reload with ctrl+z, and it always causes problems.

I have had:

  • Serialization errors requiring restart
  • Actual crash of editor
  • Adding duplicate copies of scripts that have been changed, other scripts on the same entities, possibly more.

But I did an isolated repro and only saw the first 2

To Reproduce
Steps to reproduce the behavior:

NOTE: It is not necessary for the change to be an error. Making a valid change, and then using undo, will also cause duplicates of scripts.

  1. Create a new project using the "TopDownRPG" sample.
  2. Open MainScene in the editor
  3. Select the first LootBox prefab with the CrateScript component attached. Move this to a different position using the editor.
  4. Open the code project, and open CrateScript.cs
  5. Introduce a bug in this class preventing it from compiling.
  6. Go back to the editor, and reload scripts. It will fail to compile due to the error.
  7. Go back and remove the typo, making the class the same as it was when the project was first made.
  8. In the editor, reload script assemblies. This time, it will successfully compile.
  9. Press ctrl+z repeatedly and watch things break.

Effects of this:

  • A second copy of CrateScript is present on the object (the instructions are exact, so the object has been selected the entire time, and you can see this immediately)
  • The Trigger script also has a second copy.
  • A System.INvalidOperationException: Cannot convert value to the required type prevents the scene from rendering
  • The move is not successfully undone, the object is still in the modified position after undo is pressed many times.

Pressing "Resume" does successfully rescue the editor.

As the reload is undone, you are able to press the "Reload script assemblies" button again. You can press it and get a third copy of the CrateScript and Trigger script on the still

Expected behavior
Personally I don't expect this to be something you can undo, and I never am doing this on purpose!

Additional context
I will submit a PR removing the ability to undo this unless anyone has other ideas to fix 😆

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files or tests are named. Reproduce the failure in the Stride Editor using the listed TopDownRPG steps, then trace the editor's undo handling around assembly reloads and script recompilation. Done means undo no longer creates duplicate scripts, serialization errors, crashes, or leaves the scene in an incorrect state.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.