方法中调用了其它dll没有做异常捕获的处理的方法,即使在本代码用使用try,cath做异常捕获,这样也捕获不了,

此时需要在本方法头上使用如下引用即可捕获到异常:

 

 [System.Runtime.ExceptionServices.HandleProcessCorruptedStateExceptions]
        [System.Security.SecurityCritical]
        public void test()
        {
            try
            {

            }
            catch (Exception)
            {

                throw;
            }
        }

 

相关文章:

  • 2022-12-23
  • 2021-12-19
  • 2021-05-17
  • 2021-07-28
  • 2022-01-01
  • 2021-07-24
  • 2021-08-10
  • 2022-01-30
猜你喜欢
  • 2022-01-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案