VS Designer总是抛出异常"x属性没有get/set方法"

Ser*_*694 6 c# wpf windows-runtime visual-studio-2013 windows-phone-8.1

我遇到了VS Designer的这个问题,无法使用它.它发生的是我正在编辑我的XAML代码,VS Designer会在某些时候抛出异常,使用如下的StackTrace:

InvalidOperationException:属性"MyObject.MyProperty"没有get方法

堆栈跟踪:

at Microsoft.Expression.DesignModel.Metadata.ClotProperty.Exign.GetVolue.Metadata.LetClpertProperty.PeritMetl.MetadataMetl上的Microsoft.Expression.DesignModel.Metadata.ClrPropertyRempleStep.GetValue(Object valueToInspect)中的Microsoft.Expression.DesignModel.Metadata.LocalClrPropertyImplementation.GetValue(Object target).对象&值,ReferenceStep referenceStep在[...]的Microsoft.Expression.DesignModel.Metadata.PropertyReference.PartialGetValue(对象目标,Int32 initialStepIndex,Int32 finalStepIndex)上的,对象目标)

...至少还有50行.

有问题的财产是这样的:

private bool _MyProperty = true;

public bool MyProperty
{
    set
    {
        if (_MyProperty != value)
        {
            // Do a few things here
            this._MyProperty = value;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

现在,这很好用,我的项目中有很多这样的东西,VS以前从未打扰过我.如果我再次尝试关闭并打开VS,它会让我工作一段时间,然后它最终会再次开始抛出这个错误.

我尝试从编译>清洁解决方案清理解决方案,它不起作用.

我真的不知道这里有什么问题.我的意思是,我在2个月前创建了这个属性,为什么VS现在只告诉我?

有没有修复此问题,或者我是否必须在我创建的每个参数中手动添加所有这些无用的get/set方法?

LIU*_*YUE 1

我认为这很明显,根据您的错误消息:“属性“MyObject.MyProperty”没有 get 方法”,您必须通过在某处访问 MyObject.MyProperty 来使用 MyProperty,您需要检查这一点,还有一个方法是,如果你不想在此类之外公开 MyProperty,你应该使用“私有集”,当你有公共 setter 时却没有 getter 真的很奇怪,希望能给你一些帮助