我非常感谢你在这里的帮助。我的申请如下,
操作系统: Windows 7 64位操作系统
:VS 2012
应用程序:运行在VB.Net框架4上的.Net
在我的应用程序中,我有一个按钮来调用我的自定义方法‘Select_Batch_File()’。单击此按钮后,假设打开“OpenFileDialog”以选择特定文件。然而,这在我的计算机上运行得很好;但是,在我的一些同事机器上(上面的配置是相同的),这是不工作的,并且毫无例外地失败了。我从同事的机器上收集了线程转储,如下所示,
======================
日志名称:应用程序
资料来源:.NET运行时
日期:2013年3月18日1:54:19下午
事件ID: 1026
任务类别:无
级别:错误
关键词:经典
用户: N/A
描述:
应用程序: Visual AEEMS.exe
框架版本: v4.0.30319
说明:由于未处理的异常,进程被终止。
异常信息: System.AccessViolationException
堆叠:
在System.Windows.Forms.FileDialogNative+IFileDialog.Show(IntPtr)
在System.Windows.Forms.FileDialog.RunDialogVista(IntPtr)
在System.Windows.Forms.FileDialog.RunDialog(IntPtr)
在System.Windows.Forms.CommonDialog.ShowDialog(System.Windows.Forms.IWin32Window)
===============
我遵循了MSDN论坛的解决方案,在这个论坛中,用户被要求取消选中visual studio > Tools > Options >调试>‘仅管理的模块加载上的JIT优化’中的选项,但没有成功。
这是我的密码
Sub Select_Batch_File()
Try
Dim OpenFileDialog As New OpenFileDialog
OpenFileDialog.AutoUpgradeEnabled = False
Full_Path = "" : file_name = ""
OpenFileDialog.Multiselect = False
Try
<<Here I am getting exception>>
If (OpenFileDialog.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK) Then
EMS_Dir = OpenFileDialog.FileName 'get the path
EMS_Dir = StrReverse(EMS_Dir) 'reverse the string
EMS_Dir = Mid(EMS_Dir, InStr(EMS_Dir, "\"), Len(EMS_Dir)) 'extract from the first slash
EMS_Dir = StrReverse(EMS_Dir) 'reverse it again
'file_name = OpenFileDialog.SafeFileName
file_name = OpenFileDialog.FileName
End If
Catch ex As Exception
Logger.LogInfo(ex) : MsgBox(ex.Message)
End Try
Catch ex As Exception
Logger.LogInfo(ex) : MsgBox(ex.Message)
End Try
End Sub请指点。
发布于 2013-03-19 07:06:53
如果您设置了属性,您将得到一个异常AutoUpgradeEnabled。不知道为什么,但它就在这里。
https://stackoverflow.com/questions/15492668
复制相似问题