Thanks Andrew..will try your function...i used smart inpect which does all
of this but not needed all the time

 

From: [email protected] [mailto:[email protected]]
On Behalf Of Andrew McGrath
Sent: Wednesday, 21 May 2014 11:19 AM
To: ozDotNet
Subject: re: debugging object

 

Not exactly sure what you are looking for in terms of a nuget package but I
do the following:

 

In the exception handler I call my own Debug.ReportException method to which
I would pass the properties of the "interesting" object as List<string>,
then I include the stack trace by calling this code:

 

 public List<string> StackTraceToString()

        {

            List<string> sb = new List<string>();

            var frames = new
System.Diagnostics.StackTrace(true).GetFrames();

            for (int i = 1; i < frames.Length; i++) /* Ignore current
StackTraceToString method...*/

            {

                var currFrame = frames[i];

                var method = currFrame.GetMethod();

                sb.Add(string.Format("{0}:{1}",

                    method.ReflectedType != null ? method.ReflectedType.Name
: string.Empty,

                    method.Name + " Line: " +
currFrame.GetFileLineNumber()));

            }

            return sb;

        }

 

and finally everything via an email to myself - the email being generated
via SQL Server via script I found on the web.

 

You probably want to add a utility routine to generically grab all the
object properties as List<string> and then could pick which object to
interrogate as part of your exception handler.

 

Andrew

  _____  

From: [email protected]
Sent: Wednesday, May 21, 2014 10:32 AM
To: [email protected]
Subject: debugging object

Anyone aware or use any tools to debug code at object level. Want to be
able to out an object and its property values so i can get more info when an
exception occurs in my winforms app? Maybe a nugget package?





Anthony Salerno | Founder | SmallBiz Australia
Innovation | Web | Software | Developers | Support
+613 8400 4191 | 2Anthony (at) smallbiz.com.au | Po Box 135, Lower Plenty
3093 ABN : 16 079 706 737

www.smallbiz.com.au <http://www.smallbiz.com.au/> |
www.linkedin.com/in/innovativetechnology















Reply via email to