现在来看WPF里的另外一个BUG
新建一个任意(非asp.net)项目,并且添加Microsoft.ReportViewer.Common、Microsoft.ReportViewer.WinForms、System.Windows.Forms 和PresentationFramework 程序集。
Program.cs写入如下代码:
{
class Program
{
static void Main( string [] args)
{
System.Windows.Markup.XamlWriter.Save( new Microsoft.Reporting.WinForms.ReportViewer());
}
}
}
运行后一样的抛出“StackOverflowException”。
如果加上try...catch...语句,效果是一样的,无法捕获到异常。只会在Console得到
如果说这是non-CLSCompliant exceptions那么我们可以配置开启legacyCorruptedStateExceptionsPolicy。
< configuration >
< runtime >
< legacyCorruptedStateExceptionsPolicy enabled ="true" />
</ runtime >
</ configuration >
开启后一样会“StackOverflowException”。
至于这是什么状况导致开启了 legacyCorruptedStateExceptionsPolicy 也无法捕获到这个异常,希望有朋友能够帮助大家解答。
或者,这本身就是微软 .NET 框架的 BUG ?
本文探讨了在WPF项目中使用ReportViewer组件时遇到的一个StackOverflowException异常问题。即使启用了legacyCorruptedStateExceptionsPolicy配置,该异常也无法被捕获。
783

被折叠的 条评论
为什么被折叠?



