Breaking the code execution on a breakpoint when debugging a multi-threaded application might change the execution flow of the different threads so much that you get a totally different scenario than you will have in production.
This problem can be remedied by converting breakpoints to tracepoints. A tracepoint can write text to the Output window and continue execution without stopping.
Set a tracepoint by first setting a breakpoint, right click it and select "Actions".
The message to be logged can contain predefined variables like
$CALLER - Name of the function calling the current function
$FUNCTION - Name of the current function
$TID - ID of the current thread
You can also get the value of a variable by using curly braces, like this: {variable_name}
When a breakpoint has been changed to a tracepoint the red bullet is changed to a diamond.
One call to the method in the image above results in this text being logged:
In MineSweeper.Program.TryParseDirection(string, out MineSweeper.Direction), called with directionStr = "S"
Inga kommentarer:
Skicka en kommentar