none
While dispose the com+, encounter error: failed due to the following error: Old format or invalid type library. (Exception from HRESULT: 0x80028019 (TYPE_E_UNSUPFORMAT)). RRS feed

  • Question

  • I have web service to invoke com+ to do business layer checking. recently, the application encountered intermittently the following error while tried to dispose the com+ instance. Appreciate anyone who help for this. thanks!

     
    System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'System.IDisposable'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{805D7A98-D4AF-3F0F-967F-E5CF45312D2C}' failed due to the following error: Old format or invalid type library. (Exception from HRESULT: 0x80028019 (TYPE_E_UNSUPFORMAT)).
     
    Server stack trace:
       at System.IDisposable.Dispose()
       at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
       at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
       at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
     
    Exception rethrown at [0]:
       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
       at System.EnterpriseServices.ServicedComponent.Dispose()
       at ServiceInterface.Execute(String inputXML, String sChannelId, String sUserId, Boolean onErrorContinue)

     

    Thursday, August 26, 2010 6:23 AM

All replies

  •  

    Hi,

     

    Sorry for reply so late.

     

    The exception tells that you're trying to cast a COM wrapper object to IDisposable interface, could you provide some code snippets that brings the exception? Is it early-bound or late-bound?

     

    You can use Marshal.ReleaseComObject or Marshal.FinalReleaseComObject method to explicate decrease reference count of underlying COM object.


    Sincerely,
    Eric
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Monday, August 30, 2010 5:29 AM
  • Thank eryang for your reply,

     

    the sample code likes:

     

    1. Create a Com+ object based on ServicedComponent

     

        [JustInTimeActivation(false)]
        [ClassInterface(ClassInterfaceType.AutoDual)]
        [ObjectPooling(MinPoolSize=20, MaxPoolSize=100, CreationTimeout=1000)]
        [EventTrackingEnabled(false)]
        public class MyComObject : ServicedComponent
        {

        ....

     

            protected override void Dispose(bool disposing)
            {
                base.Dispose (disposing);
            }

        }

     

    2. A Web Service will invoke this MyComObject:

     

    MyComObject clMyCom = null

    try

    {

             clMyCom = new MyComObject ();

             clMyCom.Run();
             clMyCom.Dispose();

    }

    finally

    {

         if ( clMyCom!= null)

               clMyCom.Dispose();

    }

     

     

    Tuesday, August 31, 2010 6:55 AM
  •  

    Seems that the clMyCom object get disposed twice, which dispose operation throws the exception?

     

    By the way, you may refine your code snippet:

     

                MyComObject clMyCom = null;

     

                try

                {

                     clMyCom = new MyComObject ();

                     // clMyCom.Dispose();

                }

                finally

                {

                     if ( clMyCom!= null)

                     {

                           clMyCom.Dispose();

                           clMyCom = null;

                     }

                }


    Sincerely,
    Eric
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, September 1, 2010 1:34 AM
  • Hi Eryang,

    My mistake for sample code, it already set to null in the production. It only happened sometimes after running for a few hours while workload is heavy.

     

    MyComObject clMyCom = null

    try

    {

             clMyCom = new MyComObject ();

             clMyCom.Run();
             clMyCom.Dispose();

             clMyCom = null;

    }

    finally

    {

         if ( clMyCom!= null)

               clMyCom.Dispose();

    }

    Wednesday, September 1, 2010 2:35 AM
  • The code snippet looks well to me, could you please follow the article http://support.microsoft.com/default.aspx/kb/286350 to capture the dump file of the crashing application. After you get the dump, please let me know your email address by sending a mail to v-eryang@microsoft.com. Then I will create a file transfer workspace where you can upload your dump file. The dump will be kept confidential.


    Sincerely,
    Eric
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, September 1, 2010 6:56 AM
  • Hi Guys,

    Were you able to find root cause for this error? I am getting same in my COM+ application

     

    Thanks & regards

    Vic Vega

    • Proposed as answer by Joseph Nunes Thursday, April 26, 2012 5:09 PM
    • Unproposed as answer by Joseph Nunes Thursday, April 26, 2012 5:10 PM
    Wednesday, January 25, 2012 1:46 PM
  • Hi Vic,

    Just in case you are still looking at this, I had a similar issue. I found that this only appeared on a 64 bit Windows 7 machine, when I change the Project...Properties...build...Platform Target to x86 rather than 'ANY CPU' the app worked without any problems. 

    Joe

    Thursday, April 26, 2012 5:24 PM
  • Hi Joe,

    My project is x86. It happens all of sudden sometimes. It is happening in Win2K8 R2.

    Thanks & Regards

    VV 

    Wednesday, June 20, 2012 4:47 AM
  • Was a solution ever found to this problem?  We have a client experiencing the exact same problem but only on their production system when it’s under a heavy load.

    Tuesday, November 5, 2013 1:51 PM