views:

788

answers:

2

Hi,

I have an app that uses Tessnet2. The application fails when I try to call its Init method.
The failure is just awful - no exception (ANY), no any trace of error, not even "Send report" window. The app's process is just droped.

The problematic code is:

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

Couple of notes that might be helpful:

  • Tessnet2 requires Visual C++ 2008 Runtime. Not sure if it should be msvcm90.dll, msvcm80.dll.
  • The application is desktop WPF.
  • Dev Environment: VS 2008 SP, .NET 3.5 SP1
  • It worked before (I think I added the Web Reference to consume SOAP web-service, but I tried to remove it with no result).
  • The unit tests are working perfectly with no failures.

From these observations it sounds like a problem with the WPF application itself.

Only one piece information I have is the Output during the debugging:

'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'

And the last piece when the app fails:

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

UPDATE: I have checked the event log. There are no any entries with 'SideBySide' source. Only entry related to the issue is below, but unfortunately it doesn't tell me a lot:

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.

Thanks in advance for any tips.

+1  A: 

Have a look in the windows System event log (Start->Settings->Control Panel->Management->Event Viewer). Possibly you'll find there entries from the Windows SideBySide manager.

The last line of your output shows that a dll from SideBySide has been loaded.

I Had similar problems lately. No hint to the failure cause until we looked into the event log.

RED SOFT ADAIR
Thanks a lot. I haven't thought about looking into the Event Log :) Will do that when I'll get to my work PC and post the results here.
Dmytrii Nagirniak
Ok. I have checked the event log. Not much info is there except system.typeinitialization. I updated the question updated.
Dmytrii Nagirniak
A: 

I figured out the problem.

Short answer: The working directory of the app was changed after using SaveFileDialog. This caused Tesseract to fail to find related files.

Couple of thing I did for that:

  1. Created a new WPF application that uses Tessnet2.
  2. Started it -> it failed exactly the same way.
  3. I found that I missed to add files required by tesseract.
  4. Added them -> the app started to work.

Than moving to my application:
I Checked the files required by tesseract. All are in place and valid.

So there must be something else related to not being able to files:

  1. No permissions.
  2. Incorrect location.

Checked the 1st - all is fine.
Checked the 2nd - all files ARE in correct location relatively to the application current directory.

See the point??
BUT it turns out the files should be in the same WORKING DIRECTORY as application is.

The working directory has been changed after using SaveFileDialog!

If I do not use the dialog the app works.
How I could possible figure this out from all the "error information"...
Hope this will help somebody.

Dmytrii Nagirniak