Console application "COMException crossed a native/managed boundary"

375
1
07-06-2012 02:04 PM
colintalbert
New Contributor
Hello all,
   I have a desktop console application and I'm trying to open a workspaceFactory (Access or fileGDB doesn't matter) and I'm getting a "COMException crossed a native/managed boundary error".

Am I doing somethign wrong here?

    Sub Main()
        'ESRI License Initializer generated code.
        m_AOLicenseInitializer.InitializeApplication(New esriLicenseProductCode() {esriLicenseProductCode.esriLicenseProductCodeArcView}, _
        New esriLicenseExtensionCode() {})
        'ESRI License Initializer generated code.
        'Do not make any call to ArcObjects after ShutDownApplication()

        Dim pWorkspaceFactory As IWorkspaceFactory
        Dim pWorkspace As IWorkspace

        pWorkspaceFactory = New AccessWorkspaceFactory
        Try
            'the following line throws the "COMException crossed a native/managed boundary"
            pWorkspace = pWorkspaceFactory.OpenFromFile("C:\temp_colin\junk\test.mdb", 0)
        Catch ex As Exception

        End Try

        m_AOLicenseInitializer.ShutdownApplication()
    End Sub


Thanks for any help or suggestions.

Colin
0 Kudos
1 Reply
colintalbert
New Contributor
Never mind I was specifying the wrong license type.  Once I got that set I was good.  A better error message would have been nice though.
0 Kudos