You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Delphi 10.3迁移报错:'false'不是有效布尔值求助

Delphi 2007迁移至10.3后BPL导致IDE报错问题

我们正在将旧版Delphi 2007应用迁移至Delphi 10.3,该应用使用公司标准的专属BPL。该BPL编译正常,但安装后Delphi 10 IDE持续弹出错误框,提示'false' is not a valid boolean value,点击确定后错误反复出现,只能通过任务管理器终止IDE。若先启动IDE再手动安装BPL,无报错,但无法打开任何项目,甚至创建新项目也会触发相同错误。删除.dproj文件并打开.dpr生成新配置文件后问题依旧。

错误堆栈

[50091D9D]{rtl260.bpl  } System.SysUtils.ConvertErrorFmt (Line 5610, "System.SysUtils.pas" + 1) + $10
[500941FF]{rtl260.bpl  } System.SysUtils.StrToBool (Line 9000, "System.SysUtils.pas" + 2) + $14
[2064C6A5]{coreide260.bpl} MSBBuildConfiguration.TBuildConfiguration.GetBoolean (Line 458, "MSBBuildConfiguration.pas" + 3) + $7
[2064C5D2]{coreide260.bpl} MSBBuildConfiguration.TBuildConfiguration.GetBoolean (Line 441, "MSBBuildConfiguration.pas" + 0) + $6
[21CEC783]{delphicoreide260.bpl} BaseDelphiProject.TDelphiCodeIPackageProject.IsDesignPackage (Line 5942, "BaseDelphiProject.pas" + 6) + $A
[21CA6143]{delphicoreide260.bpl} PkgContainers.TStdPackageProjectContainer.GetIndex (Line 155, "PkgContainers.pas" + 2) + $20
[206FDA8A]{coreide260.bpl} ProjectFrm.TProjectManagerForm.ProjectTree2GetImageIndex (Line 1844, "ProjectFrm.pas" + 22) + $14
[212DE51C]{vclide260.bpl} IDEVirtualTrees.TBaseVirtualTree.DoGetImageIndex (Line 19089, "IDEVirtualTrees.pas" + 8) + $19
[212E0B77]{vclide260.bpl} IDEVirtualTrees.TBaseVirtualTree.GetImageIndex (Line 20601, "IDEVirtualTrees.pas" + 6) + $26
[212EA3F1]{vclide260.bpl} IDEVirtualTrees.TBaseVirtualTree.PaintTree (Line 27617, "IDEVirtualTrees.pas" + 221) + $27
[212E35B7]{vclide260.bpl} IDEVirtualTrees.TBaseVirtualTree.Paint (Line 22316, "IDEVirtualTrees.pas" + 22) + $10
[50D201F3]{vcl260.bpl  } Vcl.Controls.TCustomControl.PaintWindow (Line 14241, "Vcl.Controls.pas" + 6) + $5
[50D19F11]{vcl260.bpl  } Vcl.Controls.TWinControl.PaintHandler (Line 10362, "Vcl.Controls.pas" + 4) + $14
[50D1A6F8]{vcl260.bpl  } Vcl.Controls.TWinControl.WMPaint (Line 10563, "Vcl.Controls.pas" + 6) + $5
[50D2018D]{vcl260.bpl  } Vcl.Controls.TCustomControl.WMPaint (Line 14230, "Vcl.Controls.pas" + 2) + $4
[212DAFB1]{vclide260.bpl} IDEVirtualTrees.TBaseVirtualTree.WMPaint (Line 16924, "IDEVirtualTrees.pas" + 8) + $4
[50D15292]{vcl260.bpl  } Vcl.Controls.TControl.WndProc (Line 7420, "Vcl.Controls.pas" + 91) + $6
[5005FDDF]{rtl260.bpl  } System.TObject.Dispatch (Line 18324, "System.pas" + 11) + $0
[0DAE8E82]{themeloader260.bpl} Idetheme.Vclstylehooks.TIDEStyleHook.WndProc + $7A
[500679A8]{rtl260.bpl  } System.@IntfClear (Line 38159, "System.pas" + 10) + $0
[0DAE893B]{themeloader260.bpl} Idetheme.Vclstylehooks.TIDEStyleHook.HandleMessage + $B7
[500679A8]{rtl260.bpl  } System.@IntfClear (Line 38159, "System.pas" + 10) + $0
[50063FD8]{rtl260.bpl  } System.@FinalizeArray (Line 32812, "System.pas" + 144) + $0
[0DB21CC2]{themeloader260.bpl} Idetheme.Stylemanager.TIDEThemeStyleEngine.UnRegisterSysStyleHook + $106
[50D197BC]{vcl260.bpl  } Vcl.Controls.TWinControl.WndProc (Line 10122, "Vcl.Controls.pas" + 10) + $48
[50D19D47]{vcl260.bpl  } Vcl.Controls.TWinControl.WndProc (Line 10278, "Vcl.Controls.pas" + 166) + $6
[50063194]{rtl260.bpl  } System.@UStrSetLength (Line 30446, "System.pas" + 27) + $0
[212E57B4]{vclide260.bpl} IDEVirtualTrees.TBaseVirtualTree.WndProc (Line 23720, "IDEVirtualTrees.pas" + 32) + $4
[50D19314]{vcl260.bpl  } Vcl.Controls.TWinControl.MainWndProc (Line 9977, "Vcl.Controls.pas" + 3) + $6
[501796A4]{rtl260.bpl  } System.Classes.StdWndProc (Line 17932, "System.Classes.pas" + 11) + $2
[12EC238A]{CnWizards_D103R.DLL} Unknown function at __dbk_fcall_wrapper + $60672
[50063EA4]{rtl260.bpl  } System.@FinalizeRecord (Line 32510, "System.pas" + 41) + $0
[26CA255C]{JvRuntimeDesign260.bpl} JvDesignImp.TJvDesignSelector.RemoveFromSelection + $C
[5005A285]{rtl260.bpl  } System.@ReallocMem (Line 4913, "System.pas" + 21) + $0
[50063194]{rtl260.bpl  } System.@UStrSetLength (Line 30446, "System.pas" + 27) + $0
[212CC833]{vclide260.bpl} IDEVirtualTrees.TVirtualTreeHintWindow.IsHintMsg (Line 7100, "IDEVirtualTrees.pas" + 7) + $13
[50E6EC33]{vcl260.bpl  } Vcl.Forms.TApplication.ProcessMessage (Line 10747, "Vcl.Forms.pas" + 23) + $1
[50E6EC76]{vcl260.bpl  } Vcl.Forms.TApplication.HandleMessage (Line 10777, "Vcl.Forms.pas" + 1) + $4
[50E6EFA9]{vcl260.bpl  } Vcl.Forms.TApplication.Run (Line 10915, "Vcl.Forms.pas" + 26) + $3
[0051D022]{bds.exe     } bds.bds (Line 214, "" + 7) + $7  

原因分析

从错误堆栈追踪可知,问题根源是System.SysUtils.StrToBool函数无法识别小写的'false'字符串。Delphi 10.3的StrToBool默认仅支持首字母大写的'True'/'False'格式,而旧版Delphi或自定义BPL的配置逻辑可能写入了小写布尔值,导致IDE解析构建配置时触发转换错误。

具体调用链显示:IDE在判断包是否为设计时包时,通过MSBBuildConfiguration.TBuildConfiguration.GetBoolean读取配置项,最终调用StrToBool处理小写的'false'时抛出异常。

解决办法

  • 修正BPL的配置写入逻辑:排查专属BPL中向IDE配置或注册表写入布尔值的代码,确保所有布尔值字符串使用首字母大写的'True'/'False'格式。
  • 清理IDE配置缓存:删除Delphi 10.3的配置缓存目录(通常为C:\Users\<用户名>\AppData\Roaming\Embarcadero\BDS\17.0),重启IDE后重新生成配置。
  • 检查设计时包注册逻辑:若BPL是设计时包,确认其IsDesignPackage相关逻辑传递的是布尔类型值而非字符串,避免触发字符串转换操作。
  • 排查第三方插件干扰:暂时卸载CnWizards、Jvcl等第三方插件,测试是否为插件与自定义BPL的兼容性问题。
  • 重新编译BPL:确保BPL是用Delphi 10.3重新编译的,编译时正确选择目标类型(设计时包需勾选Design-Time Only选项)。

内容的提问来源于stack exchange,提问作者alvaroc

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.16 11:28:06