A breakpoint could not be inserted at this locatio

2019-09-07 00:36发布

问题:

I can't set a breakpoint in JavaScript files in my MVC projects in Visual Studio Community 2015 Update 3. I get this error at bottom left of Visual Studio.

A breakpoint could not be inserted at this location

I can set breakpoints in C# files, but not JavaScript files.

Here is what I've done so far to troubleshoot:

  • checked web.config includes: compilation debug="true"
  • solution configuation set to "Debug"
  • browser is Internet Explorer
  • added BundleTable.EnableOptimizations = false; to BundleConfig.cs
  • tried adding breakpoints in both generated files during debugging as well as source code JS files when not running
  • Rebuilt project, restarted Visual Studio
  • Repaired Visual Studio
  • Created new projects with both .Net Framework 4.5.2 and 4.6.1
  • also tried all suggestions listed in this post Breakpoint Failed to Bind - Visual Studio 2015

回答1:

You really can't debug a javascript code on vs2015 and below but on vs2017 its already possible. Just make sure to Enable JavaScript debugging for ASP.NET by going to Debug>Debugging>General menu.



回答2:

Set 'Configuration Manager' => Debug