Application termination in debugger

J

Jörg Krause

Hi,

I've a component which seems not to terminate correctly.

In VS.NET I start a new instance to debug the component
within a simple winform application. The program is up and
running. If I hit the "Stop Debugger" icon in vs.net the process
terminates as expected.

If I close the application using "Application.Exit()" the
window disappears but the process will still be active in
task manager and the debugger doesn't stop.

I found that the dispose methods are called and the end of
the main method is reached as expected, no exception was
thrown.

The component used COM/Interop and P/Invoke, but I have had
no problems using this so far.

Has anybody any idea how to proceed from here or even how to
debug into the problem. What exactly happens (or should happen)
on Application.Exit()?

If I run the applicatin outside of VS.NET, e.g. simply double
click the exe file, it starts and terminates as expected
(it disappears immediately from task manager).

Is this a VS.NET known bug?

Thanks for your attention,

Joerg
 
T

Tian Min Huang

Hello Joerg,

Thanks for your post. As I understand, the problem you are facing is that
your application does not exit properly when it is started within VS .NET
debugger. Please correct me if there is any misunderstanding. I'd like to
share the following information with you:

Does the problem occur to other applications while debugging?

According to MSDN documentation, the method Application.Exit() stops all
running message loops on all threads and closes all windows of the
application. This method does not force the application to exit. If the
problem occurs to a specific project, I am afraid there is one thread in
your program that may not work properly.
Based on my research, I did not find a known bug regarding this issue. When
the process still remains in task manager, I suggest you to open "Debug" ->
"Processes" to attach your process and check its call stack.

I look forward to your response.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
T

Tian Min Huang

Hi Joerg,

I am currently standing by for an update from you and would like to know
how things are going there. Should you have any questions or concerns on
the recent questions/ information I've posted, please don't hesitate to let
me know directly. It's my pleasure to be of assistance.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
J

Joerg Krause

Hi,

it seems that the order of calling the base.Dispose()
method and the COM Marshaler to release memory occupied
by COM is important.

I'm not sure what really happens here, but sometimes the
COM stuff takes a little more time to beeing released and
in that situation the Studio terminates not correctly,
e.g. the designer surface appears, the process is detached
and the debugger stops, but the program is still in the
task manager present...

If the program runs without VS.NET it terminates always
as expected. May be the my program has a bug but to find
one it is important to understand exactly the debugger of
VS.NET. Is there any in-depth information available?

Thanks for your effort,

-Joerg
www.joergkrause.de
ASP.NET/.NET-WinForm Softwaredevelopment
 
S

Scot Rose [MSFT]

Even in the older VB6 this was a problem. In an .exe when it terminates the process it terminates. Boom its gone. In the IDE you are not
terminating the actual 'process' so much as the proccess space the IDE provides for the running application. Sometimes no matter how
well you 'clean up' in your code things still hang around for a little while in the IDE.

How long is the proccess still showing up in the Task manager? I assume that if you terminate the IDE it all goes away just the same as it
does if you are running the program from an .exe?

Scot Rose, MCSD
Microsoft Visual Basic Developer Support
Email : (e-mail address removed) <Remove word online. from address>

This posting is provided “AS IS”, with no warranties, and confers no rights.

Get Secure!
http://www.microsoft.com/security
http://www.microsoft.com/protect


--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top