Jump to content
House Price Crash Forum

Archived

This topic is now archived and is closed to further replies.

DTMark

Recovering "empty" Files

Recommended Posts

I have a small project originally created in VS2010 which builds into an EXE. It's a simple utility program.

Wasn't under source control but everything on my machine is backed up every day. I haven't looked at this project in ages, I need to make a simple change.

Two of the .cs files in the application open in Notepad, not in the editor, and show as empty.

Opening the files directly in Notepad shows them to be empty too. Yet the files do have file sizes. Basically it looks like the "end of file" marker has got corrupted.

It is possible that the project was open in VS2010 when we had one of the many power cuts we have here. This seems to be a known bug judging by the number of posts about it and people experiencing it - even if the file wasn't open at the time, wasn't being debugged, nothing running - these files haven't changed in years - VS2010 will sometimes destroy the file for you. Nice. As if it wasn't content with destroying your HTML if you dare edit it in the graphical editor - this hasn't put me in a good mood ;)

The backups I have are empty too as it's so long since this must have happened that I didn't spot it. I've tried decompilers, but they simply say "Not supported" - it doesn't build into an DLL but an EXE.

What I need is a tool which can repair that damaged "end of file" marker working on the theory that the content of the file might still be on the disk drive (as it does show a file size). Or, a tool that can open the file including the content.

Anyone come across such a thing..

Share this post


Link to post
Share on other sites

I have a small project originally created in VS2010 which builds into an EXE. It's a simple utility program.

Wasn't under source control but everything on my machine is backed up every day. I haven't looked at this project in ages, I need to make a simple change.

Two of the .cs files in the application open in Notepad, not in the editor, and show as empty.

Opening the files directly in Notepad shows them to be empty too. Yet the files do have file sizes. Basically it looks like the "end of file" marker has got corrupted.

It is possible that the project was open in VS2010 when we had one of the many power cuts we have here. This seems to be a known bug judging by the number of posts about it and people experiencing it - even if the file wasn't open at the time, wasn't being debugged, nothing running - these files haven't changed in years - VS2010 will sometimes destroy the file for you. Nice. As if it wasn't content with destroying your HTML if you dare edit it in the graphical editor - this hasn't put me in a good mood ;)

The backups I have are empty too as it's so long since this must have happened that I didn't spot it. I've tried decompilers, but they simply say "Not supported" - it doesn't build into an DLL but an EXE.

What I need is a tool which can repair that damaged "end of file" marker working on the theory that the content of the file might still be on the disk drive (as it does show a file size). Or, a tool that can open the file including the content.

Anyone come across such a thing..

I use HxD (free) to view and edit files when I need to know exactly what's in them.

Share this post


Link to post
Share on other sites

I have a small project originally created in VS2010 which builds into an EXE. It's a simple utility program.

Wasn't under source control but everything on my machine is backed up every day. I haven't looked at this project in ages, I need to make a simple change.

Two of the .cs files in the application open in Notepad, not in the editor, and show as empty.

Opening the files directly in Notepad shows them to be empty too. Yet the files do have file sizes. Basically it looks like the "end of file" marker has got corrupted.

It is possible that the project was open in VS2010 when we had one of the many power cuts we have here. This seems to be a known bug judging by the number of posts about it and people experiencing it - even if the file wasn't open at the time, wasn't being debugged, nothing running - these files haven't changed in years - VS2010 will sometimes destroy the file for you. Nice. As if it wasn't content with destroying your HTML if you dare edit it in the graphical editor - this hasn't put me in a good mood ;)

The backups I have are empty too as it's so long since this must have happened that I didn't spot it. I've tried decompilers, but they simply say "Not supported" - it doesn't build into an DLL but an EXE.

What I need is a tool which can repair that damaged "end of file" marker working on the theory that the content of the file might still be on the disk drive (as it does show a file size). Or, a tool that can open the file including the content.

Anyone come across such a thing..

There isn't really such a thing as an end-of-file marker for regular files. It is conceivable that some bad bytes were incorporated when the file was last written and these are throwing the text editors, although that would be a very rare event. I suggest...

1) Check the file "properties" using windows explorer and confirm the length is definitely non-zero (probably on the order of a few kilobytes). I'm unsure whether you've done this. If the length is zero then you're out of luck.

2) Try opening the file read-only using some more editors. I don't know what that version of VS does for end-of-lines but I have seen some funnies when people try to view source code with the "wrong" end-of-lines using notepad (this happens most often in cross-development work and the solution is to not use notepad to view source code - seriously). Try copying the file to something with a .txt suffix and opening that copy in office or whatever your word processor is.

3) Obtain a hex viewer / editor that has an ascii mode (I think most or all do), view the file in it and see whether it's recognisably the source. If it isn't then you are almost certainly out of luck.

4) You could try a disk check, but to be honest if the error happened long enough ago to have applied to the existing backups then I wouldn't expect this to help.

5) This one is potentially patronising but I'll suggest it anyway: are you sure you're viewing the correct file? As in do you have the "hide suffixes for known file types" option turned off?

Good luck and let us know how you get on...

Share this post


Link to post
Share on other sites

There isn't really such a thing as an end-of-file marker for regular files. It is conceivable that some bad bytes were incorporated when the file was last written and these are throwing the text editors, although that would be a very rare event. I suggest...

1) Check the file "properties" using windows explorer and confirm the length is definitely non-zero (probably on the order of a few kilobytes). I'm unsure whether you've done this. If the length is zero then you're out of luck.

Size: 3.30KB (3385 bytes)

Size on disk: 4.00KB (4096 bytes)

Modified: 19 December 2013 <- this is wrong. Hasn't been modified for about 2 years. I suspect this should read "Date destroyed by Visual Studio 2010" :)

2) Try opening the file read-only using some more editors. I don't know what that version of VS does for end-of-lines but I have seen some funnies when people try to view source code with the "wrong" end-of-lines using notepad (this happens most often in cross-development work and the solution is to not use notepad to view source code - seriously). Try copying the file to something with a .txt suffix and opening that copy in office or whatever your word processor is.

Also blank in MS Word.

Downloaded HxD and it's just a page of 00s.

3) Obtain a hex viewer / editor that has an ascii mode (I think most or all do), view the file in it and see whether it's recognisably the source. If it isn't then you are almost certainly out of luck.

It's looking like that's the conclusion. My backup drive doesn't have the original since it's so long since last (intentionally) modified.

Apparently VS2010 is supposed to save Auto Recovery versions of files for cases like this but those folders are empty. There's a reasonable body of evidence online that this feature never actually worked anyway.

Share this post


Link to post
Share on other sites

Not much consolation, I know. But this sort of thing is the reason I moved to a versioning backup system.

Complete snapshots of all my document directories every 3 hours for 12 months.

Even with stuff like photos and videos, the storage requirements aren't that vast, because those big files tend not to be edited.

Share this post


Link to post
Share on other sites

Not something i've tried before, but a quick google suggested something like this for viewing the raw file data.

Even text files do have EOF markers, and if this has been set incorrectly then even a hex editor wouldn't attempt to read beyond the end of the file afaik.

Sounds a bit more like the NTFS file stuff has had a wrong length store to it than the file has a spurious EOF marker in it - looking on disk might work.

Edit, sorry it marks that as having a trojan.

https://www.google.co.uk/search?q=raw+hard+drive+viewer&oq=raw+hard+drive+viewer&aqs=chrome..69i57.7220j0j4&sourceid=chrome&espv=210&es_sm=93&ie=UTF-8

was the google, program suggested was linked to from http://lifehacker.com/5128973/disk-investigator-examines-raw-hard-drive-data.

Comments suggest it has a trojan but are then ridiculed, try at your own risk :)

Share this post


Link to post
Share on other sites

I have a small project originally created in VS2010 which builds into an EXE. It's a simple utility program.

Wasn't under source control but everything on my machine is backed up every day. I haven't looked at this project in ages, I need to make a simple change.

Two of the .cs files in the application open in Notepad, not in the editor, and show as empty.

Opening the files directly in Notepad shows them to be empty too. Yet the files do have file sizes. Basically it looks like the "end of file" marker has got corrupted.

It is possible that the project was open in VS2010 when we had one of the many power cuts we have here. This seems to be a known bug judging by the number of posts about it and people experiencing it - even if the file wasn't open at the time, wasn't being debugged, nothing running - these files haven't changed in years - VS2010 will sometimes destroy the file for you. Nice. As if it wasn't content with destroying your HTML if you dare edit it in the graphical editor - this hasn't put me in a good mood ;)

The backups I have are empty too as it's so long since this must have happened that I didn't spot it. I've tried decompilers, but they simply say "Not supported" - it doesn't build into an DLL but an EXE.

What I need is a tool which can repair that damaged "end of file" marker working on the theory that the content of the file might still be on the disk drive (as it does show a file size). Or, a tool that can open the file including the content.

Anyone come across such a thing..

i get enough of this shyt in my day job.

even off-topic has limits. go here:

http://www.vbdotnetforums.com/

Share this post


Link to post
Share on other sites

i get enough of this shyt in my day job.

even off-topic has limits. go here:

http://www.vbdotnetforums.com/

Already looked through all the topics related to VS. Discovered it's a known bug that has annoyed a lot of people. Which I think might be related to another known bug in Visual Studio 2010 which was that as soon as you opened a file or it was even loaded internally for debug it was marked as "Modified" when it wasn't.

VS 2010 was riddled with silly bugs like this. I would use something other than Visual Studio but there isn't really anything for .NET. Microsoft ought to be competing with Google on quality and features, not how many bugs they can get into released software.

This is a bit like having a power cut with Media Player loaded, restarting the computer and finding a stack of MP3 files have been wiped out by Media Player because they just happened to be in the active playlist when the power went off.

The only thing that might have recovered it was a file recovery tool but I'm not getting any joy with that either.

Yes, I should have put this into the GIT repository along with the master project.

I do need to rebuild this little utility program anyway so this event just hastens the need for that :(

Share this post


Link to post
Share on other sites

  • Recently Browsing   0 members

    No registered users viewing this page.

  • The Prime Minister stated that there were three Brexit options available to the UK:   206 members have voted

    1. 1. Which of the Prime Minister's options would you choose?


      • Leave with the negotiated deal
      • Remain
      • Leave with no deal

    Please sign in or register to vote in this poll. View topic


×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.