Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. My application stays alive in the process list after closing T-T

My application stays alive in the process list after closing T-T

Scheduled Pinned Locked Moved C#
helpquestion
10 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AesopTurtle
    wrote on last edited by
    #1

    Hi, there I've created a window application consisting of one form, one user control, and 3 classes. After building it, I tried running the exe file directly and it worked fine. However, when I closed my application, the application form was closed correctly but it still stayed in the process list (seen from the window task manager). When I tried running it again, another process of the same name appeared in the process list. Running it multiple times brought up multiple processes. I believe that's because the application is not really terminated. I also made sure that all instances of the classes are disposed by inheriting them from IDisposable and calling GC.SuppressFinalize(this) in the Dispose() method. Anyone got any idea about this? Please help me fix it or my application will eat up all the user's resources. T-T Thank you very much. KiT

    M B S A T 5 Replies Last reply
    0
    • A AesopTurtle

      Hi, there I've created a window application consisting of one form, one user control, and 3 classes. After building it, I tried running the exe file directly and it worked fine. However, when I closed my application, the application form was closed correctly but it still stayed in the process list (seen from the window task manager). When I tried running it again, another process of the same name appeared in the process list. Running it multiple times brought up multiple processes. I believe that's because the application is not really terminated. I also made sure that all instances of the classes are disposed by inheriting them from IDisposable and calling GC.SuppressFinalize(this) in the Dispose() method. Anyone got any idea about this? Please help me fix it or my application will eat up all the user's resources. T-T Thank you very much. KiT

      M Offline
      M Offline
      mikone
      wrote on last edited by
      #2

      which IDE are you using? vc# 2005 express does start a ApplicationName.vhost.exe when opening the solution and restarts the process if you kill it manually - try to kill it manually and check if it is started again :P

      A 1 Reply Last reply
      0
      • A AesopTurtle

        Hi, there I've created a window application consisting of one form, one user control, and 3 classes. After building it, I tried running the exe file directly and it worked fine. However, when I closed my application, the application form was closed correctly but it still stayed in the process list (seen from the window task manager). When I tried running it again, another process of the same name appeared in the process list. Running it multiple times brought up multiple processes. I believe that's because the application is not really terminated. I also made sure that all instances of the classes are disposed by inheriting them from IDisposable and calling GC.SuppressFinalize(this) in the Dispose() method. Anyone got any idea about this? Please help me fix it or my application will eat up all the user's resources. T-T Thank you very much. KiT

        B Offline
        B Offline
        Bekjong
        wrote on last edited by
        #3

        Hi, The reason you're probably having this is because you're calling GC.SuppressFinalize(this). From msdn: GC.SuppressFinalize Method Objects that implement the IDisposable interface can call this method from the IDisposable.Dispose method to prevent the garbage collector from calling Object.Finalize on an object that does not require it. I'd advice against implementing IDisposable if you aren't using unmanaged resources or threads anyway, the garbage collection usually handles itself quite well anyway. Good luck!

        A 1 Reply Last reply
        0
        • A AesopTurtle

          Hi, there I've created a window application consisting of one form, one user control, and 3 classes. After building it, I tried running the exe file directly and it worked fine. However, when I closed my application, the application form was closed correctly but it still stayed in the process list (seen from the window task manager). When I tried running it again, another process of the same name appeared in the process list. Running it multiple times brought up multiple processes. I believe that's because the application is not really terminated. I also made sure that all instances of the classes are disposed by inheriting them from IDisposable and calling GC.SuppressFinalize(this) in the Dispose() method. Anyone got any idea about this? Please help me fix it or my application will eat up all the user's resources. T-T Thank you very much. KiT

          S Offline
          S Offline
          S Senthil Kumar
          wrote on last edited by
          #4

          Are you creating any threads by yourself? If true, you need to set the IsBackground[^] property of those threads to <code>true</code>. Otherwise, those threads will remain alive and will prevent your process from dying.

          Regards Senthil [MVP - Visual C#] _____________________________ My Blog | My Articles | WinMacro

          1 Reply Last reply
          0
          • A AesopTurtle

            Hi, there I've created a window application consisting of one form, one user control, and 3 classes. After building it, I tried running the exe file directly and it worked fine. However, when I closed my application, the application form was closed correctly but it still stayed in the process list (seen from the window task manager). When I tried running it again, another process of the same name appeared in the process list. Running it multiple times brought up multiple processes. I believe that's because the application is not really terminated. I also made sure that all instances of the classes are disposed by inheriting them from IDisposable and calling GC.SuppressFinalize(this) in the Dispose() method. Anyone got any idea about this? Please help me fix it or my application will eat up all the user's resources. T-T Thank you very much. KiT

            A Offline
            A Offline
            Amar Chaudhary
            wrote on last edited by
            #5

            did you tried application.end this usually happens when you call some form from another form and just hide the base form or some thread in back ground is still working it will be a better option to debug your application :):)

            It is Good to be Important but! it is more Important to be Good

            A 1 Reply Last reply
            0
            • B Bekjong

              Hi, The reason you're probably having this is because you're calling GC.SuppressFinalize(this). From msdn: GC.SuppressFinalize Method Objects that implement the IDisposable interface can call this method from the IDisposable.Dispose method to prevent the garbage collector from calling Object.Finalize on an object that does not require it. I'd advice against implementing IDisposable if you aren't using unmanaged resources or threads anyway, the garbage collection usually handles itself quite well anyway. Good luck!

              A Offline
              A Offline
              AesopTurtle
              wrote on last edited by
              #6

              I've tried removing all the implementation of IDisposable. However, it doesn't solve the problem. Thank you very much. KiT

              1 Reply Last reply
              0
              • M mikone

                which IDE are you using? vc# 2005 express does start a ApplicationName.vhost.exe when opening the solution and restarts the process if you kill it manually - try to kill it manually and check if it is started again :P

                A Offline
                A Offline
                AesopTurtle
                wrote on last edited by
                #7

                I'm using VS2005 and it does start AppName.vhost.exe. Killing each process can really terminate the app. However, that's what I need to solve: not to have to end it manually. Thank you very much. KiT

                1 Reply Last reply
                0
                • A Amar Chaudhary

                  did you tried application.end this usually happens when you call some form from another form and just hide the base form or some thread in back ground is still working it will be a better option to debug your application :):)

                  It is Good to be Important but! it is more Important to be Good

                  A Offline
                  A Offline
                  AesopTurtle
                  wrote on last edited by
                  #8

                  I have only one form and not calling any other forms. But I do calling some classes and a user control. Where to set Application.end? Thank you very much. KiT

                  A 1 Reply Last reply
                  0
                  • A AesopTurtle

                    I have only one form and not calling any other forms. But I do calling some classes and a user control. Where to set Application.end? Thank you very much. KiT

                    A Offline
                    A Offline
                    Amar Chaudhary
                    wrote on last edited by
                    #9

                    at formclosing event or where ever you want to close your app :):)

                    It is Good to be Important but! it is more Important to be Good

                    1 Reply Last reply
                    0
                    • A AesopTurtle

                      Hi, there I've created a window application consisting of one form, one user control, and 3 classes. After building it, I tried running the exe file directly and it worked fine. However, when I closed my application, the application form was closed correctly but it still stayed in the process list (seen from the window task manager). When I tried running it again, another process of the same name appeared in the process list. Running it multiple times brought up multiple processes. I believe that's because the application is not really terminated. I also made sure that all instances of the classes are disposed by inheriting them from IDisposable and calling GC.SuppressFinalize(this) in the Dispose() method. Anyone got any idea about this? Please help me fix it or my application will eat up all the user's resources. T-T Thank you very much. KiT

                      T Offline
                      T Offline
                      Tim Almdal
                      wrote on last edited by
                      #10

                      I've run into similiar circumstances. I have the forms running on seperate threads and I also have a thread running a formless message loop. When the form closed, the application didn't shutdown because the other thread was still running. Try calling Application.Exit() when the form closes. It's probably not that simple, but I'd thought I'd pass on my 2-cents worth.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups