Skip to content

[Merged by Bors] - Add entity ID to expect() message#2943

Closed
djeedai wants to merge 4 commits intobevyengine:mainfrom
djeedai:ecs_ent_id
Closed

[Merged by Bors] - Add entity ID to expect() message#2943
djeedai wants to merge 4 commits intobevyengine:mainfrom
djeedai:ecs_ent_id

Conversation

@djeedai
Copy link
Contributor

@djeedai djeedai commented Oct 9, 2021

Add the entity ID and generation to the expect() message of two
world accessors, to make it easier to debug use-after-free issues.
Coupled with e.g. bevy-inspector-egui which also displays the entity ID,
this makes it much easier to identify what entity is being misused.

Objective

Make it easier to identity an entity being accessed after being deleted.

Solution

Augment the error message of some expect() call with the entity ID and
generation. Combined with some external tool like bevy-inspector-egui, which
also displays the entity ID, this increases the chances to be able to identify
the entity, and therefore find the error that led to a use-after-despawn.

Add the entity ID and generation to the expect() message of two
world accessors, to make it easier to debug use-after-free issues.
Coupled with e.g. bevy-inspector-egui which also displays the entity ID,
this makes it much easier to identify what entity is being misused.
@github-actions github-actions bot added the S-Needs-Triage This issue needs to be labelled label Oct 9, 2021
Copy link
Member

@DJMcNab DJMcNab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

Good idea, but please remove the unneeded allocations

@DJMcNab DJMcNab added A-ECS Entities, components, systems, and events C-Feature A new feature, making something new possible C-Usability A targeted quality-of-life change that makes Bevy easier to use and removed S-Needs-Triage This issue needs to be labelled labels Oct 9, 2021
@alice-i-cecile alice-i-cecile added S-Needs-Review A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use and removed C-Feature A new feature, making something new possible A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use labels Oct 9, 2021
@alice-i-cecile
Copy link
Member

LGTM once the allocation issue is fixed :)

@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Oct 9, 2021
Copy link
Member

@DJMcNab DJMcNab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mockersf
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request Oct 10, 2021
Add the entity ID and generation to the expect() message of two
world accessors, to make it easier to debug use-after-free issues.
Coupled with e.g. bevy-inspector-egui which also displays the entity ID,
this makes it much easier to identify what entity is being misused.

# Objective

Make it easier to identity an entity being accessed after being deleted.

## Solution

Augment the error message of some `expect()` call with the entity ID and
generation. Combined with some external tool like `bevy-inspector-egui`, which
also displays the entity ID, this increases the chances to be able to identify
the entity, and therefore find the error that led to a use-after-despawn.
@bors bors bot changed the title Add entity ID to expect() message [Merged by Bors] - Add entity ID to expect() message Oct 10, 2021
@bors bors bot closed this Oct 10, 2021
@djeedai djeedai deleted the ecs_ent_id branch October 18, 2021 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants