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

Asset Bundles

-

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!]"

  1. Response avatar

    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.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.