15

The way we are used to debug a running "IISExpress" process in .Net Framework is by attaching a process by the name "iisexpress.exe" in Visual Studio. But attaching the iisexpress process is not working in .Net core. It shows the message - "The breakpoint will not currently be hit. No symbols have been loaded for this document."

tech-y
  • 1,829
  • 2
  • 16
  • 26
  • related: https://stackoverflow.com/questions/50806765/to-which-process-should-i-attach-visual-studio-debugger-to-debug-a-kestrel-appli – Ruben Bartelink Dec 05 '18 at 14:31

4 Answers4

33

To debug a running iisexpress instance in .Net core, you will have to attach "dotnet.exe" process in Visual Studio.
*Update - 1: If dotnet.exe does not work for you, check "{projectName}.exe" as well. *Update -2: Attaching "iisexpress.exe" works with .net 5

tech-y
  • 1,829
  • 2
  • 16
  • 26
  • Thanks for sharing your solution here, you could mark it as the answer later. Have a nice day. – Fletcher Mar 16 '18 at 05:42
  • I think this is not working for .Net Core 3.0+ projects. Attaching to "dotnet.exe" process(es) gives me a warning message on the breakpoint. Attaching to the .exe does the job. – mihkov Jan 19 '21 at 17:56
  • For my case dotnet.exe required for outofprocess. No needed for inprocess hosting(w3wp.exe is enough) – Imran Qadir Baksh - Baloch Aug 01 '21 at 13:53
17

In Visual Studio 2019 using "dotnet watch run" I could no longer attach to the "dotnet.exe" process, I would get the Symbols could not be loaded error, took me a while to figure out but instead I attached to [project name].exe which is in the list of running processes and I could successfully attach the debugger to a process with symbols loaded and debug.

Daniel Archer
  • 191
  • 2
  • 6
1

In my case, using Asp.Net Core 2.2 with InProcess Hosting Model, the accepted answer doesn't work. But, I should choose from the menu Debug > Attach to process, then select the "Show processes from all users" checkbox (below the list of process) and select "iisexpress.exe". It works properly and hit the break points.

S.Serpooshan
  • 7,608
  • 4
  • 33
  • 61
1

Visual studio does not loads all dlls (don't know why). Try this:

1) First attach with w3wp.exe (for InProcess Hosting) or dotnet.exe (for OutOfProcess Hosting)

2) Load Symbols manually:

Go to Debug > Windows > Modules (or try shortcut Ctrl + Alt + U)

Search and select dll (and dependent dll's) which you want to debug and right click > Load Symbols.

Sumit Joshi
  • 1,047
  • 1
  • 14
  • 23