rlasjunies
rlasjunies

Reputation: 339

typescript debug / breakpoint does not work

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

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'

Thank in advance

Richard

Upvotes: 7

Views: 12621

Answers (4)

MiN
MiN

Reputation: 185

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.

Upvotes: 1

rlasjunies
rlasjunies

Reputation: 339

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.

Upvotes: 1

Dmitry Matveev
Dmitry Matveev

Reputation: 5376

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 :)

Upvotes: 1

Mika Berglund
Mika Berglund

Reputation: 21

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.

Upvotes: 2

Related Questions