"Unable to read beyond the end of the stream" error when opening model or profile


Product(s):StormCAD, CivilStorm, SewerGEMS, SewerCAD
Version(s):10.XX.XX.XX, 08.11.XX.XX
Area:Modeling

Problem

When attempting to open a model or open a profile, an Error occurs, with the following details:

System.IO.EndofStreamException: Unable to read beyond the end of the stream
at System.IO.__error.endoffile()
...

You may also see an error that says: Value cannot be null.

Problem ID#: 55285

Solution

This error may occur if your output files or .DWH (drawing file) is corrupt. When a model is saved after being computed, the hydraulic results are saved in a .OUT file, and the appearance of the plan view is saved in the .DWH file. In some cases, this file may become corrupt or unreadable. For example, if the file was saved in an older version and then opened in a newer version, in some rare cases the file cannot be read and the error in question is produced.

To resolve this issue, close the model and browse to where the model is saved. First try renaming the .dwh file to .dwh-old so that it is not found by the program (a new .dwh file will be created when the model is reopened).  Then open the model and see if you still see the error.

If you still see the error, then one of the other supporting files could be the problem.  Create a new folder and copy just the .STSW and .STSW.SQLITE files into the new folder (or, delete all the other files from the original folder). Then open the model from the new folder location and see if the issue still occurs.

If that doesn't help, try restoring the backup files

Finally, you can try importing the database file into a new worksheet. To do this, go to File > Import > (product name) database. Nearly all of the model data is stored in the database file. If you have any color coding or annotations, or any graphs saved in the Graphs manager, you will need to recreate this information.