#879 – Unhandled Exceptions in Finalizers

Like other unhandled exceptions, an exception that is thrown from a finalizer and not handled will cause your application to terminate.

~Dog()
{
    Console.WriteLine(
       "Dog finalizer is running.  I'll throw an exception and your app will terminate");
    throw new Exception("Dang it");
}
Dog d = new Dog("Kirby", 15);
d.Bark();

d = null;
GC.Collect();

879-001

Advertisements

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

One Response to #879 – Unhandled Exceptions in Finalizers

  1. Pingback: Dew Drop – July 3, 2013 (#1,578) | Alvin Ashcraft's Morning Dew

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: