2009-11-02 47 views
1

我有一個使用Tessnet2的應用程序。當我嘗試調用其Init方法時,該應用程序失敗。
失敗只是可怕 - 沒有例外(任何),沒有任何錯誤的痕跡,甚至沒有「發送報告」窗口。該應用程序的流程只是被拒絕使用Tessnet2的.NET應用程序失敗

有問題的代碼是:

Recogniser = new Tesseract(); 
Recogniser.SetVariable("tessedit_char_whitelist", Whitelist); 
Recogniser.SetVariable("unlv_tilde_crunching", false); 
Recogniser.Init(null, "eng", false); // FAILURE IS HERE 

夫婦的音符可能會有所幫助:

  • Tessnet2需要的Visual C++ 2008運行時。不知道它應該是msvcm90.dll,msvcm80.dll。
  • 該應用程序是桌面WPF。它工作過(我認爲我添加了Web引用來消費SOAP Web服務,但我試圖刪除它沒有結果)。
  • 單元測試與完美配合無故障

從這些意見聽起來像WPF應用程序本身的問題。

只有一條信息,我已經是調試過程中的輸出:

'OcrForm.WinApp.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 
'OcrForm.WinApp.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 
'OcrForm.WinApp.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 
'OcrForm.WinApp.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 
'OcrForm.WinApp.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 
'OcrForm.WinApp.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync\9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 
'OcrForm.WinApp.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 
'OcrForm.WinApp.vshost.exe' (Managed): Loaded 'D:\...\bin\Debug\OcrForm.WinApp.vshost.exe', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 
'OcrForm.WinApp.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 
'OcrForm.WinApp.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 
'OcrForm.WinApp.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Runtime.Serialization\3.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 
'OcrForm.WinApp.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.ServiceModel\3.0.0.0__b77a5c561934e089\System.ServiceModel.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 
'OcrForm.WinApp.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Web.Services\2.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 
'OcrForm.WinApp.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Xml.Linq\3.5.0.0__b77a5c561934e089\System.Xml.Linq.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 
'OcrForm.WinApp.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Data.DataSetExtensions\3.5.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 
'OcrForm.WinApp.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 
'OcrForm.WinApp.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 
'OcrForm.WinApp.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\UIAutomationProvider\3.0.0.0__31bf3856ad364e35\UIAutomationProvider.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 
'OcrForm.WinApp.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\WindowsBase\3.0.0.0__31bf3856ad364e35\WindowsBase.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 
'OcrForm.WinApp.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\PresentationCore\3.0.0.0__31bf3856ad364e35\PresentationCore.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 
'OcrForm.WinApp.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\PresentationFramework\3.0.0.0__31bf3856ad364e35\PresentationFramework.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 
The thread 0x1784 has exited with code 0 (0x0). 
The thread 0x1144 has exited with code 0 (0x0). 
The thread 0x16a4 has exited with code 0 (0x0). 
'OcrForm.WinApp.vshost.exe' (Managed): Loaded 'D:\...\bin\Debug\OcrForm.WinApp.exe', Symbols loaded. 
Step into: Stepping over non-user code 'OcrForm.WinApp.App.App' 
'OcrForm.WinApp.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 
Step into: Stepping over non-user code 'OcrForm.WinApp.App.InitializeComponent' 
'OcrForm.WinApp.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\PresentationFramework.Classic\3.0.0.0__31bf3856ad364e35\PresentationFramework.Classic.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 
The thread 0x374 has exited with code 0 (0x0). 
The thread 0x13cc has exited with code 0 (0x0). 
'OcrForm.WinApp.vshost.exe' (Managed): Loaded 'D:\...\bin\Debug\OcrForm.dll', Symbols loaded. 
'OcrForm.WinApp.vshost.exe' (Managed): Loaded 'D:\...\bin\Debug\Commons.dll', Symbols loaded. 
'OcrForm.WinApp.vshost.exe' (Managed): Loaded 'D:\...\bin\Debug\tessnet2_32.dll', Symbols loaded. 
'OcrForm.WinApp.vshost.exe' (Managed): Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww_6f74963e\msvcm90.dll' 

而且最後一塊時,應用程序失敗:

The program '[5384] OcrForm.WinApp.vshost.exe: Managed' has exited with code 1 (0x1). 

更新:我已經檢查了事件日誌。 「SideBySide」來源沒有任何條目。只有與該問題有關的條目如下,但不幸的是它並沒有告訴我很多:

Event Type: Error 
Event Source: .NET Runtime 2.0 Error Reporting 
Event Category: None 
Event ID: 5000 
Date:  28/10/2009 
Time:  4:07:57 PM 
User:  N/A 
Computer: ARGO11 
Description: 
EventType clr20r3, P1 ocrform.winapp.exe, P2 1.0.0.0, P3 4ae7d16c, P4 ocrform, P5 1.0.0.0, P6 4ae1333f, P7 10f, P8 1, P9 system.typeinitialization, P10 NIL. 

在此先感謝您的任何提示。

+0

我們有這樣的情況,這是由於未處理的異常,FYI – PostMan 2009-11-02 06:12:13

+0

什麼樣的異常?我根本沒有得到任何exceptoins。我的猜測是,加載C++運行時庫有一些問題。 – 2009-11-02 07:32:48

回答

0

我想出了問題所在。

簡短回答: 使用SaveFileDialog後,該應用的工作目錄被更改。這導致Tesseract無法找到相關文件。

夫婦的我做了那件事:

  1. 創建了一個使用Tessnet2一個新的WPF應用程序。
  2. 啓動它 - >它失敗的方式完全一樣。
  3. 我發現我錯過了添加tesseract所需的文件。
  4. 添加它們 - >該應用程序開始工作。

比移動到我的應用程序:
我經過由正方體所需的文件。所有這些都是有效的。

所以一定有別的東西涉及到不能夠訪問文件:

  1. 沒有權限。
  2. 位置不正確。

檢查1日 - 一切正常。
檢查第二個 - 所有文件都在正確位置相對應用程序當前目錄

看到了點??
但事實證明,應用程序的文件應該在相同的工作目錄

使用SaveFileDialog後工作目錄已更改!

如果我不使用應用程序的對話框工作。
我怎麼可能從所有的「錯誤信息」中得出這個結論...
希望這會幫助別人。

+0

hhmm ..即使我檢查了點1和2,仍然有同樣的問題 – user384080 2010-11-11 06:33:06

1

看看windows系統事件日誌(開始 - >設置 - >控制面板 - >管理 - >事件查看器)。可能您會從Windows SideBySide經理那裏找到條目。

輸出的最後一行顯示SideBySide中的dll已被加載。

我最近有類似的問題。直到我們查看事件日誌,才提示故障原因。

+0

非常感謝。我沒有考慮過查看事件日誌:)當我到達工作電腦並在此發佈結果時,將會這樣做。 – 2009-11-02 11:57:57

+0

好的。我檢查了事件日誌。除了system.typeinitialization之外,沒有太多信息。我更新了更新的問題。 – 2009-11-03 22:16:35