// 复现 OCR 设置窗报错,把完整异常写到文件 using System; using System.Windows.Forms; namespace pdfbt { static class ShowErr { [STAThread] static void Main() { try { var f = new OcrSettingsForm(null); f.Show(); Application.DoEvents(); FileLog("窗口创建成功,无异常"); } catch (Exception ex) { FileLog("EX: " + ex); var inner = ex.InnerException; while (inner != null) { FileLog("INNER: " + inner); inner = inner.InnerException; } } } static void FileLog(string s) { System.IO.File.AppendAllText(@"C:\Users\099978\Documents\SharpDevelop Projects\pdfbt\showerr.log", s + "\r\n"); } } }