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
- [iOS] "UnityBatchPlayerLoop()" causes a freeze in the iOS application when it is put to the background and brought back to the foreground
- "Perform Selected" of Shortcut Manager window does not perform the shortcut in some cases
- Crash on mono_get_hazardous_pointer when running Play Mode tests in a specific project
- [iOS] ‘확인’(Done) and '취소'(Cancel) text is displayed as '...' in the on-screen keyboard when the System preferred language is set to Korean
- [sw-unity-6-1] Shadergraph panning area size is constant regardless of the size or the zoom level
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.