World deleted

Discussion in 'PC Bug Reports' started by kmkkmk, Aug 31, 2017.

  1. kmkkmk

    kmkkmk Terrarian

    My world (.wld) and backup (.bak) have been deleted.

    • I played yesterday.
    • I found a .wld file in the windows recycling folder. The file's modification time matches with the start of my session yesterday.
    • There was no matching .wld.bak file in the recycler.
    • Only the world I played yesterday is affected my other worlds are fine.
    • When I load the old world it looks like the state of my world at the start of my session yesterday.
    • I am quite sure that I did not delete the file.
    • I am on Windows 10 with an offline world in single player.
    I currently assume that this was most likely cause by a bug in Terraria.
  2. Leinfors

    Leinfors Quality Assurance Staff Member Moderator Re-Logic

    @kmkkmk, what anti-virus program are you using?

    If possible, take a look at the action log of your AVP; Terraria isn't supposed to delete world files, and we suspect that it is likely Windows or an Antivirus program doing so. More info could help us identify this. :)
    Last edited: Aug 31, 2017
  3. kmkkmk

    kmkkmk Terrarian

    I am using the builtin Windows 10 anti-virus program. I understand that there is little you can do, since I do not have a reproducible test case. My report is therefore borderline useless and I was debating with myself, whether I should skip reporting the incident.

    However I have looked at some source code of terraria available online and I noticed
    FileOperationAPIWrapper.MoveToRecycleBin(path); in Terraria.Utilities.FileUtilities.Delete which uses the recycler. Given the two observations:
    • deleted file was in the recycler (but .wld.bak was not),
    • the modification time matches with the start of my last play session
    I find it likely that Terraria was the program that issued the delete. I see two avenues:
    1. in the code paths around saving - One by one replace every step of the implementation with a statement that throws an exception. Do this one statement at a time. Thereby you systematically simulate random errors at every step of the saving algorithms.
    2. opening the .wld and/or .wld.bak files in other programs and saving the world in Terraria.
    I have done some testing on 2. (1. is not possible for me). With the help of I could force a crash in Terraria, when the map was saved. (You might consider saving to a different file instead of crashing in this case.) Obviously the world was not updated but in contrast to my report the two files stayed in the worlds directory.

    I understand completely if this issue cannot be resolved but it would obviously be nice.
    Last edited: Sep 2, 2017