[英]Visual Studio crashes when editing Enum property (WPF)
I have a custom control and inside it I have an Enum property: 我有一个自定义控件,并且在其中有一个Enum属性:
public enum paradigms { P300, CPS };
private paradigms _selectedParadigm = paradigms.P300;
public paradigms SelectedParadigm
{
get { return _selectedParadigm; }
set { SelectedParadigm = value; }
}
If I add this control to my window, in the properties window I can see this property and if I click on it I can see the available options (CSP and P300) but as soon as I choose one, Visual Studio crashes with no useful information. 如果我将此控件添加到窗口中,则在属性窗口中可以看到该属性,如果单击它,则可以看到可用的选项(CSP和P300),但是一旦选择一个,Visual Studio就会崩溃,并且没有有用的信息。
I tried initializing the private variable as = private paradigms _selectedParadigm = new paradigms();
我尝试将私有变量初始化为= private paradigms _selectedParadigm = new paradigms();
but it makes Visual Studio crash. 但这会使Visual Studio崩溃。
I've tried with other properties, or adding a bool, and I get a nice CheckBox that I can check and uncheck and nothing crashes. 我尝试了其他属性,或者添加了布尔值,然后我得到了一个不错的CheckBox,可以选中和取消选中它,而不会崩溃。
Any idea why Visual Studio crashes this way when using enum? 知道为什么使用枚举时Visual Studio会以这种方式崩溃吗?
Note: VS 2010 Profesional 注意:VS 2010专业版
public paradigms SelectedParadigm
{
get { return _selectedParadigm; }
set { SelectedParadigm = value; }
}
That code causes StackOverflowException
- which will bring down the process. 该代码导致StackOverflowException
这将降低进程。 Change that code to: 将该代码更改为:
public paradigms SelectedParadigm
{
get { return _selectedParadigm; }
set { _selectedParadigm = value; }
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.