I'm developing a MODI based application that works perfectly except that when the application closes an error is thrown:

[Application Title].vshost.exe - Application Error: The instruction at "0x078c38b6" referenced memory at 0x00000004". The memory could not be "read".

I've tried everything I can think of but cannot figure out how to prevent the error. I know the error is caused by the OCR method of a MODI document since commenting out the line of code stops the problem. However, I obviously need that line.

I've also commented out all but the bare bones of the app (code included below) and still receive the error. Anybody have any ideas??

miView is obviously the MODI Viewer on the form

Public Class frmMODI
    Private WithEvents eventDoc As MODI.Document

    Private Sub TestMDI()
        Dim mdiDoc As New MODI.Document
        Dim mdiTempDoc As New MODI.Document

        'Create Document with initial image

        'Append succeeding images
        mdiDoc.Images.Add(mdiTempDoc.Images.Item(0), Nothing)

        mdiDoc.Images.Add(mdiTempDoc.Images.Item(0), Nothing)

        'Set the Viewer to the document
        MiView.Document = mdiDoc

        mdiDoc = Nothing
        mdiTempDoc = Nothing

    End Sub

    Private Sub btnTemp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTemp.Click
    End Sub

    Private Sub btnOCR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOCR.Click
    End Sub

    Private Sub OCR()
        eventDoc = MiView.Document
        eventDoc = Nothing
    End Sub

End Class