Search Issue Tracker
By Design
By Design in 2022.1.X
Votes
0
Found in
2021.3.8f1
2022.1.13f1
Issue ID
UUM-11945
Regression
Yes
AsyncRoutine methods are called in different order in a specific project when Code Optimization mode is set to "Release Mode"
How to reproduce:
1. Open the attached “IN-13489” project
2. Enter the Play Mode in the “Assets → Empty” Scene
Expected result: The project continues its execution without “AssertionException” thrown
Actual result: “AssertionException: Received an event that was not expected” is thrown in the Console log with the project stuck in the menu
Reproducible with: 2021.3.8f1, 2022.1.13f1
Couldn’t test with: 2020.3.38f1, 2022.2.0b5, 2023.1.0a6 (project isn’t compatible)
Reproduced on: Windows 10
Couldn’t test on: macOS 12.3 (Intel) (user Packages throw errors)
Note: Following user’s information, the issue wasn’t present in 2020.3 LTS stream. However, with the provided project it isn’t possible to check
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Texture2D hash changes inside of an AssetBundle when rebuilding a SpriteAtlas bundle with an empty AssetPostprocessor Script enabled
- Aniso Level still applies when Generate MipMap is disabled in Texture Import Settings
- Mipmap Limit Groups long names are not truncated when creating a new Mipmap Limit Group with a long name
- “ArgumentException: Invalid double parameter.” error is thrown when Infinity is typed into the Fixed Timestep field
- GameObject becomes gray when using HDRP and STP together on macOS
Resolution Note:
The behavior is actually as a result of a C# design choice detailed here: https://devblogs.microsoft.com/premier-developer/dissecting-the-async-methods-in-c/#async-machinery
The key part being: "The generated state machine is a class in debug mode and a struct in release mode. All the other types (except MoveNextRunner class) are defined in the BCL as structs."
In the case of this issue the customer's code was stashing a copy of the state machine and using it to call MoveNext. Which worked fine in Debug but in Release a copy was used instead of a reference resulting in inconsistent states when attempting to complete.
Resolution Note (2022.1.X):
The behavior is actually as a result of a C# design choice detailed here: https://devblogs.microsoft.com/premier-developer/dissecting-the-async-methods-in-c/#async-machinery
The key part being: "The generated state machine is a class in debug mode and a struct in release mode. All the other types (except MoveNextRunner class) are defined in the BCL as structs."
In the case of this issue the customer's code was stashing a copy of the state machine and using it to call MoveNext. Which worked fine in Debug but in Release a copy was used instead of a reference resulting in inconsistent states when attempting to complete.