Application.Quit Crash Solid Edge ST4 sometiomes

Valued Contributor
Valued Contributor

Hi, 

 

I am using Solid Edge ST4. I find that calling Application.Quit() sometimes crashes the application 'Silently'.

 

I say 'Silently' here because the application seems to be terminated normally, but an Error Report is written to ...\AppData\Local\Microsoft\Windows\WER.

 

The Error Report is about 200+MB, depends on the memory usage of Solid Edge. Does anyone know this problem? How to solve it professionally?

All I have done is starting Solid Edge - DoIdle - Quit, and repeated it ten times. 3~7/10 crashed.

Thanks,
Guan

5 REPLIES

Re: Application.Quit Crash Solid Edge ST4 sometiomes

Valued Contributor
Valued Contributor
I have done some experiments on Quit.
My finding is:
1) I have to retain a reference to call Quit() in my client application, and
2) The retained the reference cause SE crash.

Set objApp = NULL after objApp->Quit() is with no help.

This situation recalls me about the Document Close method...

Re: Application.Quit Crash Solid Edge ST4 sometiomes

Valued Contributor
Valued Contributor

Hi, myself,

 

You could try to post WM_ClOSE message to Solid Edge to quit.

It works for me.

 

Guan

Re: Application.Quit Crash Solid Edge ST4 sometiomes

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

I would be interested in looking into this if you could provide some sample code that you're using to test with.

Jason Newell
Applications Architect
www.jasonnewell.net

Re: Application.Quit Crash Solid Edge ST4 sometiomes

Valued Contributor
Valued Contributor

 Hi, @jnewell

 

Dim objApplication As SolidEdgeFramework.Application = Nothing
Dim objType As Type = Nothing

objType = Type.GetTypeFromProgID("SolidEdge.Application")

For i As Integer = 1 To 10
    objApplication = Activator.CreateInstance(objType)
    objApplication.Visible = True
    objApplication.DoIdle()

    objApplication.Quit()
    System.Runtime.InteropServices.Marshal.FinalReleaseComObject(objApplication)
Next

Another one replaces

System.Runtime.InteropServices.Marshal.FinalReleaseComObject(objApplication)

with

System.Runtime.InteropServices.Marshal.ReleaseComObject(objApplication)

 

And the last one removes the 'releasing' code:

System.Runtime.InteropServices.Marshal.

The first and second both crash Solid Edge. The last one seems to work.

 

Guan

Re: Application.Quit Crash Solid Edge ST4 sometiomes

Valued Contributor
Valued Contributor

Hi, @jnewell

 

Sorry, I missed an important information: the crash happens when I close my application and quit Solid Edge in FormClosed event.

 

The following is some example codes:

 

Dim objApplication As SolidEdgeFramework.Application = Nothing

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim objType As Type = Nothing objType = Type.GetTypeFromProgID("SolidEdge.Application") objApplication = Activator.CreateInstance(objType) objApplication.Visible = True objApplication.DoIdle() End Sub

And

 

Private Sub Form1_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
        objApplication.Quit()
End Sub

The crash reports are written to C:\Users\[UserName]\AppData\Local\Microsoft\Windows\WER\ReportQueue.

 

 

 

Thank you @jnewell

 

Guan