Environment.HasShutdownStarted
using System; using System.Runtime.InteropServices; using System.Diagnostics; public sealed class MainClass { static void Main() { AppDomain currentDomain = AppDomain.CurrentDomain; if( !currentDomain.IsFinalizingForUnload() &&!Environment.HasShutdownStarted ) { Console.WriteLine( "Failed to dispose of object!!!" ); Console.WriteLine( "Object allocated at:" ); } } }