How to use a message to display debugging information

I use MessageBox to try to do manual debugging, and that’s all I came up with, how should I make it work?

private void DisplayMessageBoxText()
        {
            MessageBox.Show("Alert Message");
        }
+3
source share
5 answers

I used http://www.gurock.com/smartinspect/ , which is great for recording various changes, can capture all kinds of objects, statuses, etc. plus you can leave it in your code, and if you have problems later, just connect to the listener and see what happens.

, , , , , /, , .

+3

, :

System.Diagnostics.Debug.WriteLine("Alert message");

:

System.Windows.Browser.HtmlPage.Window.Alert("Alert Message"); 
+6

:

Debug.Assert( - some condition - , "A condition failed");

.Assert , .

Tracepoints, , , Debug.

+2

, ?

MessageBox.Show("Error details here");

, , ...

0

, , , ?..

    private void DebugObject(object obj)
    {
        string printString = "";

        foreach (System.Reflection.PropertyInfo pi in obj.GetType().GetProperties())
        {
            printString += pi.Name + " : " + pi.GetValue(obj, new object[0]) + "\n" ;
        }

        MessageBox.Show(printString);
    }

. , .

( Jon Skeet : # VS 2005: ?)

0

All Articles