COMException When Calling SaveAs Through .NET


Jason, et al.,


I am getting the following error intermittently (~10% of the time) when calling SaveAs, specifying a .jt filename:


System.Runtime.InteropServices.COMException (0x80010105): The server threw an exception.  (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))


The calls are made to a dll running as a service on a Windows 2003 server.  The code is written in VB for .NET 2.0.  I am interacting with Solid Edge via VB .NET as follows:


Start Solid Edge:


    Dim oSEType As System.Type = Type.GetTypeFromProgID("SolidEdge.Application"

    c_SolidEdgeApp = Activator.CreateInstance(oSEType)


    With c_SolidEdgeApp

        .Visible = False

        .DisplayAlerts = False

        .Interactive = False

        .ScreenUpdating = False

    End With


Open Solid Edge assembly:


    c_SolidEdgeDoc = c_SolidEdgeApp.Documents.Open(InputFile)


Save file as JT:


    Dim SEDoc As Object = c_SolidEdgeApp.ActiveDocument



Any ideas to make this more robust?  Originally, I was just using the SePvAdp.exe standalone converter through the Process object, but, unfortunately, it does not honor the assembly occurrence property setting to hide parts in higher assemblies.




Posted by: Brent Newsom
Post date: 7/25/2007 8:57:02 AM


RE: COMException When Calling SaveAs Through .NET



That is truely odd. When it does throw an exception, is it always on the same file or it completely random? And does the SePvAdp.exe experience the same exception randomly? The only thing I'd know for you to do is to submit an IR to GTAC and see what they say. It's going to be tough for them to diagnose the problem if it's not easily reproduceable. Understandibly.


You said that the code is called inside a Windows Service .dll. Have you tried creating just an .exe and testing that way? I'm wondering if the Windows Service thing has anything to do with it. I don't think GUI COM components play well within the realm of Windows Services.


Posted by: Jason Newell
Post date: 7/29/2007 8:13:22 PM

RE: COMException When Calling SaveAs Through .NET



Thanks for your reply.


It turns out, I made a bad assumption about how my dll was being used on the server.  I have a property which controls how many JT conversions should be run before closing and restarting Solid Edge.  This code was not being called.  We now have Solid Edge closing and restarting after every conversion and the issue went away.



Posted by: Brent Newsom
Post date: 7/31/2007 5:21:27 AM