簡體   English   中英

當我使用'Application.Exit();'時,我得到“已停止工作”錯誤 在C#中

[英]I get “has stopped working” error when I use 'Application.Exit();' in C#

在我的應用程序中,我啟動了幾個進程,當我使用命令Aplication.Exit(); Windows給了我“已經停止工作”的錯誤。 我不明白為什么,也是Enviroment.Exit(0); 給我這個錯誤。

我使用Awesomium webcontrol,然后啟動Application.Exit(); 我打電話

WebCore.Shutdown();

接着

Process.Start("cmd.exe", "/c " + @"rmdir /s/q " + dir); // erase all temporary files

Application.Exit();

試試這個,它會在退出應用程序之前等待進程結束:

// erase all temporary files    
Process process = Process.Start(@"rmdir /s/q " + dir); 
process.WaitForExit();

Application.Exit();

如果這不起作用,請在process.WaitForExit()行上設置一個斷點,並嘗試獲取StackTrace /異常消息以幫助我們找出出錯的地方。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM