# Is there a valid answer to this “Why?” comment?

This is probably too little to go on for a definitive answer, but in looking over some legacy code, I found this (a previous peruser commented "Why?") in what serves as the main form in a Windows CE / .NET 1.1 project (Windows Forms style app_:

protected override void Dispose( bool disposing )
{
dbconn.DBClose();
base.Dispose( disposing );
Application.Exit();         // Why?
}


Is calling Application.Exit() valid here? Is there any reason for it? If not, any harm in it?

-
Probably a wrong site; also Application.Exit() is usually indeed very bad, particularly in the middle of Dispose. If a form needs to close with or without a status, then there are much better ways of doing this. –  Leonid Feb 26 '13 at 0:02
@Leonid wrong site, indeed - I'd submit this one to Daily WTF. –  Jesse C. Slicer Feb 26 '13 at 0:05

Just to elaborate on comments to question: The purpose of Dispose is to release resources owned by object (and primary purpose is to release unmanaged resources). As such Dispose method should not touch or perform action not related to the object being disposed, and Application.Exit is definitely out of scope here.