Fix deadlock followed by manual detach and exit in MonoDevelop