Form.IsDisposed, Application.ThreadException 统统无用,还是要 try 大法 否则在线程中访问已经关闭的窗口还是有可能会说无法访问已经释放和对象.

不过 Application.ThreadException 这样的是不是要在每个线程中都设置?

            if ((parentForm != null) && (OnReviceResponse_windows_action != null) && (parentForm.IsDisposed == false))
            //if ((parentForm != null) && (OnReviceResponse_windows_action != null) && (parentForm.IsAccessible != false))
            {
                try//避免无法访问已释放对象错误
                {
                    parentForm.Invoke(OnReviceResponse_windows_action, response);
                }
                catch (System.Exception e)
                {
                    //MessageBox.Show("test catch");
                }
                
            }

相关文章:

  • 2021-07-05
  • 2022-12-23
  • 2021-05-29
  • 2021-11-07
  • 2022-12-23
  • 2021-12-25
  • 2021-04-06
  • 2022-01-11
猜你喜欢
  • 2022-12-23
  • 2021-08-13
  • 2022-12-23
  • 2021-09-17
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案