none
2146233079 automation error while createobject on interop assembly (only second time) RRS feed

  • Question

  • Dears,

    I have the following bizar problem.  I've created a .NET assembly (dll) that can be created from COM (vb6 in my case).  When I create the object the first time, everything goes fine.  But the second time, I get an error on the CreateObject (-2146233079 automation error).  I was unable to retrieve any more information from the error object in vb. 

    I registered the .NET assembly using regasm (I tried both with and without the /tlb option).  The .NET assembly simply queues the items it receives and spawns another thread that consumes the items.  The spawned thread exits gracefully, and all calls to the DrillBackDotNetDispatcher return to vb.  The second creation of the object is made after both the last call to addItem has returned and the thread has exited.  I'm completely in the dark here, as the error message is very general.  Does anyone have a clue what could cause this behavior?  I saw that it could be linked with migrating to .NET 2.0, but this is not the case here, as the app was developed in 2.0 from the start. 

    Also, are there any tools I can use to retrieve more insight in what's going on behind the scenes?

    Thanks,
    Phil

    The vb function that calls the assembly looks like this:

    Private Sub Run()
    Dim oViewer         As Object
    Set oViewer = CreateObject("DrillBackInterface.DrillBackDotNetDispatcher")
    Set oViewer.DataServer = goApplication.DataServer  

    With moDrillbackSetting.Recordset
       
            .MoveFirst
           
            While Not .EOF
               [...]
                Call oViewer.AddItem(moJob.Name & " (Run " & GetRunNr & ")", _
                                     .Fields(MEXSQLFIELD_STEP_NAME), _
                                     sTable, _
                                     sCatalog, _
                                     sServer, _
                                     sOwner, _
                                     sSql, Nothing, _
                                     "", goApplication.Sql.GetDrillbackTitle(moJob.MexId, lStepLogId))
                                    
                .MoveNext
            Wend
        End With
    End Sub


    The assembly looks like this:

        [Guid("03F5B7B0-3FBA-4d16-9B17-8B5905FC8F37")]
        [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
        public interface _DrillBackDotNetDispatcher
        {
            [DispId(1)]
            int AddItem(string environmentName, string requestName,
                        string tableName, string databaseName,
                        string serverName, string ownerName,
                        string sqlStatement, System.Data.DataTable inputTable,
                        string info, string htmlInfo);

            [DispId(2)]
            object DataServer { set;}
        }

        [Guid("2CEFC74D-478A-41e7-B4CA-326D862361BD")]
        [ClassInterface(ClassInterfaceType.None)]
        [ProgId("DrillBackInterface.DrillBackDotNetDispatcher")]
        public class DrillBackDotNetDispatcher : _DrillBackDotNetDispatcher
        {
            public int AddItem(string environmentName, string requestName,
                               string tableName, string databaseName,
                               string serverName, string ownerName,
                               string sqlStatement, System.Data.DataTable inputTable,
                               string info, string htmlInfo)
            { ... }

            public object DataServer
            {  set {... } }
    }


    Thursday, September 7, 2006 2:31 PM

Answers

  • The error code is pretty unusual but it does hint that this is a .NET generated error.  The facility code is 19, "URT" which was a really early name for the CLR (Universal RunTime).  Try putting try/catch handlers in your .NET code with tracing...
    Friday, September 8, 2006 8:54 PM
    Moderator

All replies

  • The error code is pretty unusual but it does hint that this is a .NET generated error.  The facility code is 19, "URT" which was a really early name for the CLR (Universal RunTime).  Try putting try/catch handlers in your .NET code with tracing...
    Friday, September 8, 2006 8:54 PM
    Moderator
  • Indeed, I was setting the name of the thread in the constructor (and that was just about the only thing I did in there, and I had not put a try - catch in).  The second time, this caused an exception to be thrown back to vb.

    Thanks a lot for your tip, it was what helped my find the problem.  But I don't really understand where you got the facility code, and what it is exactly.

    Cheers,
    Phil
    Monday, September 11, 2006 8:08 AM
  • Glad it helped.  Check out WinError.h in the Platform SDK to see how error codes are structured.
    Monday, September 11, 2006 9:24 AM
    Moderator