如何捕获和处理 StackOverflowException
yyw84 2006-03-21 02:03:34
我通过GridView绑定DataSet,想让GridView支持排序功能,可是在执行Sorting事件绑定的方法时抛出StackOverflowException异常,通过try...catch竟也无法捕获到,我的代码如下:
截图: http://img296.photo.163.com/yangyanwu84/9200290/986720333.jpg
try
{
((GridView)sender).Sort(e.SortExpression, e.SortDirection); // 未处理的“System.StackOverflowException”类型的异常出现在 System.Web.dll 中。
}
catch (StackOverflowException ex)
{
Message.Show(this.Page, string.Format("StackOverflowException: {0}", ex.Message));
}
catch (SystemException ex)
{
Message.Show(this.Page, string.Format("SystemException: {0}", ex.Message));
}
catch (Exception ex)
{
Message.Show(this.Page, string.Format("Exception:{0}", ex.Message));
}
catch
{
Message.Show(this.Page, "UnKnowException");
}