InputSystem icon indicating copy to clipboard operation
InputSystem copied to clipboard

FIX: out of range exception when pressing undo after creating and editing a new control scheme (ISXB-1607)

Open Darren-Kelly-Unity opened this issue 3 months ago • 3 comments

Description

You could cause multiple null or out of range exceptions if you press undo while editing a control scheme. This is caused by undo causing the control scheme to be removed while you still have the edit window open.

Now the edit window will close immediately if you press undo while it's open.

Ticket: https://jira.unity3d.com/browse/ISXB-1607

Video of fix (Usually undoing when editing the new control scheme would throw an exception / it could also cause other exceptions if the window was left open, therefore I now close it when this happens to avoid future issues):

https://github.com/user-attachments/assets/8c7f78ed-dfd8-4c2d-b24a-6f01363ce6a0

Testing status & QA

Tested manually all the cases I could find until all exceptions were gone. There was multiple paths to create exceptions due to the asset being removed via undo.

Overall Product Risks

Please rate the potential complexity and halo effect from low to high for the reviewers. Note down potential risks to specific Editor branches if any.

  • Complexity: 2
  • Halo Effect: 1

Comments to reviewers

Please describe any additional information such as what to focus on, or historical info for the reviewers.

Checklist

Before review:

  • [x] Changelog entry added.
    • Explains the change in Changed, Fixed, Added sections.
    • For API change contains an example snippet and/or migration example.
    • JIRA ticket linked, example (case %<ID>%). If it is a private issue, just add the case ID without a link.
    • Jira port for the next release set as "Resolved".
  • [ ] Tests added/changed, if applicable.
    • Functional tests Area_CanDoX, Area_CanDoX_EvenIfYIsTheCase, Area_WhenIDoX_AndYHappens_ThisIsTheResult.
    • Performance tests.
    • Integration tests.
  • [ ] Docs for new/changed API's.
    • Xmldoc cross references are set correctly.
    • Added explanation how the API works.
    • Usage code examples added.
    • The manual is updated, if needed.

During merge:

  • [ ] Commit message for squash-merge is prefixed with one of the list:
    • NEW: ___.
    • FIX: ___.
    • DOCS: ___.
    • CHANGE: ___.
    • RELEASE: 1.1.0-preview.3.

After merge:

  • [ ] Create forward/backward port if needed. If you are blocked from creating a forward port now please add a task to ISX-1444.

Darren-Kelly-Unity avatar Sep 16 '25 11:09 Darren-Kelly-Unity

Codecov Report

Attention: Patch coverage is 19.35484% with 25 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...or/UITKAssetEditor/Views/InputActionsEditorView.cs 33.33% 10 Missing :warning:
...ests/InputSystem.Editor/InputActionsEditorTests.cs 10.00% 9 Missing :warning:
.../UITKAssetEditor/Commands/ControlSchemeCommands.cs 0.00% 6 Missing :warning:
@@             Coverage Diff             @@
##           develop    #2237      +/-   ##
===========================================
- Coverage    77.95%   76.87%   -1.09%     
===========================================
  Files          477      476       -1     
  Lines        97419    93713    -3706     
===========================================
- Hits         75943    72041    -3902     
- Misses       21476    21672     +196     
Flag Coverage Δ
inputsystem_MacOS_2021.3_project ?
inputsystem_MacOS_2022.3 5.54% <0.00%> (-0.01%) :arrow_down:
inputsystem_MacOS_2022.3_project 75.48% <0.00%> (-0.02%) :arrow_down:
inputsystem_MacOS_6000.0 5.32% <0.00%> (-0.01%) :arrow_down:
inputsystem_MacOS_6000.0_project 77.36% <19.35%> (-0.05%) :arrow_down:
inputsystem_MacOS_6000.2 5.32% <0.00%> (-0.01%) :arrow_down:
inputsystem_MacOS_6000.2_project 77.36% <19.35%> (-0.05%) :arrow_down:
inputsystem_MacOS_6000.3 5.32% <0.00%> (-0.01%) :arrow_down:
inputsystem_MacOS_6000.3_project 77.36% <19.35%> (-0.05%) :arrow_down:
inputsystem_MacOS_6000.4 5.32% <0.00%> (-0.01%) :arrow_down:
inputsystem_MacOS_6000.4_project 77.37% <19.35%> (+<0.01%) :arrow_up:
inputsystem_MacOS_6000.5 5.32% <0.00%> (-0.01%) :arrow_down:
inputsystem_MacOS_6000.5_project 77.37% <19.35%> (-0.05%) :arrow_down:
inputsystem_Ubuntu_2021.3_project ?
inputsystem_Ubuntu_2022.3 5.54% <0.00%> (-0.01%) :arrow_down:
inputsystem_Ubuntu_2022.3_project 75.27% <0.00%> (-0.02%) :arrow_down:
inputsystem_Ubuntu_6000.0 5.32% <0.00%> (-0.01%) :arrow_down:
inputsystem_Ubuntu_6000.0_project 77.17% <19.35%> (-0.05%) :arrow_down:
inputsystem_Ubuntu_6000.2 5.32% <0.00%> (-0.01%) :arrow_down:
inputsystem_Ubuntu_6000.2_project 77.17% <19.35%> (-0.05%) :arrow_down:
inputsystem_Ubuntu_6000.3 5.32% <0.00%> (-0.01%) :arrow_down:
inputsystem_Ubuntu_6000.3_project 77.17% <19.35%> (-0.05%) :arrow_down:
inputsystem_Ubuntu_6000.4 5.33% <0.00%> (-0.01%) :arrow_down:
inputsystem_Ubuntu_6000.4_project 77.18% <19.35%> (-0.05%) :arrow_down:
inputsystem_Ubuntu_6000.5 5.33% <0.00%> (-0.01%) :arrow_down:
inputsystem_Ubuntu_6000.5_project 77.18% <19.35%> (-0.04%) :arrow_down:
inputsystem_Windows_2021.3_project ?
inputsystem_Windows_2022.3 5.54% <0.00%> (-0.01%) :arrow_down:
inputsystem_Windows_2022.3_project 75.60% <0.00%> (-0.02%) :arrow_down:
inputsystem_Windows_6000.0 5.32% <0.00%> (-0.01%) :arrow_down:
inputsystem_Windows_6000.0_project 77.50% <19.35%> (-0.05%) :arrow_down:
inputsystem_Windows_6000.2 5.32% <0.00%> (-0.01%) :arrow_down:
inputsystem_Windows_6000.2_project 77.49% <19.35%> (-0.05%) :arrow_down:
inputsystem_Windows_6000.3 5.32% <0.00%> (-0.01%) :arrow_down:
inputsystem_Windows_6000.3_project 77.49% <19.35%> (-0.05%) :arrow_down:
inputsystem_Windows_6000.4 5.32% <0.00%> (-0.01%) :arrow_down:
inputsystem_Windows_6000.4_project 77.50% <19.35%> (-0.05%) :arrow_down:
inputsystem_Windows_6000.5 5.32% <0.00%> (-0.01%) :arrow_down:
inputsystem_Windows_6000.5_project 77.50% <19.35%> (-0.05%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...Editor/UITKAssetEditor/Views/ControlSchemesView.cs 0.00% <ø> (ø)
.../UITKAssetEditor/Commands/ControlSchemeCommands.cs 76.57% <0.00%> (-2.26%) :arrow_down:
...ests/InputSystem.Editor/InputActionsEditorTests.cs 93.70% <10.00%> (-6.30%) :arrow_down:
...or/UITKAssetEditor/Views/InputActionsEditorView.cs 53.61% <33.33%> (+9.38%) :arrow_up:

... and 17 files with indirect coverage changes

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov-github-com[bot] avatar Sep 16 '25 11:09 codecov-github-com[bot]

Merged develop into this branch to get critical CI fix from https://github.com/Unity-Technologies/InputSystem/pull/2260. Hope this doesn't caused any inconvenience for you.

ekcoh avatar Oct 21 '25 09:10 ekcoh

@ekcoh I tried adding a test for this like discussed in standup but ran into issues with the advanced dropdown not using UIToolkit causing issues.

Darren-Kelly-Unity avatar Dec 04 '25 10:12 Darren-Kelly-Unity