The breakpoint will not currently be hit - No executable code is associated with this line

11,698

Solution 1

The solutions in my case was to change build properties of the project.

Project properties -> Build -> Advanced (button) - Debugging information (select box) -> FULL.

Solution 2

The solutions above did not work for me on VS 2019 Version 16.8.3 targeting Core 3.1 or Net5. I cannot get breakpoints to work on JaveScript in *.cshtml files. Breakpoints set on Razor script does work in .cshtml though. For JS, the only workaround I've found is moving Java Script to .js files. The breakpoints work in *.js files as expected - for me anyway.

Share:
11,698
eridanix
Author by

eridanix

.NET Developer, c#, ASP.NET MS SQL Server

Updated on July 24, 2022

Comments

  • eridanix
    eridanix almost 2 years

    I have a problem to debug my ASP.NET Core 2 application. Suddenly all breakpoints in application cannot be hit.

    The breakpoint will not currently be hit. No executable code of the debugger's target is associated with this line.

    The message in tooltip on breakpoint after debugging start is:

    The breakpoint will not currently be hit. No executable code is associated with this line. Possible causes include: conditional compilation or complier optimizations, or the target architecture of this line is not supported by the current debugger code type.

  • quentin-starin
    quentin-starin almost 6 years
    While converting a two dozen project solution to SDK style csproj's and PackageReference's inside MVC3-5 csproj's and had one odd library in the middle that would not allow breakpoints to be set. Changing the debugging information to full for that project took care of it.
  • Chuck
    Chuck about 5 years
    This worked for me. Not sure why my breakpoints stopped being hit in the first place, but this did the trick.
  • Bronumski
    Bronumski about 5 years
    This was my problem
  • Jack
    Jack about 3 years
    This was certainly the most helpful comment for me using the latest visual studio in Feb 2021 - I ended up giving up the rabbit trail of trying to deal with the issue after hours of struggling, and just put the breakpoint in my js files.