Search Issue Tracker

In Progress

Fix In Review for 1.4.5

Votes

1

Found in [Package]

1.4.4

2.0.1-pre.18

Issue ID

DSTR-1054

Regression

No

"ArgumentException: An item with the same key has already been added" is thrown on Script Reload when an emoji is used as a test case

Package: Test-Framework

-

Reproduction steps:
1. Open the attached “BugRepro” project
2. Place the attached “BrokenCharTest.cs” script in the “Assets/Tests” folder
3. Open the “Assets/Tests/BrokenCharTest” script using a code editor
4. Make any changes to the code, e.g. add a comment
5. Return to the Editor and open the Test Runner window (Window > General > Test Runner)
6. Observe the Console window

Expected result: No errors are logged in the Console
Actual result: "ArgumentException: An item with the same key has already been added…" error is logged in the Console

Reproducible with: 1.1.33, 1.4.4, 2.0.1-pre.18 (2021.3.39f1, 2022.3.34f1)
Not reproducible with: 1.4.4 (6000.0.7f1)
Couldn't test with: 1.4.4 (2023.2.0a5), 2.0.1-pre.18 (2023.2.0a5, 6000.0.7f1) (Package compilation errors)
Fixed in: 1.3.3 (2023.2.0a5)

Reproducible on: Windows 11, macOS 14.5 (M3 Pro) (By user)
Not reproducible on: No other environments tested

Note: In 1.1.33 and 1.3.3 in step 5, the error is constantly logged and the tests disappear from the Test Runner window

  1. Resolution Note (fix version 1.4.5):

    In UTF 1.4.5 we are improving the error message for non unique test ids, so that it no longer gives an Argument exception about the same key already being added.

    After this, it is easier to see what issues at play here:
    * This case hits a bug in Nunit, where TestFixtureSource does not work on a class without a namespace.
    * The emoji (\uD83D) in the this case is invalid unicode, that gives an error when transformed. It would normally have more components to it (e.g. \ud83d\ude00).

    Changing to a simpler emoji (e.g. \u26f2 ) and moving the test into a namespace makes it work again.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.