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
- Sampling a texture using an HLSL file throws shader errors and the code does not compile
- "Graphics.CopyTexture called with null source texture" error when Base Camera of an Overlay Camera is removed with DX11 Graphics API and Compatibility Mode enabled
- WebGL sends wrong value with large numbers when SendMessage function is used
- Errors and warnings are thrown after installing Visual Effect Graph Learning Samples
- Add Behaviour dropdown has a part in which the dropdown outline is cut out when the Add Behaviour dropdown is opened
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.