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. Application.Exit() not working very well

Application.Exit() not working very well

Scheduled Pinned Locked Moved C#
questionworkspace
4 Posts 3 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.
  • J Offline
    J Offline
    J Liang
    wrote on last edited by
    #1

    Hi, I was trying to close my application but it doesn't work as the Task Manager still showing that it is running. I'd search around the Internet and tried Environment.Exit(-1), Thread.CurrentThread.Abort() but nothing works. Any idea? Thanks in advance. Jie Liang

    N A 2 Replies Last reply
    0
    • J J Liang

      Hi, I was trying to close my application but it doesn't work as the Task Manager still showing that it is running. I'd search around the Internet and tried Environment.Exit(-1), Thread.CurrentThread.Abort() but nothing works. Any idea? Thanks in advance. Jie Liang

      N Offline
      N Offline
      Nader Elshehabi
      wrote on last edited by
      #2

      Hello If your application is multithreaded -which I suspect-, Probably one of your foreground threads is still running. Either keep track of your threads and abort them on exit -or end them more gracefully if possible-, or set them to background threads so that they exit themselves upon the program termination.

      Regards:rose:

      J 1 Reply Last reply
      0
      • N Nader Elshehabi

        Hello If your application is multithreaded -which I suspect-, Probably one of your foreground threads is still running. Either keep track of your threads and abort them on exit -or end them more gracefully if possible-, or set them to background threads so that they exit themselves upon the program termination.

        Regards:rose:

        J Offline
        J Offline
        J Liang
        wrote on last edited by
        #3

        Hi :rose: Thanks, it works, the Task Manager don't show the process any more when I exit the application :) Jie Liang

        1 Reply Last reply
        0
        • J J Liang

          Hi, I was trying to close my application but it doesn't work as the Task Manager still showing that it is running. I'd search around the Internet and tried Environment.Exit(-1), Thread.CurrentThread.Abort() but nothing works. Any idea? Thanks in advance. Jie Liang

          A Offline
          A Offline
          Arjun Mjolnir Bahree
          wrote on last edited by
          #4

          Well depends on the CLR. when main returns, main still is the primary thread, but a manged thread. It will depend on whims n fancies of the CLR. CLR will take some time to reflect the thread stoppage, depending on other work it is involved in. So no need to be worried.

          Excelsior Arjun Bahree "By The Might of Mjolnir" I Came! I Coded! I Conquered!

          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