0

I am trying to remotely debug a project with ASP.NET Core 2.1 that uses IIS as a server using the remote debugger tool, since I was able to establish the connection to the remote server and debug some things using breakpoints, the problem that is currently happening to me is that I can debug the file code as controllers,services, but I cannot debug the Program.cs file code using breakpoints.

Any ideas?

Andres Camacho
  • 367
  • 4
  • 17
  • 1
    https://stackoverflow.com/a/22238640/11182 Try to let your app wait for a debugger to attach. Then you can attach remotely to the right process to trigger the following execution. – Lex Li Jul 30 '20 at 23:22

1 Answers1

0

you could check the below things if you are not getting any error but breakpoint didn’t hit:

1)if you are running your code on more than one machine so the first check you are debugging the correct place code.

2)make sure your codding is running and you set the System.Diagnostics.Debugger.Break or __debugbreak( for c++) in your code where you want to set the breakpoint. (do not forget to build your project after adding this code)

3)If you are debugging optimized code, make sure the function where your breakpoint is set isn’t being inlined into another function. The Debugger.Break test described in the previous check can work to test this issue as well.

Add a call to Launch at the beginning of the OnStart()method.

protected override void OnStart(string[] args)
{
    System.Diagnostics.Debugger.Launch();
}

How to: Debug the OnStart Method

Jalpa Panchal
  • 8,251
  • 1
  • 11
  • 26