最近在学习 C#,同时调试一些 Appium 的封装代码,我使用的是建立一个 Console Application 来调用我封装好的 DLL 文件。其中有一个是网上找的 dll 工具,用来识别图形验证码的 Reconizer.dll,这个 dll 其他人调用的时候没问题,到我这里一调用,就会 Console 直接闪退,完全来不及看报的是什么错误。请问 C# 高手们,对于这种情况我该如何去定位 Console 闪退的原因捏?有没有什么好的方法推荐下 T_T
我用 Try Catch 也不行……STO
Console 闪退关闭以后,控制台的日志如下:
'ConsoleApplication4.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The thread 'vshost.NotifyLoad' (0x1304) has exited with code 0 (0x0).
The thread '<No Name>' (0xf08) has exited with code 0 (0x0).
The thread '<No Name>' (0x1708) has exited with code 0 (0x0).
The thread 'vshost.LoadReference' (0x51c) has exited with code 0 (0x0).
'ConsoleApplication4.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\80374214\Documents\Visual Studio 2010\Projects\ConsoleApplication4\ConsoleApplication4\bin\Debug\ConsoleApplication4.exe', Symbols loaded.
'ConsoleApplication4.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\80374214\Documents\Visual Studio 2010\Projects\ConsoleApplication4\ConsoleApplication4\bin\Debug\WebDriver.dll'
'ConsoleApplication4.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\80374214\Documents\Visual Studio 2010\Projects\ConsoleApplication4\ConsoleApplication4\bin\Debug\appium-dotnet-driver.dll'
'ConsoleApplication4.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\80374214\Documents\Visual Studio 2010\Projects\ConsoleApplication4\ConsoleApplication4\bin\Debug\CharReconizer.dll'
'ConsoleApplication4.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ConsoleApplication4.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ComponentModel.DataAnnotations\v4.0_4.0.0.0__31bf3856ad364e35\System.ComponentModel.DataAnnotations.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ConsoleApplication4.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ConsoleApplication4.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\80374214\Documents\Visual Studio 2010\Projects\ConsoleApplication4\ConsoleApplication4\bin\Debug\tessnet2_32.dll'
'ConsoleApplication4.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\msvcm90.dll'
The program '[3688] ConsoleApplication4.vshost.exe: Managed (v4.0.30319)' has exited with code 1 (0x1).
The program '[3688] ConsoleApplication4.vshost.exe: Program Trace' has exited with code 0 (0x0).
解决办法:
我用 cmd 调用编译好的.exe 文件,这样子 Console 退出以后我也可以看到它的信息啦!哥是不是很聪明_______^
终于看到了错误,好坑爹~:
Unable to load unicharset file D:\Program Files\Tesseract-OCR\eng.unicharset
上网下载 tesseract-2.00.eng.tar.gz,把这里面的文件都复制到 D:\Program Files\Tesseract-OCR 目录下