Destructor - does it get called if the app crashes

Posted by Antonio Nakic Alfirevic on Stack Overflow See other posts from Stack Overflow or by Antonio Nakic Alfirevic
Published on 2010-03-25T10:28:44Z Indexed on 2010/03/25 10:33 UTC
Read the original article Hit count: 273

Filed under:
|
|

Does a destructor get called if the app crashes? If it's an unhandled exception I'm guessing it does, but what about more serious errors, or something like a user killing the application process?

And a few more potentially dumb questions:

  • what happens to all the objects in an app when the app exits and all finalizers have been executed - do the objects get garbage collected or are they somehow all "unloaded" with the process or appdomain?
  • is the garbage collector part of each application (runs in the same process) or is it independent?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET