分析 C# 应用程序转储文件

发布于 2024-09-08 23:51:18 字数 1448 浏览 6 评论 0 原文

我编写了一个 C# 应用程序,它在 XP 上运行良好,但在 Vista/7 上冻结。 我得到了一个应用程序转储(dmp 文件)来分析问题。 我不明白如何在 C# 中获取堆栈跟踪(因为我当然有源代码)。 我加载了符号,但似乎没有加载托管代码,这里是堆栈跟踪:

ntdll.dll!_KiFastSystemCallRet@0()  
user32.dll!_NtUserWaitMessage@0()  + 0xc bytes  
System.Windows.Forms.ni.dll!68bb8ea8()  
[Frames below may be incorrect and/or missing, no symbols loaded for System.Windows.Forms.ni.dll]   
System.Windows.Forms.ni.dll!68bb8ea8()  
System.Windows.Forms.ni.dll!68bb8997()  
System.Windows.Forms.ni.dll!68bb87e1()  
System.Windows.Forms.ni.dll!68b75931()  
mscorwks.dll!_CallDescrWorker@20()  + 0x33 bytes    
mscorwks.dll!_CallDescrWorkerWithHandler@24()  + 0x9f bytes 
mscorwks.dll!MethodDesc::CallDescr()  + 0x15a bytes 
mscorwks.dll!MethodDesc::CallTargetWorker()  + 0x1f bytes   
mscorwks.dll!MethodDescCallSite::CallWithValueTypes_RetArgSlot()  + 0x1a bytes  
mscorwks.dll!ClassLoader::RunMain()  - 0x39040 bytes    
mscorwks.dll!Assembly::ExecuteMainMethod()  + 0xa4 bytes    
mscorwks.dll!SystemDomain::ExecuteMainMethod()  + 0x416 bytes   
mscorwks.dll!ExecuteEXE()  + 0x49 bytes 
mscorwks.dll!__CorExeMain@0()  + 0x98 bytes 
mscoreei.dll!71f455ab()     
mscoree.dll!_ShellShim__CorExeMain@0()  + 0x227 bytes   
mscoree.dll!__CorExeMain_Exported@0()  + 0x8 bytes  
kernel32.dll!@BaseThreadInitThunk@12()  + 0x12 bytes    
ntdll.dll!___RtlUserThreadStart@8()  + 0x27 bytes   
ntdll.dll!__RtlUserThreadStart@8()  + 0x1b bytes

任何帮助将不胜感激。

I wrote a C# application that is running well on XP but freeze on Vista/7.
I got an application dump (dmp file) for analysing the problem.
I don't understand how to get the stack trace in C# (as I have of course the source code).
I loaded symbols but it doesn't seem to load managed code, here is the stack trace :

ntdll.dll!_KiFastSystemCallRet@0()  
user32.dll!_NtUserWaitMessage@0()  + 0xc bytes  
System.Windows.Forms.ni.dll!68bb8ea8()  
[Frames below may be incorrect and/or missing, no symbols loaded for System.Windows.Forms.ni.dll]   
System.Windows.Forms.ni.dll!68bb8ea8()  
System.Windows.Forms.ni.dll!68bb8997()  
System.Windows.Forms.ni.dll!68bb87e1()  
System.Windows.Forms.ni.dll!68b75931()  
mscorwks.dll!_CallDescrWorker@20()  + 0x33 bytes    
mscorwks.dll!_CallDescrWorkerWithHandler@24()  + 0x9f bytes 
mscorwks.dll!MethodDesc::CallDescr()  + 0x15a bytes 
mscorwks.dll!MethodDesc::CallTargetWorker()  + 0x1f bytes   
mscorwks.dll!MethodDescCallSite::CallWithValueTypes_RetArgSlot()  + 0x1a bytes  
mscorwks.dll!ClassLoader::RunMain()  - 0x39040 bytes    
mscorwks.dll!Assembly::ExecuteMainMethod()  + 0xa4 bytes    
mscorwks.dll!SystemDomain::ExecuteMainMethod()  + 0x416 bytes   
mscorwks.dll!ExecuteEXE()  + 0x49 bytes 
mscorwks.dll!__CorExeMain@0()  + 0x98 bytes 
mscoreei.dll!71f455ab()     
mscoree.dll!_ShellShim__CorExeMain@0()  + 0x227 bytes   
mscoree.dll!__CorExeMain_Exported@0()  + 0x8 bytes  
kernel32.dll!@BaseThreadInitThunk@12()  + 0x12 bytes    
ntdll.dll!___RtlUserThreadStart@8()  + 0x27 bytes   
ntdll.dll!__RtlUserThreadStart@8()  + 0x1b bytes

Any help would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笑红尘 2024-09-15 23:51:18

分析转储文件不适合胆小的人,需要一些练习。 高级 .NET 调试 的前几章提供了精彩的介绍,其中向您展示了如何使用Windows 调试工具、SOS 调试器扩展(需要使用本机调用映射托管代码,您在此处需要),即 .NET SDK 的一部分SOSEX 调试器扩展 添加了几个强大的 SOS 扩展命令。

如果您以前从未使用过 NTSD、WinDbg、SOS,或者相对虚拟地址等术语不熟悉,我强烈建议您阅读本书的前几章。只需要投入几个小时,突然之间,一个全新的世界就为您打开了。它并不会让调试变得轻而易举(当问题很复杂时几乎不会如此),但它确实向您展示了解决此类问题的正确路径。

恐怕仅仅看上面的转储并不能告诉我们太多信息。如果您无法在 Visual Studio 中重现该错误,NTSD 或 WinDbg 是您的好帮手。我从这里唯一可以知道的是,您的入口点是来自 mscoree.dll 的 _CorExeMain。但这是每个 .NET 程序集的引导程序。随后,加载了一个表单并执行了一些代码,但到底是什么?如果没有可执行文件、PDB,最好还有源文件,就很难说出任何有用的信息。

Analyzing dump files is not for the faint of heart and requires a bit of exercise. An excellent introduction are the first few chapters of Advanced .NET Debugging which shows you how to use the Debugging Tools for Windows, the SOS debugger extension (required to map managed code with native calls, which you require here) which is part of the .NET SDK and the SOSEX debugger extension which adds a couple of powerful extension commands to SOS.

If you've never used NTSD, WinDbg, SOS before, or if terms as Relative Virtual Address don't ring a bell, I highly recommend reading the first chapters of this book. It requires an investment of only a few hours and all of a sudden a whole new world opens for you. It doesn't make debugging a breeze (it hardly ever is when the problems are complex) but it does show you the right path to take to tackle this sort of problems.

Just looking at the dump above doesn't tell us much, I'm afraid. If you cannot reproduce the error from within Visual Studio, NTSD or WinDbg is your friend. The only thing I can tell from here is that your entry point is _CorExeMain from mscoree.dll. But that's the bootstrap of every .NET assembly. Later, a form is loaded and some code is executed, but what exactly? Without your executable, PDB and preferably also your source files, it'll be hard to tell anything useful.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文