我有一个偶尔抛出此异常的应用程序:
System.ObjectDisposedException: Cannot access a disposed object.
Object name: "Panel".
bei System.Windows.Forms.Control.CreateHandle()
bei System.Windows.Forms.Control.get_Handle()
bei System.Windows.Forms.ContainerControl.FocusActiveControlInternal()
bei System.Windows.Forms.Form.set_Active(Boolean value)
bei System.Windows.Forms.Form.WmActivate(Message& m)
bei System.Windows.Forms.Form.WndProc(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Run Code Online (Sandbox Code Playgroud)
有没有办法在不触及代码的情况下理想地抑制此异常?我正在考虑一些注册表魔术或深奥的.NET配置.
此外,我当然也对捕获此异常的方法感兴趣.似乎没有钩子让我抓住这个例外...当然它不可重复......