同事的电脑运行程序,莫名其妙的闪退。
增加以下代码查找原因。
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication6 { static { /// /// /// [STAThread] static { AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new } private { MessageBox.Show(e.ExceptionObject.ToString()); } } } |