Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run another process at debug mode?

I am writing a windows service. This service runs another process I've developed through Process class methods, but I want to run this process on debug mode also, using breakpoints, for instance.

How can I do this?

like image 682
Victor Rodrigues Avatar asked Apr 07 '26 16:04

Victor Rodrigues


1 Answers

When debugging a service, DebugBreak() is very nice. You can even debug the startup of the service, which can be very hard to time if you try to attach the process.

In C#

#if DEBUG
  System.Diagnostics.Debugger.Break();
#endif

In C++

#if DEBUG
  System.Diagnostics.Debugger.Break();
#endif

Also see the question: how can I use debugbreak() in C#.

like image 142
Ulf Lindback Avatar answered Apr 09 '26 06:04

Ulf Lindback



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!