调用堆栈错误 - C#

时间:2011-11-21 18:33:38

标签: c# .net warnings compiler-warnings windows-forms-designer

        // 
        // 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)

2 个答案:

答案 0 :(得分:0)

您根本忘记用数据提供一个对象。确保所有需要数据的源和对象都能获得它。

首先省略一些代码,使用try和catch查看错误源自哪里,如果你可以通过检查调用堆栈来做到这一点。

答案 1 :(得分:0)

我怀疑TextEdit.Properties对象没有根据生成的警告数量进行实例化(对5个​​Properties属性的引用有5个警告)。快速谷歌搜索显示其他一些人在使用DevExpress控件时遇到此问题,但我找不到任何解决方案。

以下是您应该尝试的一些事项:

  1. 确保您已引用所有适用的DevExpress DLL。
  2. 尝试从表单/ control / etc中删除TextEdit控件并再次添加。
  3. 将您的问题提交至DevExpress support center。他们通常都非常敏感。
相关问题