time stamp: 0x6d16dd24 Exception code: 0xe0434352 Fault off

时间:2022-02-10 08:44:56

* WinForm 应用呈现 "has stopped working" 错误。

time stamp: 0x6d16dd24 Exception code: 0xe0434352 Fault off

Windows 日志

Faulting application name: PcClient.exe, version: 1.0.0.0, time stamp: 0x5a076b99
Faulting module name: KERNELBASE.dll, version: 10.0.15063.674, time stamp: 0x6d16dd24
Exception code: 0xe0434352
Fault offset: 0x000eb872
Faulting process id: 0xef4
Faulting application start time: 0x01d35b341fea1746
Faulting application path: C:\Program Files (x86)\Test\PcClient.exe
Faulting module path: C:\Windows\System32\KERNELBASE.dll
Report Id: 4fe7aef6-abc3-424b-9e16-85a18bfdeb2e
Faulting package full name:
Faulting package-relative application ID:

 

错误写法

private void App_FormClosed(object sender, FormClosedEventArgs e) { Environment.Exit(0); }

正确写法

private void App_FormClosed(object sender, FormClosedEventArgs e) { if (Application.MessageLoop) { Application.Exit(); } else { Environment.Exit(1); } }

参考资料

https://*.com/a/12978034