Search Issue Tracker
Won't Fix
Votes
0
Found in
2018.4
2018.4.28f1
2020.1
Issue ID
1290667
Regression
No
Editor crashes when closing a FileStream before unloading AssetBundle
Reproduction steps:
1. Open the user's attached "LoadFromStreamCrash.zip" project
2. Load SampleScene
3. Click on the "LZ4 Crash" Button in the Game view
-- Observe the crash
Reproducible with: 2018.4.29f1, 2019.4.14f1, 2020.1.13f1, 2020.2.0b11, 2021.1.0a5
Note: before the crash occurs an assertion fails and an error is thrown:
Assertion: "Assertion failed on expression: 'res'"
Error: "Cancelling DisplayDialog because it was run from a thread that is not the main thread: Fatal Error! The file 'archive:/BuildPlayer-Test1/BuildPlayer-Test1.sharedAssets' is corrupted! Remove it and launch unity again!
[Position out of bounds!]"
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
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
Resolution Note:
This is a misuse of the streaming API. The loading code does not handle file I/O errors gracefully so when the provided stream is disposed before the read completes, a crash occurs. Because the loading code is executing on the loading thread, we cannot display a main thread dialog, but the error is reported in the editor log.
From the documentation of LoadFromStream:
Do not dispose the Stream object while loading the AssetBundle or any assets from the bundle. Its lifetime should be longer than the AssetBundle. This means you dispose the Stream object after calling AssetBundle.Unload.