Problem opening certain part/psm documents from API

Builder
Builder

Hi guys, I'm new here

 

I'm developing an app which reads the whole assembly in order to get all info needed. My app needs to open certain files from that assembly (in particular those files linked from partcopy operations, in order to read their info, since their DocumentObject is not directly available, I can just read the path from the "parent").

 

I use for that something like:

 

Try
    objLinkedDocument = CType(objDocuments.Open(strPath), SolidEdgeFramework.SolidEdgeDocument)
Catch ex As Exception
    MsgBox("Problem Opening:" & Environment.NewLine & strPath)
    objLinkedDocument = Nothing
    Debug.WriteLine(ex.Message)
End Try

Return objLinkedDocument

I have used OleMessage Filter and so, so my main sub looks like:

<STAThread()> Sub Main()

    OleMessageFilter.Register()

    'My code

    OleMessageFilter.Revoke()

End Sub

The problem is that certain files are never opened, not sure why. Also, from these files (5 in total) there's just one which ALWAYS fails, the other 4 vary from execution to execution, without changing anything. I'm working locally in my computer, with no weird stuff on paths or access to external drives...

 

The exception given by the app (error code -2147467259) reads as follows:

 

"Error no especificado (Exception from HRESULT: 0x80004005 (E_FAIL))"

 

 Truly, no idea about what happens. These files open nicely in solidedge with no errors, so I don't think they could be corrupted in any way.

 

Any ideas? Thanks in advance!