Directory.Delete() in .Net 2.0 forces the AppDomain to recycle. Initially we all thought it must be a bug and Micrsoft will soon provide a HF or Service Pack :) to my surprise ( and millions others) one of the MS blogger claims its a FEATURE!!!!!... I can see the good intention behind putting such hidden feature but I wish they should have at least considers putting some exclusive restrictions !!!!! It sounds very half cooked idea...
Those of you not aware of this interesting feature - Here is a detailed version
in .NET 2.0 ( ASp.NET) if you call directory.delete() and if that directory is below your "Virtual Directory" - This call will restart your application !!!!!!!!!!. After the usual research, it turned out that this is a feature of .NET 20 ? According to MS, the idea is to prevent the stale contents in your virtual directory... Which makes some sense if you are using the ASP.NET which does implicit caching and if you have static content you want to make sure they are up to date. But what about for the people who don't use ASP.NET standard page caching( such as me) or what about people who creates temporary directories solely for the purpose of destroying it later and certainly not by restarting application ???
Here are some other blogs on this interesting issue
http://weblogs.asp.net/owscott/archive/2006/02/21/438678.aspxhttp://aspadvice.com/blogs/joteke/archive/2006/02/22/15299.aspx