【发布时间】:2014-01-27 19:35:49
【问题描述】:
今天我开始上课了。我创建了一些类来让我的MainWindow.xmal.cs 更小一些。创建第一个类并调试后,我收到以下错误消息:
在 mscorlib.dll aufgetreten 中存在类型“System.StackOverflowException”。
在 APPLICATION.exe aufgetreten 中存在类型“System.StackOverflowException”。
class Sprachpaket_ENG_Template01
{
MainWindow MW = new MainWindow();
public void Template01()
{
MW.checkBox_1_Bcc.Content = "Bcc:";
MW.checkBox_1_Cc.Content = "Cc:";
}
--> 这会导致错误:MainWindow MW = new MainWindow();
【问题讨论】:
-
错误在 //... 代码中
-
造成这种情况的最佳方法是
public int Foo { get { return Foo; } },所以也许可以寻找类似的东西。 -
具体在哪里?这只是一些更多的任务,比如...... MI_04.Header = CHN_MT.MenuitemTitel_04; ...等等。
-
@Exception 您现在希望有人真正猜测错误所在行的样子吗? :|显示相关代码和堆栈跟踪。顺便说一句。 - 尝试自己阅读,错误应该很明显。
-
您发布的代码不会导致异常。您的应用程序中可能存在无限递归的代码。
标签: c# stack-overflow