0

Possible Duplicate:
How to Debug .net applications without Visual Studio

Hi i made a small program it works for me and for a few people

but its being crashed at a friend

how can i debug and learn which lines exactly causes error?

without installing visual studio 
2
  • you can check this out stackoverflow.com/questions/819446/… Commented Oct 13, 2012 at 11:22
  • What are your constraints? Can you install another IDE? Can you install other software at all? Can you change the source code? Commented Oct 13, 2012 at 11:28

4 Answers 4

3

Best you can do is (and is a good coding practice) in a new buid add try catch exception block in methods with logging facility that logs(in catch block) in lets say a text file

  1. Method Name (Find using new StackTrace()..GetFrame(1).GetMethod().Name or System.Reflection.MethodBase.GetCurrentMethod().Name),
  2. its parameters and
  3. Exception message.
Sign up to request clarification or add additional context in comments.

1 Comment

I would save the parameters and the exception.ToString() which has already the complete stack trace.
2

If you don't mean "without installing a debugger" you could try using Mono.

Comments

1

You can use WinDbg which can be run portable (xcopy from an existing installation), and with the SoS add-on it can help a lot in debugging C# applications - even in post mortem. It might be difficult to grasp at first, but it's worth learning - it will come very useful in several situations.

SoS reference here : http://msdn.microsoft.com/en-us/library/bb190764.aspx

I have this quick cheat-sheet with what I found most useful (found somewhere on the internet and then enriched with time) :

Starting, Attaching, Executing and Exiting Start -> All Programs -> Debugging Tools for Windows -> WinDbg F6 attach to process Ctrl-Break interrupt debugee .detach detach from a process g continue debugee execution q exit WinDbg Getting Help ? help on commands that affect the debugee .help help on commands that affect the debugger .hh command view the on line help file !help help on the extension dll at the top of the chain (e. g., SOS) Issuing Commands up arrow, down arrow, enter scroll through command history Right mouse button paste into command window Examining the Unmanaged Environment lmf list loaded modules with full path lmt list loaded modules with last modified timestamp ~ list unmanaged threads ~thread s select a thread for thread specific commands !token -n view thread permissions k view the unmanaged call stack !runaway view thread CPU consumption bp set a breakpoint .dump path dump small memory image .dump /ma path dump complete memory image Working with Extension DLLs (e. g., SOS) .chain list extensions dlls .load clr10\sos load SOS for debugging framework 1.0 / 1.1 (use .unload to unload) .loadby sos mscorwks load SOS for debugging framework 2.0 .loadby sos clr load SOS for debugging framework 4.0 SOS Commands !threads view managed threads !clrstack view the managed call stack !dumpstack view combined unmanaged & managed call stack !clrstack -p view function call arguments !clrstack –l view stack (local) variables !name2ee module class view addresses associated with a class or method !dumpmt –md address view the method table & methods for a class !dumpmd address view detailed information about a method !do address view information about an object !dumpheap –stat view memory consumption by type !dumpheap –min size view memory consumption by object when at least size !dumpheap –type type view memory consumption for all objects of type type !gcroot address view which object are holding a reference to address !syncblk view information about managed locks SOS 2.0 Commands !bpmd module method set breakpoint !DumpArray address view contents of an array !PrintException view information about most recent exception 

Comments

0

If you don't want to install any other debugger,

Then you should simply implement trace and log on each section of code carefully and then you can view the traces or errors on the text file..

Ways to implement trace and log:

use can use TraceListener class on system.diaognosis namespace or use

Microsoft.Practices.EnterpriseLibrary.Logging namespace's class `Logger` to implement tracing: 

syntax:

Logger.Write(message, "Trace", 0, 0, System.Diagnostics.TraceEventType.Information); 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.