调用堆栈错误 - C#
//
// textEdit1
//
this.textEdit1.Location = new System.Drawing.Point(4, 20);
this.textEdit1.Name = "textEdit1";
this.textEdit1.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.HotFlat;
this.textEdit1.Properties.MaxLength = 15;
this.textEdit1.Properties.NullValuePrompt = "<Beta Code>";
this.textEdit1.Properties.NullValuePromptShowForEmptyValue = true;
this.textEdit1.Properties.PasswordChar = '*';
this.textEdit1.Size = new System.Drawing.Size(250, 22);
this.textEdit1.TabIndex = 2;
因此,我收到 5 条警告消息和一个调用堆栈错误,这意味着我无法在设计器模式下查看它。
警告消息:
Warning 1 Object reference not set to an instance of an object.
Warning 2 Object reference not set to an instance of an object.
Warning 3 Object reference not set to an instance of an object.
Warning 4 Object reference not set to an instance of an object.
Warning 5 Object reference not set to an instance of an object.
他将不胜感激任何帮助。提前致谢。
调用堆栈:
at DevExpress.XtraEditors.Repository.RepositoryItem.CreateDesigner()
at DevExpress.XtraEditors.Repository.RepositoryItem.FilterProperties(PropertyDescriptorCollection collection)
at DevExpress.XtraEditors.Repository.RepositoryItem.System.ComponentModel.ICustomTypeDescriptor.GetProperties(Attribute[] attributes)
at System.ComponentModel.TypeDescriptor.MergedTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetProperties(Attribute[] attributes)
at System.ComponentModel.TypeDescriptor.GetPropertiesImpl(Object component, Attribute[] attributes, Boolean noCustomTypeDesc, Boolean noAttributes)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.GetPropertiesHelper(IDesignerSerializationManager manager, Object instance, Attribute[] attributes)
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)
//
// textEdit1
//
this.textEdit1.Location = new System.Drawing.Point(4, 20);
this.textEdit1.Name = "textEdit1";
this.textEdit1.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.HotFlat;
this.textEdit1.Properties.MaxLength = 15;
this.textEdit1.Properties.NullValuePrompt = "<Beta Code>";
this.textEdit1.Properties.NullValuePromptShowForEmptyValue = true;
this.textEdit1.Properties.PasswordChar = '*';
this.textEdit1.Size = new System.Drawing.Size(250, 22);
this.textEdit1.TabIndex = 2;
I get 5 warning messages and a call stack error because of this, meaning I can't view it in designer mode.
Warning Messages:
Warning 1 Object reference not set to an instance of an object.
Warning 2 Object reference not set to an instance of an object.
Warning 3 Object reference not set to an instance of an object.
Warning 4 Object reference not set to an instance of an object.
Warning 5 Object reference not set to an instance of an object.
Any help would he appreciated. Thanks in advance.
Call Stack:
at DevExpress.XtraEditors.Repository.RepositoryItem.CreateDesigner()
at DevExpress.XtraEditors.Repository.RepositoryItem.FilterProperties(PropertyDescriptorCollection collection)
at DevExpress.XtraEditors.Repository.RepositoryItem.System.ComponentModel.ICustomTypeDescriptor.GetProperties(Attribute[] attributes)
at System.ComponentModel.TypeDescriptor.MergedTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetProperties(Attribute[] attributes)
at System.ComponentModel.TypeDescriptor.GetPropertiesImpl(Object component, Attribute[] attributes, Boolean noCustomTypeDesc, Boolean noAttributes)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.GetPropertiesHelper(IDesignerSerializationManager manager, Object instance, Attribute[] attributes)
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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您只是忘记向其中一个对象提供数据。确保所有需要数据的源和对象都能获取数据。
首先使用 try 和 catch 省略一些代码,以查看错误的根源(如果可以通过检查调用堆栈来做到这一点)。
You simply have forgotten to feed one of your objects with data. Ensure that all sources and objects that require data do get it.
Begin by omitting some of your code with try and catch to see where the error got its origin if you can do that by checking the Call Stack.
我怀疑 TextEdit.Properties 对象没有根据生成的警告数量进行实例化(对 Properties 属性的 5 次引用产生 5 条警告)。快速谷歌搜索显示其他一些人在使用 DevExpress 控件时遇到了这个问题,尽管我找不到任何解决方案。
以下是您应该尝试的一些操作:
I suspect the TextEdit.Properties object isn't being instantiated based on the # of warnings being generated (5 warnings for 5 references to the Properties property). A quick Google search shows a few other people have had this problem with DevExpress controls though I can't find any resolution.
Here are a few things you should try: