title: ObjectDisposedException - Cannot access a disposed object
body: <p>I am having some issues with my WPF Windows C# application.  Whenever the application is closed, it throws a <code>System.ObjectDisposedException</code>. The problem seems to only occur when it is compiled in 32-bit. The 64-bit build runs fine without throwing any exception.</p>
  
  <p>From the exception message, it says cannot access a disposed object but it doesn't seem to tell what object is causing the issue - How do I find out the object that has been disposed?  </p>
  
  <blockquote>
    <p>Exception:Thrown: "Cannot access a disposed object." (System.ObjectDisposedException)
    A System.ObjectDisposedException was thrown: "Cannot access a disposed object."
    Time: 1/19/2016 5:16:28 PM
    Thread:[1552]</p>
    
    <p>Exception Info: System.ObjectDisposedException
    Stack:
       at System.Diagnostics.EventLogInternal.OpenForWrite(System.String)
       at System.Diagnostics.EventLogInternal.InternalWriteEvent(UInt32, UInt16, System.Diagnostics.EventLogEntryType, System.String[], Byte[], System.String)
       at System.Diagnostics.EventLogInternal.WriteEntry(System.String, System.Diagnostics.EventLogEntryType, Int32, Int16, Byte[])
       at System.Diagnostics.EventLog.WriteEntry(System.String, System.Diagnostics.EventLogEntryType)
       at HP.HPTRIM.SDK.TrimApplicationBase.UnregisterStackTrace(System.Object, Int32)
       at HP.HPTRIM.SDK.Database.internal_Dispose()
       at HP.HPTRIM.SDK.Database.Finalize()</p>
  </blockquote>