How to make the application stop and start the debugger?

I have a .NET service and I need to debug it.

I want it to stop when it reaches a place in the code and start the debugger. Can someone provide sample code?

UPDATE

Just adding

Debugger.Launch(); 

not working for windows service.

+3
source share
4 answers

Try using Debugger.Break()according to this answer.

+5
source

Add Debugger.Launch();to the place of your code where you want to start debugging.

+4
source
  • , .
  • .
  • f, , false
  • bool f = true; () {//< -

    }

0

:

1) 2) 2) 3) 4) 5) Visual studio 6) - > 7) , 8) ,

-1

Source: https://habr.com/ru/post/1767851/


All Articles