I have a DLL with some COM objects. Sometimes, this objects crashes and register an error event in the Windows Event Log with lots of hexadecimal informations. I have no clue why this crashes happens.
我有一个带有一些COM对象的DLL。有时,此对象崩溃并在Windows事件日志中注册具有大量十六进制信息的错误事件。我不知道为什么会发生这种崩溃。
So, How can I trace those COM objects exceptions?
那么,我如何跟踪那些COM对象异常?
4 个解决方案
#1
2
The first step is to lookup the Fail code's hex value (E.G. E_FAIL 0x80004005). I've had really good luck with posting that value in Google to get a sense of what the error code means.
第一步是查找失败代码的十六进制值(E.G. E_FAIL 0x80004005)。我已经非常幸运地在谷歌发布了这个价值,以了解错误代码的含义。
Then, I just use trial and error to try to isolate the location in code that's failing, and the root cause of the failure.
然后,我只是使用反复试验来尝试隔离代码中失败的位置以及失败的根本原因。
#2
1
If you just want a really quick way to find out what the error code means, you could use the "Error Lookup" tool packaged with Visual Studio (details here). Enter the hex value, and it will give you the string describing that error code.
如果您只是想快速找出错误代码的含义,可以使用Visual Studio打包的“错误查找”工具(详情请参见此处)。输入十六进制值,它将为您提供描述该错误代码的字符串。
Of course, once you know that, you've still got to figure out why it's happening.
当然,一旦你知道了,你仍然要弄清楚它为什么会发生。
#3
1
A good way to look up error (hresult) codes is HResult Plus or welt.exe (Windows Error Lookup Tool).
查找错误(hresult)代码的好方法是HResult Plus或welt.exe(Windows错误查找工具)。
I use logging internally in the COM-classes to see what is going on. Also, once the COM-class is loaded by the executable, you can attach the VS debugger to it and debug the COM code with breakpoints, watches, and all that fun stuff.
我在COM类中内部使用日志记录来查看发生了什么。此外,一旦可执行文件加载了COM类,您就可以将VS调试器附加到它,并使用断点,监视和所有有趣的东西来调试COM代码。
#4
1
COM objects don't throw exceptions. They return HRESULTs, most of which indicate a failure. So if you're looking for the equivalent of an exception stack trace, you're out of luck. You're going to have to walk through the code by hand and figure out what's going on.
COM对象不会抛出异常。他们返回HRESULT,其中大部分表示失败。因此,如果您正在寻找等效的异常堆栈跟踪,那么您运气不好。您将不得不手动浏览代码并弄清楚发生了什么。
#1
2
The first step is to lookup the Fail code's hex value (E.G. E_FAIL 0x80004005). I've had really good luck with posting that value in Google to get a sense of what the error code means.
第一步是查找失败代码的十六进制值(E.G. E_FAIL 0x80004005)。我已经非常幸运地在谷歌发布了这个价值,以了解错误代码的含义。
Then, I just use trial and error to try to isolate the location in code that's failing, and the root cause of the failure.
然后,我只是使用反复试验来尝试隔离代码中失败的位置以及失败的根本原因。
#2
1
If you just want a really quick way to find out what the error code means, you could use the "Error Lookup" tool packaged with Visual Studio (details here). Enter the hex value, and it will give you the string describing that error code.
如果您只是想快速找出错误代码的含义,可以使用Visual Studio打包的“错误查找”工具(详情请参见此处)。输入十六进制值,它将为您提供描述该错误代码的字符串。
Of course, once you know that, you've still got to figure out why it's happening.
当然,一旦你知道了,你仍然要弄清楚它为什么会发生。
#3
1
A good way to look up error (hresult) codes is HResult Plus or welt.exe (Windows Error Lookup Tool).
查找错误(hresult)代码的好方法是HResult Plus或welt.exe(Windows错误查找工具)。
I use logging internally in the COM-classes to see what is going on. Also, once the COM-class is loaded by the executable, you can attach the VS debugger to it and debug the COM code with breakpoints, watches, and all that fun stuff.
我在COM类中内部使用日志记录来查看发生了什么。此外,一旦可执行文件加载了COM类,您就可以将VS调试器附加到它,并使用断点,监视和所有有趣的东西来调试COM代码。
#4
1
COM objects don't throw exceptions. They return HRESULTs, most of which indicate a failure. So if you're looking for the equivalent of an exception stack trace, you're out of luck. You're going to have to walk through the code by hand and figure out what's going on.
COM对象不会抛出异常。他们返回HRESULT,其中大部分表示失败。因此,如果您正在寻找等效的异常堆栈跟踪,那么您运气不好。您将不得不手动浏览代码并弄清楚发生了什么。