11 Replies Latest reply on Jul 19, 2018 10:48 AM by Sean Donnelly

    Error Casting IEdmBatchChangeState4 because QueryInterface call on the COM component failed

    Sean Donnelly

      My error and code can be seen below.

       

      It fails on the line "BatchChanger = (IEdmBatchChangeState4)vault...

       

      Some key pieces of information are that I have a standalone application running a background worker. The Form1 is running a background worker that kicks off a new Class instance where the code below is. It picks up many other PDM code such as get, open, add, check out (although i have to use the original unlock IEdm because the unlock2 causes a similar error to this). Any thoughts?

       

      IEdmVault13 vault;
                  IEdmBatchChangeState4 batchChanger;
      
      
                  vault = (IEdmVault13)new EdmVault5();
      
      
                  if (!vault.IsLoggedIn)
                  {
                      vault.LoginAuto("MyVault", 0);
                  }
      
      
                  batchChanger = (IEdmBatchChangeState4)vault.CreateUtility(EdmUtility.EdmUtil_BatchChangeState);
      

       

      System.InvalidCastException

        HResult=0x80004002

        Message=Unable to cast COM object of type 'System.__ComObject' to interface type 'EPDM.Interop.epdm.IEdmBatchChangeState4'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{5009FB4B-4AEB-4808-99CD-75A92430DBD4}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

        Source=PDM_Mass_Tool

        StackTrace:

         at PDM_Mass_Tool.ItemObsolete..ctor(DataTable importTable, String user, String department, String errorMsg, LogFile log, BackgroundWorker bw) in \\fplfile2\u\sdonnelly\C# Projects\PDM Mass Tool\PDM Mass Tool\ItemObsolete.cs:line 57

         at PDM_Mass_Tool.frm5_Execute.backgrndWrk_DoWork(Object sender, DoWorkEventArgs e) in \\fplfile2\u\sdonnelly\C# Projects\PDM Mass Tool\PDM Mass Tool\frm5_Execute.cs:line 297

         at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)

         at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)