且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

c#代码中使用CMD和CommandLineTools时出现问题(尝试使用蓝牙)

更新时间:2023-01-02 15:28:32

时,没有错误,我不确定为什么会得到APPCRASH之类的信息,但是我的想法是,每当您需要实例化这样的过程时,明智的做法是将整个块包装在try catch中,以便在该第三方应用程序中发生任何无法预料的情况时,您可以至少在您的代码中妥善处理它.我不认为您还没有这样做,但是我认为值得一提以防万一.
如果使用try catch,则可以检查APPCRASH状态,并假定"用户选择了否.希望对您来说,不会有更多的情况会导致发生此特定错误.
I''m not sure about why you would get the APPCRASH and such, but my thought is that anytime you need to instantiate a process like this it would be wise for you to wrap the entire block in a try catch so that when anything unforseen happens in that 3rd party application you can at least deal with it gracefully in your code. I''m not assuming you haven''t done this, but I thought it worthwhile to mention just in case.
If you use the try catch you can check for the APPCRASH state and "assume" that the user has selected no. Hopefully for you there aren''t more situations that will cause this particular error to occur.