Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我的代码中,我通过进程调用运行 exe 文件。如何处理exe文件产生的异常。有人可以帮忙吗。
如果 exe 文件是非托管的,则无法捕获它抛出的异常。
您可以做的是在进程退出后检查其错误代码。为此,请使用Process该类启动 exe。它有一个属性,可以为您提供退出代码。
Process
如果 exe 是托管程序集,您将能够在单独的 AppDomain 中运行它,并捕获它抛出的异常。