提问人:Vadym Lenda 提问时间:9/1/2023 更新时间:9/1/2023 访问量:42
Windows 窗体应用程序上的 InvalidProgramException
InvalidProgramException on Windows Forms application
问:
在开发桌面 Windows 窗体应用程序的过程中,我们遇到了以下问题: 我们的客户在其中一台机器上有几台安装了应用程序的生产机器 .NET 运行时引发 InvalidProgramException 与以下堆栈跟踪:
System.InvalidProgramException: Common Language Runtime detected an invalid program.
at System.Windows.Forms.DataGridViewColumnCollection.GetColumnAtDisplayIndex(Int32 displayIndex)
at System.Windows.Forms.DataGridView.CorrectColumnFrozenState(DataGridViewColumn dataGridViewColumn, Int32 anticipatedColumnIndex)
at System.Windows.Forms.DataGridView.OnAddingColumn(DataGridViewColumn dataGridViewColumn)
at System.Windows.Forms.DataGridViewColumnCollection.Add(DataGridViewColumn dataGridViewColumn)
at System.Windows.Forms.DataGridView.CorrectColumnFrozenStates(DataGridViewColumn[] dataGridViewColumns)
at System.Windows.Forms.DataGridView.OnAddingColumns(DataGridViewColumn[] dataGridViewColumns)
at System.Windows.Forms.DataGridViewColumnCollection.AddRange(DataGridViewColumn[] dataGridViewColumns)
在其他机器上,我们没有观察到这种异常。
- 您能否提供此异常的原因?
- 它是否与损坏的 .NET 运行时安装有关?
- 我们可以采取哪些措施来解决这个问题?
我已经开始调查这样一个事实,即安装在机器上的 .NET Framework dll 由 ngen(本机图像生成器)处理并从本机图像缓存加载。这就是它在我的开发机器上的工作方式。
- 问题是,如果System.Windows.Forms dll被加载为本机代码,那么为什么异常是关于无效的MSIL?
- 有没有办法检查已安装的.NET Framework库dll的完整性?
- 这个问题有没有可能出在 ngen 使用的编译器中?是否可以以某种方式强制重新生成 .NET Framework 本机映像?
平台: 操作系统名称:Microsoft Windows 10 企业版 版本 10.0.19045 内部版本 19045 系统类型:基于 x64 的 PC
电脑上预装的 .NET 运行时:4.8.04084 (528 372) 项目目标 .NET Framework:4.6.2
答: 暂无答案
评论