Visual Studio 2019 - Breakpoint will not hit and showing source code different from entirely different project - .Net Core

Debayan Mitra 1 Reputation point

I am working on a Microservice based solution where in my same VS 2019 solution I have multiple microservice APIs, one API Gateway and two ASP.NET MVC presentation layer project. Everything was fine, till one day one of the presentation layer project's Startup.cs debug breakpoint will not hit.

On hovering it shows, "The breakpoint will currently not hit. A copy of Startup.cs was found in <AnotherASP.NETMVCProject.dll>, but the current source code is different from the version built into <AnotherASP.NETMVCProject.dll>".

Now the another MVC presentation project that I have, debugging works fine in its startup. Its weird why one MVC project debugging will not work stating source code is different in another MVC project. Also no source code modifications are done.

Tried the following. Got no luck:

  1. Clean entire solution, rebuild
  2. Delete breakpoints, clean and rebuild and then add breakpoints and run
  3. Restarted machine, clean, rebuild
  4. Deleted manually all Bin folder contents and clean again and rebuild
  5. Closed VS, deleted ASP.NET temporary files and then restarted VS, clean and build

I am at wit's end as to why this would happen all of a sudden. This seems like a VS 2019 bug. But any solution or workaround will help.

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
35,029 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Dylan Zhu-MSFT 6,396 Reputation points

    Hi DebayanMitra,

    Thank you for your feedback and taking the time to reach out to us.

    According to this error, maybe you could refer to this similar thread, and check if your IIS was configured to use another project. Or you could run cmd in administrator mode, and run this command: iisreset to reset your IIS.

    In addition, please check if there are some modifications you missed in project properties.

    Note: please make sure if the "App URL" contains an application name.

    If it doesn't work, since VS calls IIS express or IIS to debug mvc application, we also suggest you could post this question in IIS forum, the community members would provide better support about it.

    Best Regards,