Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

analyse c# application dump file

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.

like image 294
Pierre Avatar asked Jul 11 '10 12:07

Pierre


1 Answers

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.

like image 153
Abel Avatar answered Nov 08 '22 07:11

Abel