Search code examples
azurevisual-studio-2017remote-debuggingasp.net-core-1.1

visual studio 2017 remote debugging azure api app: "The breakpoint will not currently be hit. No symbols have been loaded for this document."


I'm trying to remote debug an asp.net core 1.1 api app (targeting .net framework 4.5.2) that's running on Azure.
I attach the debugger via Server Explorer. The debugger attaches to the correct process. But any breakpoint I set has the message "The breakpoint will not currently be hit. No symbols have been loaded for this document."
All answers I've seen to such a problem assume that the modules window shows all modules loaded by my project, but in my case the modules window is empty!
I'm on VS2017 15.4.
If I remember correctly, I was previously able to remote debug the same project with version 15.2. The problem started occurring when I updated to 15.3 but I didn't pursue it at the time.


Solution

  • I submitted the problem on the MS forums: Can't remote debug Azure API app

    and now I have received an official reply that it is indeed a bug in VS, and a fix will be available in the pending release (15.6).

    They also suggested a workaround, which I tried and indeed worked: Manually Attach a Debugger to Azure Web Apps

    Which involves:

    1. Going to the web app Application settings in the Azure portal, and making sure that Remote debugging is enabled,

    2. In the VS menu: Debug > Attach to Process..., entering the web app url with the debugging port, e.g.:

      myapp.azurewebsites.net:4022  
      
    3. Then in the credentials that appears, entering the username & password that are available in the app's Publish Profile, which can be downloaded from the portal. If the username is $myapp, it should be entered like this:

      $myappp\$myapp  
      
    4. Then choosing Managed(v4.6, v4.5, v4.0) code and then the name of the Core app.

    Actually, I had found and unsuccessfully tried similar approaches before. The key for me was step 3. The others had suggested entering the username as .\$myapp, or myapp\$myapp. So make sure to enter it as written above.

    BTW, seeing that the above blog post is from almost 2 years ago (Feb 2016), whereas the problem I'm experiencing was introduced only a few months ago, it seems to be a cure-all, and it is therefore worthwhile, for anyone who has to deal with remote debugging Azure apps, to save this information for future reference.

    UPDATE: After updating VS 2017 to version 15.5.2 the problem seems to have been fixed.