AnsweredAssumed Answered

PDME API ComException unhandled on Checkout (LockFile)

Question asked by Kent Keller on Aug 5, 2010
Latest reply on Aug 5, 2010 by Lee CS Young

On executing File.LockFile(FolderID, 0), in a large batch, sometimes my automation is interupted by what seems to be a totally bogus error:

 

System.Runtime.InteropServices.COMException was unhandled
  ErrorCode=-2147220480
  HelpLink="C:\Program Files\SolidWorks Enterprise PDM\api_gb.chm"
  Message="The Archive Server could not find the file with the specified ID."
  Source="SolidWorks Enterprise PDM"
  StackTrace:
       at EdmLib.IEdmFile8.LockFile(Int32 lParentFolderID, Int32 lParentWnd, Int32 lEdmLockFlags)
       at PDMETools.CustomPDMEAPI.CheckoutFile(IEdmFile8 PDME_File, Int32 PDME_FolderID, DateTime datAddDate) in C:\KentsVSProjects\PDMETools\PDMETools\CustomPDMEAPI.vb:line 117
       at PDMETestConsoleApp.Module1.ImportToPDME() in C:\KentsVSProjects\PDMETools\PDMETestConsoleApp\Module1.vb:line 211
       at PDMETestConsoleApp.Module1.Main() in C:\KentsVSProjects\PDMETools\PDMETestConsoleApp\Module1.vb:line 36
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:

But, I already have a valid IEdmFile8 object with a name, ID, etc.

Function CheckoutFile(ByVal PDME_File As IEdmFile8, ByVal PDME_FolderID As Integer, ByVal datAddDate As Date) As Integer
        Try
            PDME_File.LockFile(PDME_FolderID, 0)
        Catch
            If Not PDME_File.IsLocked Then
               PDME_File.LockFile(PDME_FolderID, 0) 'Error thrown here
               Return 0
            End If
        End Try
        Return 0
    End Function

 

So, what is really happening?

 

Kent

 

 

 

 

Outcomes