7

Since few days, debugger does not work anymore. I've tried several things without success.

  • typescript 0.9.1
  • VS2012
  • IE10
  • the source map, JS files are updated when I save the TS files

In Visual studio at the place of the breakpoint I've got: 'The breakpoint will not currently be hit. No symbols have been loaded for this document'

  • Any help?

  • How IE load the symbols? I assume it's related to the source map ...

Thank in advance

Richard

rlasjunies
  • 319
  • 1
  • 5
  • 11
  • I've had to clear the browser cache. I've had to delete the map file explicitly and rebuild. I've confirmed that the `//# sourceMappingURL=/path/to/file.js.map` comment is the last line in the output JS file. Usually things start to work. Sometimes, I've resorted to just adding `debugger;` – WiredPrairie Nov 03 '13 at 11:54
  • thk, I don't have the 'sourceMapping' line at the end of my js files. Do you know how this file arrive there? Where do you put the 'debugger;' line? – rlasjunies Nov 03 '13 at 15:14
  • in fact, the line `//# sourceMappingURL=/path/to/file.js.map`appears when a save the file, and then disappears when I 'F5/Run' the project. I will have a look on the build conf – rlasjunies Nov 03 '13 at 15:30

4 Answers4

2

I had a similar problem, but with Visual Studio 2013. No breakpoints were hit, even though I was running in debug mode and with source maps generated.

I found out that after I included the compiled .js files in the project, my breakpoints in TypeScript started hitting.

  • do you use the same environment as rlasjunies or chrome or firefox? just trying to figure out if the article I linked in my answere is not off its mark. cheers :) – Dmitry Matveev Jun 23 '14 at 11:40
  • Strange, I found that when I included the JS file in my project, that this broke "compile on save" and did nothing to fix the lack of being able to step through the TS code. – Chad Oct 16 '14 at 02:33
1

Here is the answer (of my question ... with the help of WiredPrairie, ... ;-) )

This line

<Import Project="$(VSToolsPath)\TypeScript\Microsoft.TypeScript.targets" Condition="'$(BuildingInsideVisualStudio)' == 'true'" />

was preceeding my lines

 <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
    <TypeScriptTarget>ES5</TypeScriptTarget>
    <TypeScriptRemoveComments>true</TypeScriptRemoveComments>
    <TypeScriptSourceMap>true</TypeScriptSourceMap>
    <TypeScriptModuleKind>AMD</TypeScriptModuleKind>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)' == 'Release'">
    <TypeScriptTarget>ES5</TypeScriptTarget>
    <TypeScriptRemoveComments>true</TypeScriptRemoveComments>
    <TypeScriptSourceMap>true</TypeScriptSourceMap>
    <TypeScriptModuleKind>AMD</TypeScriptModuleKind>
  </PropertyGroup>

So I put it AFTER ( what a smart guys, isn't it ;-) ) in my *.csproj

I found the problem because:

  1. The //# sourceMappingURL=/path/to/file.js.map was generated at the end of the *.js files when saving, not when compiling.

  2. The build output was saying The TypeScript Compiler was given an empty configurations string, which is unusual and suspicious..

The solution comes from this post: TypeScript Compiler was given an empty configurations string.

The root cause of the problem appears when I tried to deploy my project to Azure. The js files were not uploaded/compiled, so i've added this tricky line in the csproj bad luck :-(

Thank and I hope it will help others.

Community
  • 1
  • 1
rlasjunies
  • 319
  • 1
  • 5
  • 11
1

The following is for people who are using Chrome or Firefox for the environment...

Apparently you just simply can't get it to work with VS but not all is lost as the author of this article shows. Hope it helps some more struggles to get debugging :)

Dmitry Matveev
  • 5,320
  • 1
  • 32
  • 43
1

In my case the answer was that another script file was actually used by the html. Once this was fixed, breakpoints started working, of course.

MiN
  • 175
  • 1
  • 12