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

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

 

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

            }
            catch (Exception)
            {

                throw;
            }
        }

 

相关文章: