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
- Standard Unity Materials and Shaders become corrupted after importing specific Asset Packages
- [Linux][OpenGL][Vulkan] Draw calls are not shown in the Event List when taking a capture of a frame with RenderDoc
- Inaccurate collision detections when Rigidbody Collision Detection is set to "Continuous" or "Continuous Dynamic"
- Crash on Object::IncrementPersistentDirtyIndex when upgrading project version
- [iOS] Multiple Xcode project instances created before opens up when performing Build and Run for iOS Platform
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.