@@ -113,6 +113,28 @@ public void DebuggerStepThroughMethod()
113
113
{
114
114
Console . WriteLine ( $ "Debugger stepped through this method.") ;
115
115
}
116
+
117
+ /// <summary>
118
+ /// Trace and debug messages
119
+ /// This shows in Immediate Window (Ctrl + Alt + I)
120
+ /// e.g. Input in Immediate window (after build): ?(new DebuggingSample().Execute())
121
+ /// </summary>
122
+ public void ImmediateWindowMessages ( )
123
+ {
124
+ Trace . WriteLine ( "Some Trace messages to follow:" ) ;
125
+ Trace . IndentSize = 2 ;
126
+ Trace . Indent ( ) ;
127
+ Trace . TraceInformation ( "This is Trace information." ) ;
128
+ Trace . Indent ( ) ;
129
+ Trace . TraceInformation ( "This is Trace information - indented." ) ;
130
+ Trace . Unindent ( ) ;
131
+ Trace . TraceWarning ( "This is Trace Warning." ) ;
132
+ Trace . TraceError ( "This is Trace Error." ) ;
133
+ Trace . Unindent ( ) ;
134
+ Trace . Flush ( ) ;
135
+ //
136
+ Debug . WriteLine ( "This is Debug Line." ) ;
137
+ }
116
138
}
117
139
118
140
public class DebuggingSample : SampleExecute
@@ -121,12 +143,17 @@ public override void Execute()
121
143
{
122
144
Title ( "DebuggingSampleExecute" ) ;
123
145
Section ( "Creating class (if breakpoint is used here, debugger output will be formatted as in DebuggerDisplay())" ) ;
146
+
124
147
DebuggerExamplesDebuggerDisplay debuggerExample = new DebuggerExamplesDebuggerDisplay ( ) ;
125
148
//set breakpoint on next line and hover over "debuggerExample" variable
126
149
debuggerExample . DebuggerStepThroughMethod ( ) ;
127
150
debuggerExample . ExecuteOnlyInDebugMode ( ) ;
128
151
debuggerExample . ExecuteOnlyInReleaseMode ( ) ;
129
152
debuggerExample . RuntimeDebuggerAttached ( ) ;
153
+
154
+ Section ( "Immediate Window Messages" ) ;
155
+ debuggerExample . ImmediateWindowMessages ( ) ;
156
+
130
157
Finish ( ) ;
131
158
}
132
159
}
0 commit comments