注册表中的 VB6 IDE 缓慢和 'VBKeySave5'
VB6 IDE Slowness and 'VBKeySave5' in the Registry
注册表子树 HKCR\VBKeySave5
有什么用?为什么它对 VB6 IDE 性能有如此巨大的影响?
背景:
我们的一台开发 PC (Windows 10 x64) 加载 VB6 IDE 非常缓慢。 IDE 最初加载速度很慢,并且调出项目引用 window 也非常慢。 (几十秒,甚至~分钟)。
为项目使用的库之一查询注册表显示了子树 HKCR\VBKeySave5
。在这个子树下有成千上万的条目,看起来像通常的 GUID、class ID、class名称等 COM 沼泽地,您可以通过 VB6 DLL 等获得这些
删除此键及其下的所有内容使 IDE 的执行速度快得无法估量 - 基本上它会加载然后立即显示引用 window。
似乎没有什么不好的事情发生。
当 运行 个组中有多个项目时,VBKeySave5\
子树似乎被 VB6 IDE 使用。
当 运行 在组中时,VB6 巧妙地使通常由已编译的 DLL 提供的所有 COM 引用实际上重定向到 IDE,因此您可以直接在同一个项目中调试团体。它似乎使用 VBKeySave5\
子树来实现其中的一些魔法。
我制作了一个测试项目,其中包含一个测试 DLL。然后做了一个包含两者的测试组。使用 Process Monitor 我监视了 IDE 在注册表中所做的事情。这是事件的基本顺序:
- 加载项目组
- 运行项目组-调试开始
- IDE 创建
VBKeySave5\
子树
- IDE 用一堆东西填充那个子树
- 测试程序在IDE/调试器
中执行
- 测试程序终止
- IDE 删除
VBKeySave5\
下的所有内容
- IDE returns进入编辑模式(调试结束)
在这种情况下,注册表中不会留下任何额外内容。
现在 - 如果在第 5 步之后我终止了 VB6.exe 进程,它添加的所有注册表垃圾 永远不会被删除 。 运行 VB6 和 运行 同一个组不会清理它——它只是在 VBKeySave5\
下创建略有不同的东西。
所以随着时间的推移,尤其是对于较大的项目,IDE 异常终止的情况会给注册表 增加大量无用的混乱。 IDE 在加载项目时似乎仍然需要阅读这些混乱内容,等等,这会减慢它的速度。
在我们的案例中,无论出于何种原因,IDE 经常崩溃。我们定期使用项目组(有 4、5、6 个项目)。因此,这些崩溃似乎随着大量条目而变得混乱 VBKeySave5\
,这会导致速度下降。
也许除了崩溃之外,还有其他情况下 VB6 不会自行清理。
VBKeySave5
的 Google 个结果很少,但是这个 anecdote about 75,000 entries under that subtree
在最近的一个例子中,我在自己的 PC 上将 VBKeySave5
密钥导出到一个文件中。该文件为 98 MB,包含 1,013,090 行。
2017 年 2 月 20 日更新:
Additional information related to why VBKeySave5 might not be cleaned up automatically:
The VS Installer for Windows 10 allows you to set the VB6.EXE
compatibility mode to Windows Vista (Service Pack 2).
DO NOT DO THIS.
Do not run the VB6 IDE in compatibility mode of any kind. The
suggested purpose is to fix anomalies in the graphic designer of the
IDE. Believe me, these anomalies are nothing compared to the damage
left in your windows registry when VB6.EXE is run in compatibility
mode.
When VB6.EXE is used to Compile-And-Run your application, it replaces
GUIDs and class and typelib registrations causing them to refer to its
VB6DEBUG.DLL. this allows the IDE to intercept execution of your code
so you can debug. When it does this replacement of your DLL and OCX
registrations, it saves your stuff under HKCR\VBKeySave5.
Unfortunately, when VB6.EXE is set to run in compatibility mode of an
earlier verison of Windows, it fails to restore all of your DLL and
OCX registration information. It leaves VBKeySave5 there, which causes
your IDE to take much longer during subsequent starts of the IDE, and
it trashes your registry, eventually rendering your application
not-runnable on your machine.
注册表子树 HKCR\VBKeySave5
有什么用?为什么它对 VB6 IDE 性能有如此巨大的影响?
背景:
我们的一台开发 PC (Windows 10 x64) 加载 VB6 IDE 非常缓慢。 IDE 最初加载速度很慢,并且调出项目引用 window 也非常慢。 (几十秒,甚至~分钟)。
为项目使用的库之一查询注册表显示了子树 HKCR\VBKeySave5
。在这个子树下有成千上万的条目,看起来像通常的 GUID、class ID、class名称等 COM 沼泽地,您可以通过 VB6 DLL 等获得这些
删除此键及其下的所有内容使 IDE 的执行速度快得无法估量 - 基本上它会加载然后立即显示引用 window。
似乎没有什么不好的事情发生。
当 运行 个组中有多个项目时,VBKeySave5\
子树似乎被 VB6 IDE 使用。
当 运行 在组中时,VB6 巧妙地使通常由已编译的 DLL 提供的所有 COM 引用实际上重定向到 IDE,因此您可以直接在同一个项目中调试团体。它似乎使用 VBKeySave5\
子树来实现其中的一些魔法。
我制作了一个测试项目,其中包含一个测试 DLL。然后做了一个包含两者的测试组。使用 Process Monitor 我监视了 IDE 在注册表中所做的事情。这是事件的基本顺序:
- 加载项目组
- 运行项目组-调试开始
- IDE 创建
VBKeySave5\
子树 - IDE 用一堆东西填充那个子树
- 测试程序在IDE/调试器 中执行
- 测试程序终止
- IDE 删除
VBKeySave5\
下的所有内容
- IDE returns进入编辑模式(调试结束)
在这种情况下,注册表中不会留下任何额外内容。
现在 - 如果在第 5 步之后我终止了 VB6.exe 进程,它添加的所有注册表垃圾 永远不会被删除 。 运行 VB6 和 运行 同一个组不会清理它——它只是在 VBKeySave5\
下创建略有不同的东西。
所以随着时间的推移,尤其是对于较大的项目,IDE 异常终止的情况会给注册表 增加大量无用的混乱。 IDE 在加载项目时似乎仍然需要阅读这些混乱内容,等等,这会减慢它的速度。
在我们的案例中,无论出于何种原因,IDE 经常崩溃。我们定期使用项目组(有 4、5、6 个项目)。因此,这些崩溃似乎随着大量条目而变得混乱 VBKeySave5\
,这会导致速度下降。
也许除了崩溃之外,还有其他情况下 VB6 不会自行清理。
VBKeySave5
的 Google 个结果很少,但是这个 anecdote about 75,000 entries under that subtree在最近的一个例子中,我在自己的 PC 上将
VBKeySave5
密钥导出到一个文件中。该文件为 98 MB,包含 1,013,090 行。
2017 年 2 月 20 日更新: Additional information related to why VBKeySave5 might not be cleaned up automatically:
The VS Installer for Windows 10 allows you to set the VB6.EXE compatibility mode to Windows Vista (Service Pack 2).
DO NOT DO THIS.
Do not run the VB6 IDE in compatibility mode of any kind. The suggested purpose is to fix anomalies in the graphic designer of the IDE. Believe me, these anomalies are nothing compared to the damage left in your windows registry when VB6.EXE is run in compatibility mode.
When VB6.EXE is used to Compile-And-Run your application, it replaces GUIDs and class and typelib registrations causing them to refer to its VB6DEBUG.DLL. this allows the IDE to intercept execution of your code so you can debug. When it does this replacement of your DLL and OCX registrations, it saves your stuff under HKCR\VBKeySave5. Unfortunately, when VB6.EXE is set to run in compatibility mode of an earlier verison of Windows, it fails to restore all of your DLL and OCX registration information. It leaves VBKeySave5 there, which causes your IDE to take much longer during subsequent starts of the IDE, and it trashes your registry, eventually rendering your application not-runnable on your machine.