Quantcast
Channel: Silverlight 5 forum
Viewing all articles
Browse latest Browse all 1083

Using P/Invode call to VideoOCR.dll, Silverlight plugin completely crash

$
0
0

Hello Everyone,

I am trying to use VideoOCR dll using P/Invode in Silverlight application for reading Passport MRZ code. However as soon as I get MRZ code, Silverlight plugin completely crash with following error:

Faulting application name: IEXPLORE.EXE, version: 11.0.9600.16518, time stamp: 0x52f347b2

Faulting module name: ntdll.dll, version: 6.3.9600.16408, time stamp: 0x523d45fa

Exception code: 0xc0000374

Fault offset: 0x000e2fd8

Faulting process id: 0x10a8

Faulting application start time: 0x01cf410f25b17a7b

Faulting application path: C:\Program Files (x86)\Internet Explorer\IEXPLORE.EXE

Faulting module path: C:\WINDOWS\SYSTEM32\ntdll.dll

Report Id: 6e0955b4-ad02-11e3-be70-180373246c62

Faulting package full name:

Faulting package-relative application ID:

Here is my code Snippet

[StructLayout(LayoutKind.Sequential, Pack=1)]     
        public struct DLL_MRZDATA
        {
            [MarshalAs(UnmanagedType.LPTStr)]   
            public string RawMRZ;

        }

public delegate void MRZDelegate(UInt32 Parameter,ref DLL_MRZDATA Data);


 [DllImport(DLL_LOCATION)]
        [SecuritySafeCritical]
        private static extern Boolean voInitialiseReader(Boolean InfraRed, Boolean Colour, Boolean UV, Boolean RFID, Boolean AutoStop);
        [DllImport(DLL_LOCATION)]
        [SecuritySafeCritical]
        private static extern Boolean voStartRead();
        [DllImport(DLL_LOCATION)]
        [SecuritySafeCritical]
        private static extern Boolean voRegisterMrzCallback(MRZDelegate Callback,  UInt32 Parameter);


[AllowReversePInvokeCalls]
        internal static void MRZCallback(UInt32 Parameter,ref  DLL_MRZDATA Data)
        {   
            string data = Data.RawMRZ;            
         }

private void button1_Click(object sender, RoutedEventArgs e)
        {
            voInitialiseReader(false, false, false, false, true);

            voRegisterMrzCallback(new MRZDelegate(MRZCallback), 0);
        }

private void button2_Click(object sender, RoutedEventArgs e)
        {
                if (!voStartRead())
                {
                    //! need to display message here...
                }
        } 

If I put breakpoint in "MRZCallback" then I notice that I have correct value or MRZ Code in Data.RawMRZ. However as soon as focus go out of this call back, Silverlight browser completely crash. In last couple of days, I did my best to find out root cause but completely fail.

apparently it looks a Heap/Memory problem but I don't know how to figure out it and fix the issue.

I will highly appreciate your response.


M. Irfan


Viewing all articles
Browse latest Browse all 1083

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>