Pages

Tuesday, October 13, 2009

Application.Current.Shutdown Doesn't close Immediately

When you call Application.Current.Shutdown you may expect to shutdown the  application immediately. But it doesn't. Application.Shutdown is async in nature. So it may take few moments to shut down application. So not to execute code after shutdown call, you need to put a return statement. This return statement will make sure that the code returns. You can also use Thread.Sleep so that the shutdown method gets time to close the application. But you can't grantee how much time you will keep the thread sleep.

The issue is already reported  here.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.