我见过这样的问题here,但我找不到答案。
我有两个项目:
问题是当设计人员尝试将 MyControl 的 Component 属性分配给 UserComponent 的实例时。当我第一次打开设计器时所有工作正常但在表单设计器中的任何更改后显示错误'Object of type 'UserComponent' cannot be converted to type 'BaseUserComponent'
。但UserComponent
继承自BaseUserComponent
,因此它应该正常工作。
例外:
at System.ComponentModel.ReflectPropertyDescriptor.SetValue(Object component, Object value)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkPropertyDescriptor.SetValue(Object component, Object value)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializePropertyAssignStatement(IDesignerSerializationManager manager, CodeAssignStatement statement, CodePropertyReferenceExpression propertyReferenceEx, Boolean reportError)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeAssignStatement(IDesignerSerializationManager manager, CodeAssignStatement statement)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)
我尝试重建整个解决方案,多次投影并且没有效果。