LEADTOOLS Support
Document
Document SDK Questions
Re: Unhandled exception when using thunking (More info)
#1
Posted
:
Thursday, March 19, 2015 12:00:29 PM(UTC)
Groups: Registered
Posts: 9
Hello,
Some days ago I posted a topic here about IIS hanging when doing OCR with thunking enabled:
http://support.leadtools.com/SupportPortal/CS/forums/44528/ShowPost.aspx
When support asked me to send them a small application, I made it and tested before sending it, but to my surprise the problem didn't appear: no Win32 exception raised upon doing OCR in a web (iis) environment.
I thought I had found the culprit since I was spawning another thread in my original application, and thought that maybe the engine didn't like it.
I re-wrote my app and it seemed to work fine, until now. The Win32 exception appeared again, and it didn't happened before because I did my tests the wrong way.
After a couple of hours doing intensive debug of my application, I found the problem. Long story short: When using thunking, the Win32 exception appears if the call to IOcrPage.RecognizeText() is called with a delegate instead of null (or Nothing in vb).
I'm attaching a small test, that should be ran in IIS in order to check it:
Dim useDelegate as Boolean = True
Dim textResult as String
Leadtools.RasterSupport.SetLicense(licFile, dvk)
Using Codecs As New Leadtools.Codecs.RasterCodecs
Using engine = Leadtools.Forms.Ocr.OcrEngineManager.CreateEngine(Leadtools.Forms.Ocr.OcrEngineType.Professional, True) 'use thunking
engine.Startup(Nothing, Nothing, Nothing, Nothing)
Using doc As Leadtools.Forms.Ocr.IOcrDocument = engine.DocumentManager.CreateDocument()
Using image As Leadtools.RasterImage = Codecs.Load(file, 1)
Dim p As IOcrPage = doc.Pages.AddPage(image, Nothing)
If useDelegate = False Then
textResult = p.RecognizeText(Nothing) '<- This works
Else
textResult = p.RecognizeText(Sub(data As IOcrProgressData)
'do nothing
End Sub) '<- This hangs the w3wp.exe process!!!
End If
Return x
End Using
End Using
End Using
End Using
Is there any other workaround for this besides not using a delegate?
Thank you
Alex
#2
Posted
:
Friday, March 20, 2015 7:34:17 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
I am going to need a little more information to help you solve this. Is the pasted code the "attached small sample" or did you attempt to attach a project? If so it did not attach, if it is too large do not forget to clean the solution first.
Looking at the sample you pasted though I'm not sure it is entirely correct, it looks like you are passing the wrong data into the RecognizeText().
Look at the example for the OcrProgressCallback at
https://www.leadtools.com/help/leadtools/v19/dh/fo/leadtools.forms.ocr~leadtools.forms.ocr.ocrprogresscallback.html
Also what is the exception that you are receiving?
#3
Posted
:
Saturday, March 21, 2015 12:55:25 PM(UTC)
Groups: Registered
Posts: 9
Hello Nathan,
I'm trying to attach a sample visual studio project, (6MB aprox) but I keep receiving an error from the forum, and that it has been logged.
I'm sending it to
support@leadtools.com and a link to this post.
Thank you.
Alex
LEADTOOLS Support
Document
Document SDK Questions
Re: Unhandled exception when using thunking (More info)
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.