[英]Application exception with windows xp
I have a C# app which works on Windows 7, but does not work on Windows XP. 我有一个在Windows 7上可以使用的C#应用程序,但是在Windows XP上却不能使用。 The program crashes when I try to close a program window.
当我尝试关闭程序窗口时,程序崩溃。 The window doesn't have any extra functions when closing, and the parent window is not waiting for any results.
该窗口在关闭时没有任何其他功能,并且父窗口没有等待任何结果。
Here is the exception: 这是例外:
System.InvalidOperationException: Collection was modified;
System.InvalidOperationException:集合已修改; enumeration operation may not execute.
枚举操作可能无法执行。
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)在System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource资源)处
at System.Collections.Generic.List1.Enumerator.MoveNextRare()
at System.Collections.Generic.List在System.Collections.Generic.List
1.Enumerator.MoveNextRare()
at System.Collections.Generic.List1.Enumerator.MoveNextRare()
at System.Collections.Generic.List1.Enumerator.MoveNextRare()
1.Enumerator.MoveNext()
at System.Collections.Generic.List1.Enumerator.MoveNextRare()
1.Enumerator.MoveNext()
at System.Collections.Generic.List
at Microsoft.VisualBasic.PowerPacks.ShapeCollection.Dispose(Boolean disposing)在Microsoft.VisualBasic.PowerPacks.ShapeCollection.Dispose(布尔处理)
at Microsoft.VisualBasic.PowerPacks.ShapeContainer.Dispose(Boolean disposing)在Microsoft.VisualBasic.PowerPacks.ShapeContainer.Dispose(布尔处理)
at System.ComponentModel.Component.Dispose()在System.ComponentModel.Component.Dispose()
at System.Windows.Forms.Control.Dispose(Boolean disposing)在System.Windows.Forms.Control.Dispose(布尔处置)
at System.Windows.Forms.Form.Dispose(Boolean disposing)在System.Windows.Forms.Form.Dispose(布尔处置)
at DataManager.EmailSettingsForm.Dispose(Boolean disposing) in c:\\Users\\PC_Jeff_1\\Desktop\\sensors_file1\\DataManagerv3.1\\EmailSettingsForm.Designer.cs:line 24在c:\\ Users \\ PC_Jeff_1 \\ Desktop \\ sensors_file1 \\ DataManagerv3.1 \\ EmailSettingsForm.Designer.cs:line 24中的DataManager.EmailSettingsForm.Dispose(布尔设置)
at System.Windows.Forms.Form.WmClose(Message& m)在System.Windows.Forms.Form.WmClose(Message&m)
at System.Windows.Forms.Form.WndProc(Message& m)在System.Windows.Forms.Form.WndProc(Message&m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)在System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)在System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)在System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd,Int32 msg,IntPtr wparam,IntPtr lparam)
I've added try block in dispose and a'm not having that issue any more, but I guess problem still is here. 我在处理中添加了try块,并且不再存在该问题,但是我想问题仍然在这里。
Block: 块:
protected override void Dispose(bool disposing)`
{
try
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
catch
{
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.