[英]How to prevent the "System.StackOverFlowException" exception being thrown when i run my WPF MVVM application?
我试图向我的应用程序添加一个功能,它在单击按钮后保存文本框中的值。 它抛出了上面所说的异常,我找不到它的原因。 这是项目的链接 <github.com/lovelygentleman/TacticalSimInstaller>。 有人介意看看它并找出问题所在吗?
该代码最初没有编译,因为saab2ViewModel
似乎丢失了。 但是,如果注释掉任何使用saab2ViewModel
的代码,它将编译。
注释掉以下内容:
主视图模型.cs
...
//public saab2ViewModel Saab2VM { get; set; }
...
//Saab2VM = new saab2ViewModel();
...
//Saab2ViewCommand = new RelayCommand(o =>
//{
// CurrentView = Saab2VM;
//});
...
编译后,在执行时,会收到以下错误An unhandled exception of type 'System.StackOverflowException' occurred...
可以通过进行以下修改来修复:
在welcomeViewModel.cs中,您有:
class welcomeViewModel : MainViewModel
{
}
改成:
class welcomeViewModel
{
}
它会运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.