仅在某些计算机中出现此错误.通过读取堆栈信息,当我在静态类中调用此静态方法("FormatQuery")时会出现一些问题:
using System; using System.Collections.Generic; using System.Data; using System.Diagnostics; using System.IO; using System.Text; using System.Windows.Forms; using DevExpress.XtraEditors; using FlexCel.Report; using FlexCel.XlsAdapter; using ComboBox=System.Windows.Forms.ComboBox; namespace XSoftArt.A { static class RHelper { private static string FormatQuery(string FieldName, int Count, CheckedListBox chekedListBox) { string ID = string.Empty; int n = Count; foreach (DataRowView item in chekedListBox.CheckedItems) { ID = ID + item["" + FieldName + ""]; if (n > 1) { ID = ID + " , "; n--; } } return ID; } public static string FormatQuery(CheckedListBox chekedListBox) { return FormatQuery(chekedListBox.ValueMember, chekedListBox.CheckedItems.Count, chekedListBox); } }
所以有什么问题?我该如何解决?项目配置或重新布局模式有什么问题或者是什么?
错误信息:
at XSoftArt.EVS.ReportHelper.FormatQuery(CheckedListBox chekedListBox) at XSoftArt.EVS.NewEmailSelectClient.LoadList_v2(String search, TextBox txtbox) at XSoftArt.EVS.NewEmailSelectClient.LoadContacts() at XSoftArt.EVS.NewEmailSelectClient.button7_Click(Object sender, EventArgs e) at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Anderson Ime.. 61
Type Initializer异常表示无法创建类型.当您只是引用该类时,通常会在调用方法之前发生这种情况.
这里的代码是您的类型的完整文本吗?我会寻找类似失败的任务.获得应用程序设置和这种性质的东西我看到了很多.
static class RHelper { //If this line of code failed, you'd get this error static string mySetting = Settings.MySetting; }
您还可以使用类型的静态构造函数来查看此内容.
无论如何,这堂课还有吗?
Type Initializer异常表示无法创建类型.当您只是引用该类时,通常会在调用方法之前发生这种情况.
这里的代码是您的类型的完整文本吗?我会寻找类似失败的任务.获得应用程序设置和这种性质的东西我看到了很多.
static class RHelper { //If this line of code failed, you'd get this error static string mySetting = Settings.MySetting; }
您还可以使用类型的静态构造函数来查看此内容.
无论如何,这堂课还有吗?
我有同样的错误,但在我的情况下,它是由平台目标设置不匹配引起的.一个库专门设置为x86,而主应用程序设置为'Any'...然后我将我的开发移动到x64笔记本电脑.
当我修改Nlog配置文件并且没有正确格式化XML时,我收到此错误.