C# 由于未处理的异常-ArgumentOutOfRangeException,进程已终止

C# 由于未处理的异常-ArgumentOutOfRangeException,进程已终止,c#,.net,winforms,C#,.net,Winforms,我正在尝试运行windows桌面应用程序,出现以下错误: Application: xxx.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.ArgumentOutOfRangeException at System.Windows.Forms.ComboBox.Select(Int32

我正在尝试运行windows桌面应用程序,出现以下错误:

Application: xxx.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ArgumentOutOfRangeException
   at System.Windows.Forms.ComboBox.Select(Int32, Int32)
   at xxx.win.shared.FancyComboBox.OnTextChanged(System.EventArgs)
   at xxx.win.shared.IDComboBox.OnTextChanged(System.EventArgs)
   at System.Windows.Forms.Control.set_Text(System.String)
   at System.Windows.Forms.ComboBox.set_Text(System.String)
   at System.Windows.Forms.ComboBox.UpdateText()
   at System.Windows.Forms.ComboBox.set_SelectedIndex(Int32)
   at System.Windows.Forms.ComboBox.set_Text(System.String)
   at xxx.win.FrmSearch..ctor()
   at xxx.win.Startup.Main()
我已经删除了所有已安装的.NET framework实例,并安装了不同的版本进行测试,结果仍然相同

我运行了.NET版本检查程序,这是当前安装的:

v3.0  3.0.30729.4926  SP2
v3.5  3.5.30729.4926  SP1
v4
  Client  4.8.03761
  Full  4.8.03761
v4.0
  Client  4.0.0.0

应用程序的目标是.NETFramework版本4.6.2。所以我应该被掩护在前面。同一应用程序在另一台具有相同.NET framework设置的计算机上运行

您正在处理的问题与.NET framework无关

如果查看异常堆栈,您将看到ArgumentOutOfRangeException由FRMSSearch表单的一个组合框引发。尝试找出哪个组合框引发异常,以及代码中的什么条件可能引发此类异常


如果您的组合框中填充了外部数据(文件、数据库等),请确保数据源在部署后可供您的应用程序使用。

@Jimi的评论是正确的,这不是框架问题。
System.ArgumentOutOfRangeException
通常与尝试访问或选择数组或列表中超出数组或列表范围的值有关

在堆栈跟踪中,它似乎来自组合框
System.Windows.Forms.ComboBox.Select(Int32,Int32)

确保组合框中有值,如果没有,代码不会尝试选择值

如果组合框中没有值,而您正在执行类似于
combobox的操作。选择(1)
,您将得到错误,因为1超出了组合框中的值范围