I'm trying to debug a C#/.Net program in Visual Studio 2010 but it's timing-sensitive so breakpoints mess it up. So I just want to log certain events and their relative times and watch them as my program is running.
Does Visual Studio (or C# or .Net) have any facility for writing to a log file that Visual Studio can display as a debug window?
When I do Android development in Eclipse I can take advantage of their Log class and insert lines that looks like this in my code:
Log.d("Label1", "Hit checkpoint X");
And they will appear along with time/date stamps in the LogCat window which is displayed along with other windows in Eclipse.
What's the closest equivalent to this in Visual Studio 2010?
You can set a breakpoint that doesn't actually break, but outputs a log message instead. Just set a breakpoint, then right click on the breakpoint and select "When Hit...".
From that dialog select "Print a message" and "continue execution"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With