Hi

I have a winform app. When this app is closed it remains under 'Processes'
in Task Manager. What is the problem and how can I ensure that app closes
completely and releases all resources?

Thanks

Regards

RE: App remains in processes by surturz

surturz
Tue Jul 22 00:47:00 CDT 2008

Use the "End" keyword.
--
David Streeter
Synchrotech Software
Sydney Australia


"John" wrote:

> Hi
>
> I have a winform app. When this app is closed it remains under 'Processes'
> in Task Manager. What is the problem and how can I ensure that app closes
> completely and releases all resources?
>
> Thanks
>
> Regards
>
>
>

Re: App remains in processes by Ken

Ken
Tue Jul 22 01:00:10 CDT 2008

On Tue, 22 Jul 2008 04:47:03 +0100, John wrote:

> I have a winform app. When this app is closed it remains under
> 'Processes' in Task Manager. What is the problem and how can I ensure
> that app closes completely and releases all resources?

I had that problem when I had a thread that monitored a port for incoming
data. I added 'Environment.Exit(0);' to Program.cs to close off any
threads.

Ken


Re: App remains in processes by John

John
Tue Jul 22 01:01:42 CDT 2008

Hi

I am closing the app by clicking the cross on the top right corner of the
main window. Where should I use End?

Thanks

Regards

"SurturZ" <surturz@newsgroup.nospam> wrote in message
news:3267A48E-9B2A-45D0-A4E8-B2E67D6CE0DC@microsoft.com...
> Use the "End" keyword.
> --
> David Streeter
> Synchrotech Software
> Sydney Australia
>
>
> "John" wrote:
>
>> Hi
>>
>> I have a winform app. When this app is closed it remains under
>> 'Processes'
>> in Task Manager. What is the problem and how can I ensure that app closes
>> completely and releases all resources?
>>
>> Thanks
>>
>> Regards
>>
>>
>>



Re: App remains in processes by Patrice

Patrice
Tue Jul 22 03:53:40 CDT 2008

It's likely that your application is kept alive. Instead of forcing the
application to quit my personal preference would be likely to find out what
keeps the app aliave and to perform the appropriate cleanup... See what
could keep a reference to your app such as perhaps a callback to would be
kept by the system...

--
Patrice

"John" <info@nospam.infovis.co.uk> a écrit dans le message de groupe de
discussion : #yGrb266IHA.392@TK2MSFTNGP03.phx.gbl...
> Hi
>
> I have a winform app. When this app is closed it remains under 'Processes'
> in Task Manager. What is the problem and how can I ensure that app closes
> completely and releases all resources?
>
> Thanks
>
> Regards
>


Re: App remains in processes by John

John
Tue Jul 22 04:15:30 CDT 2008

Its just a winform app that runs a series of queries on an access backend
database. Can't think of anything special.

Thanks

Regards

"Patrice" <http://www.chez.com/scribe/> wrote in message
news:uEYvxh96IHA.1200@TK2MSFTNGP04.phx.gbl...
> It's likely that your application is kept alive. Instead of forcing the
> application to quit my personal preference would be likely to find out
> what keeps the app aliave and to perform the appropriate cleanup... See
> what could keep a reference to your app such as perhaps a callback to
> would be kept by the system...
>
> --
> Patrice
>
> "John" <info@nospam.infovis.co.uk> a écrit dans le message de groupe de
> discussion : #yGrb266IHA.392@TK2MSFTNGP03.phx.gbl...
>> Hi
>>
>> I have a winform app. When this app is closed it remains under
>> 'Processes' in Task Manager. What is the problem and how can I ensure
>> that app closes completely and releases all resources?
>>
>> Thanks
>>
>> Regards
>>
>



Re: App remains in processes by Cor

Cor
Tue Jul 22 05:41:58 CDT 2008

John,

Never use End, it kills an application and you get unpredictable results,
that the taskmanager does not show direct the end of a program is a
behaviour of Windows OS.

Cor

"John" <info@nospam.infovis.co.uk> schreef in bericht
news:OPgMrB86IHA.2336@TK2MSFTNGP03.phx.gbl...
> Hi
>
> I am closing the app by clicking the cross on the top right corner of the
> main window. Where should I use End?
>
> Thanks
>
> Regards
>
> "SurturZ" <surturz@newsgroup.nospam> wrote in message
> news:3267A48E-9B2A-45D0-A4E8-B2E67D6CE0DC@microsoft.com...
>> Use the "End" keyword.
>> --
>> David Streeter
>> Synchrotech Software
>> Sydney Australia
>>
>>
>> "John" wrote:
>>
>>> Hi
>>>
>>> I have a winform app. When this app is closed it remains under
>>> 'Processes'
>>> in Task Manager. What is the problem and how can I ensure that app
>>> closes
>>> completely and releases all resources?
>>>
>>> Thanks
>>>
>>> Regards
>>>
>>>
>>>
>
>


Re: App remains in processes by CiaranODonnell

CiaranODonnell
Tue Jul 22 10:24:01 CDT 2008

Try attaching a debugger to it with the solution loaded and pausing the
application, on the 'Debug Location' toolbar, look at each of the threads in
turn and see if the code they are executing gives you any clues. It might be
on a blocking call to something.


--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com


"John" wrote:

> Its just a winform app that runs a series of queries on an access backend
> database. Can't think of anything special.
>
> Thanks
>
> Regards
>
> "Patrice" <http://www.chez.com/scribe/> wrote in message
> news:uEYvxh96IHA.1200@TK2MSFTNGP04.phx.gbl...
> > It's likely that your application is kept alive. Instead of forcing the
> > application to quit my personal preference would be likely to find out
> > what keeps the app aliave and to perform the appropriate cleanup... See
> > what could keep a reference to your app such as perhaps a callback to
> > would be kept by the system...
> >
> > --
> > Patrice
> >
> > "John" <info@nospam.infovis.co.uk> a écrit dans le message de groupe de
> > discussion : #yGrb266IHA.392@TK2MSFTNGP03.phx.gbl...
> >> Hi
> >>
> >> I have a winform app. When this app is closed it remains under
> >> 'Processes' in Task Manager. What is the problem and how can I ensure
> >> that app closes completely and releases all resources?
> >>
> >> Thanks
> >>
> >> Regards
> >>
> >
>
>
>

Re: App remains in processes by Tom

Tom
Tue Jul 22 10:58:33 CDT 2008

On 2008-07-22, John <info@nospam.infovis.co.uk> wrote:
> Its just a winform app that runs a series of queries on an access backend
> database. Can't think of anything special.
>
> Thanks
>
> Regards
>

Are the queries run async or in a background thread?

--
Tom Shelton

Re: App remains in processes by PetterL

PetterL
Tue Jul 22 13:34:31 CDT 2008

I had the same problem in one of my programs. It also queries a SQL
database.
I found out since i did not close the connection, the program was still
running.

PetterL.
"Tom Shelton" <tom_shelton@comcastXXXXXXX.net> wrote in message
news:KPSdned0KPU0nhvVnZ2dnUVZ_uSdnZ2d@comcast.com...
> On 2008-07-22, John <info@nospam.infovis.co.uk> wrote:
>> Its just a winform app that runs a series of queries on an access backend
>> database. Can't think of anything special.
>>
>> Thanks
>>
>> Regards
>>
>
> Are the queries run async or in a background thread?
>
> --
> Tom Shelton



Re: App remains in processes by kimiraikkonen

kimiraikkonen
Tue Jul 22 15:05:55 CDT 2008

On Jul 22, 6:47 am, "John" <i...@nospam.infovis.co.uk> wrote:
> Hi
>
> I have a winform app. When this app is closed it remains under 'Processes=
'
> in Task Manager. What is the problem and how can I ensure that app closes
> completely and releases all resources?
>
> Thanks
>
> Regards

Hi,
There may be several reasons, for example, if your application is
alive and uses notify control, you need to close it from notification
icon by assigning a contextmenu control by adding "me.close" to one of
its items. You can also make notfifyicon usable by putting code on
form's load:

NotifyIcon1.Icon =3D Me.Icon

Also, if your application contains some "hidden" forms which are
previously hidden though you think you've exited, your application is
supposed to be still alive as background process, and you need to
close hidden form with "close" method gently.

Additionaly, your application may remain alive if it interops with
other assemblies or processes during its lifetime depending on your
application's references.

Finally, make sure you're disposing all resources using with "Using"
statement if one of your application's classes use an IDisposable
object.

Hope this helps,

Onur G=FCzel

Re: App remains in processes by John

John
Wed Jul 23 00:42:20 CDT 2008

Queries run in the main thread/app in sequence, nothing special such as
threading in there.

Thanks

Regards

"Tom Shelton" <tom_shelton@comcastXXXXXXX.net> wrote in message
news:KPSdned0KPU0nhvVnZ2dnUVZ_uSdnZ2d@comcast.com...
> On 2008-07-22, John <info@nospam.infovis.co.uk> wrote:
>> Its just a winform app that runs a series of queries on an access backend
>> database. Can't think of anything special.
>>
>> Thanks
>>
>> Regards
>>
>
> Are the queries run async or in a background thread?
>
> --
> Tom Shelton



Re: App remains in processes by PetterL

PetterL
Wed Jul 23 15:43:50 CDT 2008

I have no threading in my app as well. But if you not close all connections
to the database before you close. The program will not end.complitly.

Here is what i put in my Form_close event
Me.STATIONTableAdapter.Connection.Close() 'close the adapter that has
the connection.to <SQL server
LoginForm2.Close() 'Closing the login form. This is a Custom login i
have made for my program.

"John" <info@nospam.infovis.co.uk> wrote in message
news:%23WG4fbI7IHA.1196@TK2MSFTNGP05.phx.gbl...
> Queries run in the main thread/app in sequence, nothing special such as
> threading in there.
>
> Thanks
>
> Regards
>
> "Tom Shelton" <tom_shelton@comcastXXXXXXX.net> wrote in message
> news:KPSdned0KPU0nhvVnZ2dnUVZ_uSdnZ2d@comcast.com...
>> On 2008-07-22, John <info@nospam.infovis.co.uk> wrote:
>>> Its just a winform app that runs a series of queries on an access
>>> backend
>>> database. Can't think of anything special.
>>>
>>> Thanks
>>>
>>> Regards
>>>
>>
>> Are the queries run async or in a background thread?
>>
>> --
>> Tom Shelton
>
>



Re: App remains in processes by surturz

surturz
Wed Jul 23 23:43:01 CDT 2008

Right you are, Application.Exit is better than End.

Microsoft continues its grand tradition of obliterating the usefulness of
any keyword that was part of ANSI BASIC, I see >:-{

(Besides DIM, GOTO, FOR-NEXT, and IF-THEN, are there any left??)

To John - put Application.Exit in the Form.FormClosed event of your main
form. You are better off if you clear out all global and module level
variables first. So if you have anything with a .Dispose method, call that
first. Setting all your global and module level variables to Nothing wouldn't
hurt either.

Ideally, you shouldn't need to use Application.Exit. If you dispose of all
your variables correctly, the application should just end when the main form
is closed.

--
David Streeter
Synchrotech Software
Sydney Australia


"Cor Ligthert[MVP]" wrote:

> John,
>
> Never use End, it kills an application and you get unpredictable results,
> that the taskmanager does not show direct the end of a program is a
> behaviour of Windows OS.
>
> Cor
>
> "John" <info@nospam.infovis.co.uk> schreef in bericht
> news:OPgMrB86IHA.2336@TK2MSFTNGP03.phx.gbl...
> > Hi
> >
> > I am closing the app by clicking the cross on the top right corner of the
> > main window. Where should I use End?
> >
> > Thanks
> >
> > Regards
> >
> > "SurturZ" <surturz@newsgroup.nospam> wrote in message
> > news:3267A48E-9B2A-45D0-A4E8-B2E67D6CE0DC@microsoft.com...
> >> Use the "End" keyword.
> >> --
> >> David Streeter
> >> Synchrotech Software
> >> Sydney Australia
> >>
> >>
> >> "John" wrote:
> >>
> >>> Hi
> >>>
> >>> I have a winform app. When this app is closed it remains under
> >>> 'Processes'
> >>> in Task Manager. What is the problem and how can I ensure that app
> >>> closes
> >>> completely and releases all resources?
> >>>
> >>> Thanks
> >>>
> >>> Regards
> >>>
> >>>
> >>>
> >
> >
>