Console application "COMException crossed a native/managed boundary"

Discussion created by talbertc42 on Jul 6, 2012
Latest reply on Jul 6, 2012 by talbertc42
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
            '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

    End Sub

Thanks for any help or suggestions.