C# WinForm窗体没有关闭自动运行Dispose()的问题
如题,应用程序跑了几分钟到十几分钟不等,一点概率出现主窗体被Dispse()掉了,程序没有显示调用关闭之类的代码,也没有关闭窗体,突然到Application.Run(new Form())这里抛出异常:
static class Program { private const int WS_SHOWNORMAL = 1; private const int SW_RESTORE = 9; /// <summary> /// 应用程序的主入口点。 /// </summary> [STAThread] static void Main() { //获取正在运行的进程 Process instance = RunningInstance(); if (instance == null) { DevExpress.UserSkins.BonusSkins.Register(); DevExpress.UserSkins.OfficeSkins.Register(); DevExpress.Skins.SkinManager.EnableFormSkins(); DevExpress.Skins.SkinManager.EnableMdiFormSkins(); // DevExpress.LookAndFeel.UserLookAndFeel.Default.SkinName = "Blue"; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(MainForm.Instance); } else { HandleRunningInstance(instance); } }
DevExpress.UserSkins.BonusSkins.Register(); DevExpress.UserSkins.OfficeSkins.Register(); DevExpress.Skins.SkinManager.EnableFormSkins(); DevExpress.Skins.SkinManager.EnableMdiFormSkins();
[解决办法]
devexpress官方的解释:
A similar problem was fixed in the AccessViolationException occurs when using 24x24 Icons for toolbar images bug report. However, from the report's Version field, I see that you are already using the latest version