我在这里有一个Windows Form应用程序,并收到以下错误消息:
缺少IID {{EAC04BC0-3791-11D2-BB95-0060977B464C}的代理注册。
然后我得到了堆栈跟踪:
System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)
bei System.Windows.Forms.StringSource..ctor(String[] strings)
bei System.Windows.Forms.TextBox.SetAutoComplete(Boolean reset)
bei System.Windows.Forms.TextBox.OnHandleCreated(EventArgs e)
bei System.Windows.Forms.Control.WmCreate(Message& m)
bei System.Windows.Forms.Control.WndProc(Message& m)
bei System.Windows.Forms.TextBoxBase.WndProc(Message& m)
bei System.Windows.Forms.TextBox.WndProc(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)</StackTrace><ExceptionString>System.InvalidCastException: Schnittstelle nicht registriert
不幸的是,我不知道如何读取堆栈跟踪。有人可以举手吗?可以描述我如何用最佳实践调试此错误吗?
谢谢
编辑:
这是一些代码。最后一行删除该异常。
private void pbbtpisaddhtcshow_Click(object sender, EventArgs e)
{
mainForm.gpbpishotelfilter.Visible = false;
mainForm.pbbtpisnhotelfilter.Image = GDISClient.Properties.Resources.filter_show_30;
mainForm.tbpishtccodes.Focus();
if (mainForm.tbpishtccodes.Text.Length > 0)
{
string test = mainForm.tbpishtccodes.Text.Replace(' ', '\0');
string[] htcsplit = test.Split(',');
foreach (string item in htcsplit)
{
mainForm.lbpishtcall.SelectedIndex = (mainForm.lbpishtcall.FindString(item));
if (mainForm.lbpishtcall.FindString(item) >= 0)
{
mainForm.lbpishtcadded.Items.Add(mainForm.lbpishtcall.SelectedItem);
mainForm.lbpishtcall.Items.Remove(mainForm.lbpishtcall.SelectedItem);
}
}
mainForm.lbpishtcall.ClearSelected();
mainForm.lbpishtcadded.ClearSelected();
}
mainForm.tbpishtcsuche.Focus();
mainForm.gbpishtcadd.Visible = true;
}
gpbishtcadd是一个分组框,将由后台工作人员填充。
后台工作人员完成其RunWorkerCompletet事件后,应完成该操作。
我认为有可能是,背景工作人员当时没有完成,按下了按钮,并且显示了组框,所以它可能在这里崩溃了。