0

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
Community
  • 1
  • 1
seablue
  • 25
  • 2
  • 7
  • sorry are you trying to put the breakpoint in the generated files? (under the dynamic folder) ? – federico scamuzzi Feb 01 '17 at 08:02
  • No not trying to add to generated files while the app is running/debugging. But trying to add a breakpoint anywhere in a regular javascript file. – seablue Feb 01 '17 at 08:11
  • You need to add it in the generated files – Peter Smith Feb 01 '17 at 08:12
  • yeah ..you can'rt put it in your source code..but you've to put in the generated files ... you can see them in the folder that isn't before in your solution (you see it only when you debug with IE) – federico scamuzzi Feb 01 '17 at 08:13
  • I can't add in generated files either. I get the same error. Also I am fairly certain that I have been able to add in source code before. – seablue Feb 01 '17 at 08:18

2 Answers2

0

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.

Jervie Vitriolo
  • 398
  • 5
  • 17
0

Set 'Configuration Manager' => Debug enter image description here

Kazem Maleki
  • 179
  • 3
  • 6