In my application, I'm seeing that at times the Dispose method on my main form gets called for apparently no reason. I'm not closing the app through the UI, I'm not sending a close windows message or calling Close() anywhere, however the Dispose method still gets called. Here is the call stack:
Bitter.Shell.exe!Bitter.Shell.MainForm.Dispose(bool disposing = true) Line 853 C#
System.dll!System.ComponentModel.Component.Dispose() + 0x12 bytes
System.Windows.Forms.dll!System.Windows.Forms.ApplicationContext.Dispose(bool disposing) + 0x35 bytes
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.DisposeThreadWindows() + 0x33 bytes
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.Dispose(bool postQuit) + 0xf8 bytes
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(int reason = -1, System.Windows.Forms.ApplicationContext context = {System.Windows.Forms.ApplicationContext}) + 0x276 bytes
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoop(int reason, System.Windows.Forms.ApplicationContext context) + 0x61 bytes
System.Windows.Forms.dll!System.Windows.Forms.Application.Run(System.Windows.Forms.Form mainForm) + 0x31 bytes
Bitter.Shell.exe!Bitter.Shell.Program.Main() Line 105 + 0x26 bytes C#
Would the CLR call it if memory was low in attempt to clean up? I know that Windows Mobile does that very thing, but didn't think that happened in the desktop world. Anyone know why this might get called?
EDIT: After a reboot, I no longer see this issue. So it seems like it was somehow due to the state of my system at the time. Either way, the cause should still be identifiable.