RevoLand / Steam-Library-Manager

Open source utility to manage Steam, Origin and Uplay libraries in ease of use with multi library support. ||| Steam Games Database: https://stmstat.com
MIT License
574 stars 56 forks source link

FATAL System.IO.IOException: The file or directory is corrupted and unreadable (Staxel) #60

Closed shakeyourbunny closed 5 years ago

shakeyourbunny commented 5 years ago

Describe the bug Steam Library Manager v1.5.1.7

Moving / compressing the Steam game "Staxel" (appid: 405710) fails with the error message "FATAL System.IO.IOException: The file or directory is corrupted and unreadable.".

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Steam Library'
  2. Click on 'Staxel'
  3. Drag the game to the SLM Library
  4. Switch to "Task Manager" and press "Start".

Expected behavior Correct moving / compressing the app to the SLM library.

Additional context 2019-06-07.zip

I guess the internal buffer for number of files for an app has a static size limit which is in this case exceeded, the game has more than 18000 files in its directories.

See also at the top of the log:

2019-06-07 21:08:26.3429 FATAL System.ArgumentException: Destination array was not long enough. Check destIndex and length, and the array's lower bounds. at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable) at System.Collections.Generic.List1.CopyTo(T[] array, Int32 arrayIndex) at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at Steam_Library_Manager.Definitions.SteamLibrary.UpdateJunks() 2019-06-07 21:08:45.3723 INFO [Staxel] Populating file list, please wait 2019-06-07 21:08:45.5868 INFO [Staxel] File list populated, total files to move: 18265 - total size to move: 1,2 GB

I suggest using a dynamic list for the file names instead of one which has a static limit.

shakeyourbunny commented 5 years ago

I don't know C#, but I googled a bit, it may be that this operation is not thread safe and falls then flat: https://stackoverflow.com/questions/10362023/destination-array-not-long-enough https://stackoverflow.com/questions/19784704/c-sharp-system-argumentexception-destination-array-was-not-long-enough

Quote from the last URL:

As this is most likely a thread related problem, the only way a Queue.ToArray() can throw an exception saying “Destination array was not long enough” is when the queue itself grows in another thread while ToArray tries to copy it..

RevoLand commented 5 years ago

I don't know C#, but I googled a bit, it may be that this operation is not thread safe and falls then flat: https://stackoverflow.com/questions/10362023/destination-array-not-long-enough https://stackoverflow.com/questions/19784704/c-sharp-system-argumentexception-destination-array-was-not-long-enough

Quote from the last URL:

As this is most likely a thread related problem, the only way a Queue.ToArray() can throw an exception saying “Destination array was not long enough” is when the queue itself grows in another thread while ToArray tries to copy it..

Actually "Destination array was not long enough" and "The file or directory is corrupted and unreadable" both are different errors and doesn't have any relationship.

About the "The file or directory is corrupted and unreadable" error, is there any possibility for the game folder's to have permission issues, or maybe marked as read-only? I've personally never seen this error before. Can you also try running the SLM as administrator?

shakeyourbunny commented 5 years ago

This is the result, running SLM as Administrator, produces (nearly) same result.

2019-06-08 as admin.zip

Edit: I also removed and reinstalled Staxel first.

RevoLand commented 5 years ago

I belive the issue is related to a corrupted file/folder and not related to SLM at all. Can you please try repairing the game with Steam or having the game in a different folder? Thanks in advance!

shakeyourbunny commented 5 years ago

I'll try to outright delete the game on disk and reinstall it, will report what happens.

shakeyourbunny commented 5 years ago

Seems so... I am really surprised, because this a newish SSD, offending file is GAMEDIR\content\staxel\expressions\Heart2.qb.

CHKDSK did the trick repairing it.

Stage 2: Examining file name linkage ...

Deleting index entry overlay_english.txt in index $I30 of file 40181.

Deleting index entry Heart2.qb in index $I30 of file 1304086.

1733890 index entries processed.

Index verification completed.

Works now. Thank you for your hints!

RevoLand commented 5 years ago

Thanks to you for your time and effort on investigating! I'm happy to hear it's working now. :)