Unity crashed and corrupted my .cs file,Electricity went down and corupted a .cs file

So i was working in unity and i had a script open that i was working in, and my electricity went down and pc shutted down.

After i opened the pc again, when i try to open the .cs file it is opening a empty notepad and the visual studio on background with nothing opened. (screenshot here: https://i.postimg.cc/RV44nmH8/poza.png )

Here is my file, can i recover the code?: (i used visual studio 2019) https://wetransfer.com/downloads/54e5cd4bfcfa8e7963c4d4f0a386115220200807112751/6abd51,So i was working in unity and i had a script open that i was working in, and my electricity went down and pc shutted down.

After i opened the pc again, when i try to open the .cs file it is opening a empty notepad and the visual studio on background with nothing opened. (screenshot here: https://i.postimg.cc/RV44nmH8/poza.png )

Here is my file, can i recover the code?: (i used visual studio 2019) https://wetransfer.com/downloads/54e5cd4bfcfa8e7963c4d4f0a386115220200807112751/6abd51

Same thing happen with me is there any solution?

Are you using a hard disk or an SSD? Maybe try running a disk repair and seeing if it’s able to recover any data loss. Typically drives have a buffer that stores data being saved until it’s confirmed to have successfully finished saving. Afaik, that’s why unexpected shutdowns resulting in file corruption is so uncommon these days.

That being said, if that doesn’t work, your best bet might just be to recover the lost data from w/e version control system you’re using.

I was working on a class in visual studio 2010 when suddenly my computer crashes. after I restart the computer. I start Visual studio and I find that class to be completely empty. advanced md it contained more than 1000 lines of codes before the class. is there anyway i can recover that file?

In my case i had an aspx page with its respective .cs and designer.cs The .cs file got corrupted and I did build on project, with the designer.cs the project got build successfully and the dll got replaced. And when I tried to recover using reflector everything was in a state no return.

So don’t build the project if you see any file got corrupted.

Myloweslife