Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.7k views
in Technique[技术] by (71.8m points)

C# in Visual Studios: How to print to console during a break point

I do not normally code in C# and was wondering if Visual Studio had a particular debugging feature that is similar to the Python Debugger. In the PDB, during a breakpoint I will often print certain function calls and variables as well as test certain if statements. Although I can see variables in the 'locals' tab, I can't do print statements like list[i] or foo(var) or if(f(x) == 1) which I think are powerful debugging tools. Is this feature at all available in VS? Thanks for the help.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

In Visual Studio, you can "Insert Tracepoint" from the context menu under "Breakpoint". Alternatively, you can create a breakpoint and open its properties then set the "Actions" checkbox.

inserting tracepoint


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...