我刚刚收到我们应用程序的一些用户的一些反馈,他们在使用我们的应用程序时遇到了 Windows XP 问题。此应用程序在 Windows 7 上运行良好,但在 Windows XP 上无法运行。
另一件奇怪的事情:如果我在 Windows XP 工作站(使用 VS2010)上构建它,它可以在我的本地工作站上运行,如果我把它放在另一个 XP 工作站上,它就不再工作了。
在 XP 上运行时,我得到一个错误,告诉我XXXXX has encountered a problem and needs to close. We are sorry for the inconvenience
.
我在 EventViewer 应用程序的日志中找到了这个堆栈跟踪:
Application: MyApplication.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
Stack:
at System.Windows.Forms.UnsafeNativeMethods+IOleObject.DoVerb(Int32, IntPtr, IOleClientSite, Int32, IntPtr, COMRECT)
at System.Windows.Forms.WebBrowserBase.DoVerb(Int32)
at System.Windows.Forms.WebBrowserBase.TransitionFromRunningToInPlaceActive()
at System.Windows.Forms.WebBrowserBase.TransitionUpTo(AXState)
at System.Windows.Forms.WebBrowserBase.OnParentChanged(System.EventArgs)
at System.Windows.Forms.Control.AssignParent(System.Windows.Forms.Control)
at System.Windows.Forms.Control+ControlCollection.Add(System.Windows.Forms.Control)
at My.NameSpace.Here.Controls.LearningCenterControl.InitializeComponent()
at My.NameSpace.Here.Controls.LearningCenterControl..ctor()
at My.NameSpace.Here.MainForm.InitializeComponent()
at My.NameSpace.Here.MainForm..ctor()
at My.NameSpace.Here.MainForm.get_Instance()
at My.NameSpace.Here.Program.Main(System.String[])
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
这发生在我的一个 userControl 的设计器的 InitializeComponent 上:
this.m_learingResourceBrowser = new System.Windows.Forms.WebBrowser();
我猜XP存在安全问题,但是什么?
我发现了这个:
REM Mark project as DEP Noncompliant
call "$(DevEnvDir)..\..\VC\bin\vcvars32.bat"
call "$(DevEnvDir)..\..\VC\bin\editbin.exe" /NXCOMPAT:NO "$(TargetPath)"
我已经把这个构建后事件放在exe
项目上,但我没有看到任何改进
我还尝试使用我的 exe 直接运行该命令:
editbin.exe /NXCOMPAT:NO YourProgram.exe
关于可能导致此问题的任何想法?
编辑 我发现这个答案指出:
要测试它是否是 DEP 问题,请执行此操作。
右键单击“我的电脑”选择“属性”和“高级”在“启动和故障恢复”下,单击“设置”现在单击“编辑”记事本刚刚开始。只需替换行: Code: noexecute optionn by AlwaysOff 重新启动PC完成交易。
我在此之后我不再有这个错误了。所以我的问题是:目前我只在主 exe 上完成了之前的操作。我应该对所有 dll 执行此操作吗?因为我的项目由 230 多个项目组成,所以很难测试所有内容。