Giles icon indicating copy to clipboard operation
Giles copied to clipboard

VS 2013 temporary file & renaming issue

Open codereflection opened this issue 12 years ago • 5 comments

Test support for VS 2013. The SpecWatchr guys (@amirrajan) found that temporary files are getting created, and file renames are occurring with a save in VS 2013.

codereflection avatar Jul 18 '13 18:07 codereflection

Here is the reasoning behind it from the VS team:

Thanks for reaching out to us David!

David from our team.

In VS 2013, we have introduced this new disaster recovery feature that helps recover files in case of an unexpected crash. We got a number of customer reports where their files used to get “zeroed out” after a Windows crash event. This feature allows us to preserve the latest possible contents of the file and recover in case of an unexpected event such as a Windows crash.

Thanks, Murali

From: David Starr Sent: Sunday, July 21, 2013 11:25 PM To: Murali Krishna Hosabettu Kamalesha; Amir Rajan Subject: RE: The shenanigans VS 2013

Murali,

Summary: Visual Studio creates temp files as part of standard file save process.

Do you understand the behavior described below? If not, who might help us learn more?

Thanks!

David Starr

From: Amir Rajan Sent: Friday, July 19, 2013 8:27 PM To: David Starr Subject: The shenanigans VS 2013

Jeff Schumacher (@codereflection) and I develop open source auto tests tools for .Net. Jeff built Giles and I built SpecWatchr. Both of our tools monitor file change events in a given directory. When a file change event occurs, we kick off a build, test run, web deployment or anything else you may want to contextually do when a code file changes.

It turns out that VS 2013 doesn't change .cs files, but instead creates a temporary version and *replaces the original. This photo I took of the file change events shows two temp files getting created..I didn't capture the rename event, but notice that no file changed event for HomeController.cs is raised: https://pbs.twimg.com/media/BPeOrcPCMAAzKQv.jpg:large

We're both just confused. Why would a ctrl+s in VS 2013 create two temp files and then rename the original file (as opposed to just changing the original file)?

Thanks for fielding this question. It's really appreciated!

Amir

amirrajan avatar Jul 22 '13 15:07 amirrajan

Sounds like the way around this for now is to handle the rename event. @amirrajan, is that what you've done with SpecWatchr?

It really seems like the VS team is putting a band aide on the problem. I know they cannot do anything about Windows crashing, but why would Visual Studio zero out a file completely? I have to wonder if other IDE's, heck even vim or emacs, has had reports of this problem on Windows. Then again, maybe the complaints the VS team are getting are all from people using TFS. ;)

codereflection avatar Jul 22 '13 17:07 codereflection

Yes. Handling for the rename event fixed the issue. Here is the code for reference:

https://github.com/amirrajan/SpecWatchr/blob/master/sidekickapp.cs#L24

and this

https://github.com/amirrajan/SpecWatchr/blob/master/sidekickapp.cs#L65

amirrajan avatar Jul 22 '13 17:07 amirrajan

More issues have cropped up, specifically with Windows 8 + VS 2013. Details here:

https://github.com/amirrajan/SpecWatchr/issues/7#issuecomment-22581729

amirrajan avatar Aug 13 '13 18:08 amirrajan

More updates, looks like the file change issue was fixed, they just didn't tell anyone. That and the file change events are raised in a different order. In other words, SpecWatchr screwed up.

https://github.com/amirrajan/SpecWatchr/issues/7#issuecomment-22593175

amirrajan avatar Aug 13 '13 20:08 amirrajan