Tuesday, January 25, 2011

Visual Studio Crash Cleanup

Have you ever used Visual Studio for a long time, then it crashed and when you tried to restart your project you discovered that the previous instance of Visual Studio left a mess of processes that didn't terminate?


It happens to me at least once a week, if I'm doing a lot of debugging performance analysis, it can happen once an hour.


I've put this little section in a batch file and whenever it happens, I just click it and my problems go away.


It kills the performance analysis and the ASP.NET Development Servers processes.


You'll need to install pskill for it to work.


pskill WebDev.WebServer40.EXE
pskill WebDev.WebServer20.EXE
pskill WebDev.WebServer.EXE
pskill VSPerfMon.exe




Saturday, January 1, 2011

Reparse points

WARNING: This piece of code might delete your files!
Now that I have your attention, I don't provide a binary because of the risk this program might pose on your system, you should read the code and understand what its doing before you execute any line of it, it can and will delete files if used improperly.


YOU HAVE BEEN WARNED!


We all inherited code, systems, installations from someone, somewhere that needed maintenance, some of the ideas we had in the past looked genious to us in the beginning and turned out to be a maintenace hell.


One of these things is NTFS reparse points, or symbolic links (whichever filesystem you choose to use).


NTFS filesystems had no easy way to view, edit, delete or create new reparse points, Gerhild & Hermann created that piece of software called Link Shell Extension.


I needed to write a backup/restore script to recreate all these links after I restored. So I took some APIs from here and there and combined it into this program:


https://sourceforge.net/projects/rpbackup/files/


This specific project has a nice argument parser, it takes care of all the parameter processing for you, you may use it in your own programs as its licensed under MIT.


Take a look at Arguments.cs, the idea was taken from here, but it didn't do what I wanted, so thanks for the idea!


The actual magic is in JunctionPoint.cs, originally from here, but I had to make a modification or two to make it work in our environment.