Assertion failure: "(!"SetThreadContext failed")"问题的解决办法

在编译程序并运行后,Delphi2007会提示以下错误(windows 7 64位 运行环境):

---------------------------
bds.exe - bordbk105N.dll
---------------------------
Assertion failure: "(!"SetThreadContext failed")"
in ..\win32src\thread32.cpp at line 412
Continue execution?

---------------------------
Yes   No  
---------------------------

 

———————华丽的分割线————————-

Delphi 2007 或 2009 在 Windows 7 x64 以及其他 x64 系统下,退出 IDE 时,调试器会产生一个断言错误。

错误窗口标题为:bds.exe – bordbk120N.dll,内容为:Assertion failure: “(!”SetThreadContext failed”)” in ..\win32src\thread32.cpp at line 434。

解决办法是使用一个非官方的补丁程序进行修复。

补丁程序来源:http://www.monien.net/blog/index.php/2009/07/delphi-2009-windows-7-64-bit-debugger-crash-workaround/

 

Delphi 2009 / Windows 7 / 64 bit Debugger Crash Workaround

 

Delphi 2009 / Windows 7 / 64 bit Debugger Crash Workaround

Yesterday I revisited a nasty problem that occurs on Windows 64bit versions. I ran into that when I upgraded to Windows 7, but it seems it affects older 64bit editions of Windows as well.

After installing D2009 on a clean Win7 machine I was happy to see that Windows 7 really is what Vista should have been. It works snappy and has a lot of productivity features. But then when I started compiling and debugging a couple of my existing Delphi applications I experienced Debugger crashes almost everytime when I terminated an application.

image


Unfortunately no matter if you press “Yes” or “No” on that screen – you have to restart the whole Delphi IDE – which basically makes debugging impossible. In some (actually many) cases you even have to terminate Delphi using Windows TaskManager. I tried all of the compatibility settings Win7 offers, as well as running Delphi as Administrator – but no luck.

Some research on Google, QC and RAID showed that similar exceptions were reported with older Delphi versions, but apparently only on 64bit Windows editions. As the message already suggests, the problem appears to be an invalid call to a SetThreadContext API call. Some tests showed that you can easily reproduce this issue once you have more that just a single thread in your Delphi application. As you might know, I am doing quite a lot of Web application server development – which by nature create many threads…

I created a RAID entry for that (actually an existing one was updated with detailed reproduction steps – iirc) and joined a discussion thread on that topic to see if others are reporting that too. Because of time constraints I did not revisit that issue over the last couple of weeks, but yesterday when I was talking to Daniel Magin, we together found a solution someone had posted on a German Forum a few weeks ago. The original idea is from an MS TechNet posting though (credits go to a guy called Xelax Ax).

He posted a workaround that basically disables the check for a possible error returned by SetThreadContext, i.e. the debugger ignores the error and does not crash because of the Assert that checks fro no error returned. As Andreas Hausladen already correctly mentioned, this is really just kind of a weak workaround, because the debugger might misbehave after that and we just do not know why SetThreadContext fails at all. The point is though that with this fix I can work effectively again with D2009 on Win7/64bit and as this error only happens when the debugger is about to shout down anyway, so the danger of unwanted side effects is not too high imho.

Be careful! No waranties! I am not responsible for lost files etc.! Back up first!

Workaround steps:

  1. Close Delphi
  2. Locate bordbk120N.dll (C:\Program Files (x86)\CodeGear\RAD Studio\6.0\bin)
  3. Make a backup copy
  4. Check step 3
  5. Open bordbk120N.dll in a Hex editor (UltraEdit works fine)
  6. Search for “01 00 48 74 47 80 3D
  7. Make sure this is found once only
  8. Replace “74” with “EB
  9. Save
  10. Restart Delphi. Error should be gone.

This might work on older Delphi versions as well, but I did not test that yet.

Update 1

I talked to some CodeGear Q&A guy and he tested their current internal Weaver build under the conditions where D2009 fails. The good news is that the error seems to be gone there – so the next Delphi Version will probably be good. For those who want to get started now: please see Update 2 below.

Update 2

LordByte sent me his automatic patch tool for Delphi 2007 and Delphi 2009. Just click “Apply patch” and you are done.

image

Get the patcher here: Delphi_2007_2009_WOW64_Debugger_Fix.zip (169 KB)

Note: Provided as is for free. Use at your own risk.

uniGUI是恩巴克德罗德尔菲和C 生成器的 Web 应用程序框架。 uniGUI功能为开发有状态的 Web 应用程序 (即spa) 提供了一整套可视化控件。 开发过程与开发常规 VCL 应用程序非常相似。 uniGUIWeb 应用程序可以直接在 RAD 工作室 IDE 中运行和调试, 这使得开发过程变得非常简单和简单。 UniGUI将 Web 应用程序开发体验扩展到一个新的维度。 在这个新的维度中, 生产率是首要目标。 uniGUI允许开发人员关注应用程序业务逻辑, 而不是处理 Web 应用程序开发细节, 例如直接使用 HTML、JavaScript、XML 模板和其他 web 技术。 uniGUI将节省许多宝贵的开发时间, 这反过来有助于大大减少项目开发、部署和支持成本。 它使uniGUI成为小型开发团队的完美工具, 这些小组的资源有限, 无法用于开发细节。 uniGUI也是在有限的时间内为大型团队创建企业级 Web 应用程序的合适工具。 部署是 Web 应用程序开发过程中的另一个重要步骤。 使用uniGUI, 部署很简单。 开发人员可以选择任何可用的部署选项, 如Windows 服务、独立服务器或ISAPI 模块。 ISAPI 模块可以使用Microsoft IIS、 Apache web 服务器或任何其他兼容的启用 ISAPI 的 web 服务器来部署。 uniGUI使用Sencha Ext JS库进行客户端渲染。 这些库被认为是创建SPA应用程序的业界领先框架之一。 uniGUI结合了 Ext JS 的威力与德尔斐的 RAD 能力, 以提供最快的方式创建Delphi。 uniGUI在一组特殊的Delphi控制中封装了 Ext JS 类, 使开发人员能够创建功能丰富的 web 应用程序, 而无需学习客户端脚本和 web UI 详细信息。 开发人员可以专注于业务逻辑, 而不是处理重复的 UI 设计细节, 这可能是费时费力的任务。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

冷月宫主

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值