调用外部dll,外部程序捕获不了异常问题

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

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

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

            }
            catch (Exception)
            {

                throw;
            }
        }
原文地址:https://www.cnblogs.com/wxy520/p/8317012.html