Visual Studio显示无休止的消息“属性'valueMember'的代码生成失败." [英] Visual studio shows endless messages "Code generation for property 'valueMember' failed."

查看:314
本文介绍了Visual Studio显示无休止的消息“属性'valueMember'的代码生成失败."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Visual Studio 2008开心地破解了这个C#应用程序几天后,我被一系列错误对话框惊叹不已,这些错误对话框显示:

属性" valueMember "的代码生成失败.
错误是:"对象引用未设置为对象的实例."

这种情况经常发生在我对设计师进行微小改动时,例如将控件移几个像素,然后尝试保存.每秒都会出现几个这样的错误对话框,这让我忙于通过锤击Enter键来取消所有这些错误对话框,同时尝试获取alt-F4以使VS关闭.

最终,我确实关闭了VS并保存了所做的更改.重新启动VS后,我对整个项目进行清理",然后构建",一切正常,应用程序运行正常,没有问题.

在我对表单设计器进行另一次更改之前.

我对我的应用程序中的任何属性valueMember一无所知.

这让我发疯,对于我的项目而言,这是真正的突破.感谢您的帮助.

解决方案

在设计时会发生这种情况,您可能有一个自定义控件,该控件需要一个参数或其他没有默认值的值.

在Visual Studio中的设计视图中时;创建了一个控件实例以在可视化编辑器上呈现它,但是如果控件要求先设置一个属性,然后才能呈现它,则将导致错误.

您可以检查所有自定义控件是否具有默认值,并且构造函数中引用的任何不具有默认值的内容都由DesignMode属性包装-请参见

Until I make another slight change in the form designer.

I don't know about any property valueMember in my app.

This makes me crazy, it is a real showstopper for my project. Any help is appreciated.

解决方案

As this is happening at design time, it is likely that you have a custom control which requires a parameter or other value which does not have a default.

When in design view in Visual Studio; a control instance is created to render it on the visual editor, but if the control requires a property to be set before it can be rendered, it will result in an error.

Can you check that all custom controls have default values, and anything referenced in the constructor that cannot have a default is wrapped by DesignMode property - see http://msdn.microsoft.com/en-us/library/system.componentmodel.component.designmode.aspx.

这篇关于Visual Studio显示无休止的消息“属性'valueMember'的代码生成失败."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆