Debugging 应用程序验证程序停止:HKEY被泄漏

Debugging 应用程序验证程序停止:HKEY被泄漏,debugging,vsto,clr,windbg,application-verifier,Debugging,Vsto,Clr,Windbg,Application Verifier,在使用Application Verifier和windbg调试我的一个VSTO加载项时,我发现在Word close上我得到以下停止: VERIFIER STOP 00000902: pid 0x3F1C: An HKEY was leaked. 00000632 : Value of the leaked HKEY. 0422EA9C : Address to the allocation stack trace. Run dps <address> to view the

在使用Application Verifier和windbg调试我的一个VSTO加载项时,我发现在Word close上我得到以下停止:

VERIFIER STOP 00000902: pid 0x3F1C: An HKEY was leaked. 

00000632 : Value of the leaked HKEY.
0422EA9C : Address to the allocation stack trace. Run dps <address> to view the allocation stack.
1D3F6FE8 : Address of the owner dll name. Run du <address> to read the dll name.
74040000 : Base of the owner dll. Run .reload <dll_name> = <address> to reload the owner dll. Use 'lm' to get more information about the loaded and unloaded modules.
然后
du1d3f6fe8

返回

1d3f6fe8  "oledlg.dll"
有趣的是,如果我在Word上运行Application Verifier/WinDbg而没有加载加载项,我仍然会停止:

APPLICATION_VERIFIER_LEAK_ALLOCATION (900)
A heap allocation was leaked.
This stop is generated if the owner dll of the allocation was dynamically unloaded while owning resources. 
Arguments:
Arg1: 0b7e2fb8, Address of the leaked allocation. Run !heap -p -a <address> to get additional information about the allocation. 
Arg2: 041495f4, Address to the allocation stack trace. Run dps <address> to view the allocation stack. 
Arg3: 0c446fe4, Address of the owner dll name. Run du <address> to read the dll name. 
Arg4: 70b50000, Base of the owner dll. Run .reload <dll_name> = <address> to reload the owner dll. Use 'lm' to get more information about the loaded and unloaded modules. 
GetPageUrlData failed, server returned HTTP status 404
URL requested: http://watson.microsoft.com/StageOne/winword_exe/15_0_4737_1003/559b7227/vrfcore_dll/10_0_15063_137/f4688fdb/80000003/00003809.htm?Retriage=1
应用程序\u验证程序\u泄漏\u分配(900)
堆分配被泄漏。
如果在拥有资源时动态卸载了分配的所有者dll,则会生成此停止。
论据:
Arg1:0b7e2fb8,泄漏分配的地址。跑heap-p-a以获取有关分配的附加信息。
Arg2:041495f4,分配堆栈跟踪的地址。运行dps以查看分配堆栈。
Arg3:0c446fe4,所有者dll名称的地址。运行du读取dll名称。
Arg4:70b50000,所有者dll的基础。Run.reload=重新加载所有者dll。使用“lm”获取有关加载和卸载模块的更多信息。
GetPageUrlData失败,服务器返回HTTP状态404
请求的URL:http://watson.microsoft.com/StageOne/winword_exe/15_0_4737_1003/559b7227/vrfcore_dll/10_0_15063_137/f4688fdb/80000003/00003809.htm?Retriage=1

这是同一件事,但报告不同吗?

我深入研究了这一点,因为上面非常有用的评论指出,我认为这不是我的加载项代码的问题,而是VSTO主机应用程序ie.Word的问题

因此,我创建了一个简单的VSTO加载项,该加载项带有一个按钮功能区,可以打开一个带有标签的任务窗格,标签上写着“Hello!”(没有其他内容–没有WPF),我可以确认,即使在这种情况下,关闭时仍然会出现HKEY泄漏

为了完整性,当没有加载加载项时,我会得到不同的停止:

=======================================
VERIFIER STOP 0000000000000300: pid 0x4008: Invalid handle exception for current stack trace. 

    00000000C0000008 : Exception code.
    000000000F9DE670 : Exception record. Use .exr to display it.
    000000000F9DE180 : Context record. Use .cxr to display it.
    0000000000000000 : Not used.


=======================================
This verifier stop is continuable.
After debugging it use `go' to continue.

=======================================

ModLoad: 711a0000 711c5000   C:\windows\SysWOW64\POWRPROF.DLL


=======================================
VERIFIER STOP 00000900: pid 0x4008: A heap allocation was leaked. 

    0BDCCFB8 : Address of the leaked allocation. Run !heap -p -a <address> to get additional information about the allocation.
    041D9C54 : Address to the allocation stack trace. Run dps <address> to view the allocation stack.
    0C36AFE4 : Address of the owner dll name. Run du <address> to read the dll name.
    749C0000 : Base of the owner dll. Run .reload <dll_name> = <address> to reload the owner dll. Use 'lm' to get more information about the loaded and unloaded modules.


=======================================
=======================================
验证程序停止0000000000000 300:pid 0x4008:当前堆栈跟踪的无效句柄异常。
00000000 C0000008:异常代码。
000000000 F9DE670:异常记录。使用.exr来显示它。
000000000 F9DE180:上下文记录。使用.cxr来显示它。
0000000000000000:未使用。
=======================================
此验证器停止是可继续的。
调试后,使用“go”继续。
=======================================
ModLoad:711a0000 711c5000 C:\windows\SysWOW64\powrpof.DLL
=======================================
验证程序停止00000900:pid 0x4008:堆分配泄漏。
0BDCCFB8:泄漏分配的地址。跑heap-p-a以获取有关分配的附加信息。
041D9C54:分配堆栈跟踪的地址。运行dps以查看分配堆栈。
0C36AFE4:所有者dll名称的地址。运行du读取dll名称。
749C0000:所有者dll的基。Run.reload=重新加载所有者dll。使用“lm”获取有关加载和卸载模块的更多信息。
=======================================

!avrf
建议使用
应用程序验证程序\u泄漏\u分配(900)
因此,我认为除了应用程序验证程序之外,这是一个问题。

您尝试过上面的建议吗
dps 0422EA9C
等…请包括您尝试过的,所有建议命令的输出等。我们不是来猜您做了什么您应该运行
du 1D3F6FE8
来获取dll名称您所做的是在分配堆栈上执行反汇编看起来注册表句柄没有被清理,请尝试
!handle 00000 632 f
以显示
HKEY
信息可能是句柄已损坏或应用程序状态不允许您检查该句柄。无论如何,你有一个调用堆栈,所以你应该能够遵循它,看看哪里出了问题
=======================================
VERIFIER STOP 0000000000000300: pid 0x4008: Invalid handle exception for current stack trace. 

    00000000C0000008 : Exception code.
    000000000F9DE670 : Exception record. Use .exr to display it.
    000000000F9DE180 : Context record. Use .cxr to display it.
    0000000000000000 : Not used.


=======================================
This verifier stop is continuable.
After debugging it use `go' to continue.

=======================================

ModLoad: 711a0000 711c5000   C:\windows\SysWOW64\POWRPROF.DLL


=======================================
VERIFIER STOP 00000900: pid 0x4008: A heap allocation was leaked. 

    0BDCCFB8 : Address of the leaked allocation. Run !heap -p -a <address> to get additional information about the allocation.
    041D9C54 : Address to the allocation stack trace. Run dps <address> to view the allocation stack.
    0C36AFE4 : Address of the owner dll name. Run du <address> to read the dll name.
    749C0000 : Base of the owner dll. Run .reload <dll_name> = <address> to reload the owner dll. Use 'lm' to get more information about the loaded and unloaded modules.


=======================================