[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Debugging

Posted on 2007-03-23
11
Medium Priority
?
277 Views
Last Modified: 2013-11-26
I am attempting to debug an application written in C# with Studio 2005.  I am having a serious problem where my application will freeze up completely and I cannot determine where it is happening at.  There will be no respose at all.  Is there a tool of some sort that can monitor code and keep track of the last line of code executed, so I can run my application and find out the last line executed when it locks up????
0
Comment
Question by:gvector1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
11 Comments
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 18781974
Yes take a look at using a minidump. http://www.codeproject.com/debug/postmortemdebug_standalone1.asp?df=100&forumid=3419&exp=0&fr=26 you can then open it in VS and load SOS ... once you do that type in the immediate window !CLRStack and you will see the exact call stack at the time the minidump was taken .. you can see this for all threads.

Cheers,

Greg
0
 
LVL 11

Expert Comment

by:DeanHorak
ID: 18781990
I  don't have any magic tool to recommend for you, but I'll share the technique I use in these cases.

The way I usually handle these kinds of issues is to run the app in debug mode with a breakpoint at the last place I know that things are still ok (start at the very first line of the app if you have to).

Then I "step over" each code section (making a note of where I am before I do the step-over) until it locks up. I then go back and restart the process in debug mode, setting a breakpoint at the point where I was last before the "step-over" that resulted in a lockup. This time I do a "Step Into" and then repeat the "step-over" technique as before until it locks again. I just repeat this process, each time drilling down a little deeper into the logic until I find the exact statement causing the lockup.

Hope this helps...
0
 

Author Comment

by:gvector1
ID: 18782455
The problem is that if I set a breakpoint in the area the lockup occurs and then continue after the breakpoint, I NEVER get a lockup.  I only get a lockup if it runs straight through without a breakpoint, and even then, it is not consistent.  It seems to happen at different points.  I determined this by using Debug.Writeline in different spots.  Like I said I was looking for something that can possibly tell me the last lines of code executed.

GregoryYoung,
That is a very interesting article, but it only seems to work with applications that generate an exception.  I only with my application was generating an exception.  It locks up and is unresponsive, therefore I get no information as to the cause or location of the problem.

Any suggestions.....
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 37

Expert Comment

by:gregoryyoung
ID: 18782498
gvector its all about opening a minidump ... it shows you how to get a minidump at an exception but you can take a minidump at any point ... There are even small utilities that will take a minidump of your app for your (dr watson comes to mind) .. once you have that minidump the process is the same (i.e. load it up in debugger etc)
0
 

Author Comment

by:gvector1
ID: 18782976
All I can seem to find is Dr Watson For Windows.  The codeproject article is all about C++ and not working from a C# standpoint.  How can I get Dr Watson and use it to take a minidump when my application is locked up???
0
 

Author Comment

by:gvector1
ID: 18783022
I also have an issue with the same application where all of a sudden the application closes completely out with no warning and no error message.  It is as if you clicked the X to close the application.  I have exception handling code, but it is never excuted, so I take it that it is not an exception.  Any recommendations on how to debug this problem as well.
0
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 18783102
well the second problem would be a bit more difficult since taking a minidump would be tough .. i would start logging in my app to try to find that.

minidumps can be taken by any outside process or your own process ... adplus is a common example, so is WER, windbg, cdb, etc etc. Taking a minidump isnt that tough I promise :)

http://msdn.microsoft.com/msdnmag/issues/05/03/Bugslayer/ includes some further information and may be of some use .. that whole article series is pretty good (there is also one on SOS). You also might want to check out a book by the author of those John Robbins which goes into much more detail on this kind of debugging.
0
 

Author Comment

by:gvector1
ID: 18795600
Can a dump help me if my application is not actually throwing an exception.  It just appears to be locking up and not responding to the point that I have to kill it through the Task Manager.  How can lockup situations like that be efficiently debugged.  A problem in some spots is that using breakpoints and stepping through the code does not lead me to a lockup, I think it is because some of the problems may be threading issues and if I breakpoint one of the threads, it ends up allowing the other thread to finish.  In some spots I think I am having threads clashing.  Any suggestions on how to get through this????
0
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 2000 total points
ID: 18795777
Yes it can.

see above ... a dump is nothing more than a snapshot of your application at a given point in time which you can then load up in a debugger (its kind of like hooking up a debugger without needing the debugger on the machine, it saves the state for you). In fact this is THE way to debug such issues as thread deadlocks.

0
 

Author Comment

by:gvector1
ID: 19126666
Sorry I haven't answered before now....I lost track of this post.

Thanks,
Kendal
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question