stride3d / stride3d/stride

Assembly reload crashes when two different components on the same entity have identically named properties of different types

Open
#2,919 4 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: Official Release

Version: 4.2.1.2442

Platform(s): Microsoft Windows 11 Pro 10.0.26100 x64

Describe the bug
Assigning an audio asset to a property on a custom EntityComponent causes Game Studio to crash during assembly reload. The crash happens while serializing the live object graph: UrlReference (and also Sound) is handled as if it were IIdentifiable, leading to an InvalidCastException. Game Studio closes as a result.

To Reproduce

  • Create custom EntityComponent with UrlReference component.
  • Attach the component to an entity in a scene/prefab.
  • In Game Studio, assign any .xksnd audio asset to the property.
  • Make a trivial code change and build (which triggers assembly reload).
  • Game Studio crashes.

Expected behavior
It should be possible to use audio assets as properties on EntityComponents. Assigning a sound (via UrlReference or Sound) should survive assembly reload without crashing, and the assigned value should remain serialized/restored.

Log and callstacks

InvalidCastException: Unable to cast object of type
'Stride.Core.Serialization.UrlReference`1[Stride.Audio.Sound]'
to type 'Stride.Core.IIdentifiable'.
   at Stride.Core.Assets.Serializers.IdentifiableObjectSerializer...
   at Stride.Assets.Presentation.AssemblyReloading.GameStudioAssemblyReloader...

Additional context
It does not matter whether the property type is Stride.Audio.Sound or UrlReference — both configurations crash Game Studio on assembly reload after assigning a value in the editor.

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

Start with the InvalidCastException path through Stride.Core.Assets.Serializers.IdentifiableObjectSerializer and Stride.Assets.Presentation.AssemblyReloading.GameStudioAssemblyReloader. Reproduce with UrlReference or Sound on an EntityComponent, assign an audio asset, and trigger assembly reload; done when the editor no longer crashes and the assigned value remains serialized and restored.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
game-dev, 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.