How to debug Typescript in Visual Studio 2015 asp.net 5?

Debugging TypeScript with Visual Studio works with the right settings.

  1. First you make sure that you create source maps when compiling TypeScript to JavaScript. So you should have an xxx.js.map file near every xxx.js.

    Getting source maps by running the TypeScript compiler outside of Visual Studio does not cause any difficulty, at the tsc command line add:

    --sourcemap %1.ts
    

    your gulp script will usually create sourcemaps by default.

  2. Configure your web application in Visual Studio.

    Set Internet Explorer as the start browser. I got it working only with IE and don’t think any other browser will work. (edit: Somewhere I read that there is a Webkit debugging bridge, so Chrome debugging should be possible, but I do not remember the source.)

    In the project properties go to the “Web” tab and configure the “Debuggers” section at the bottom: Disable all debuggers! This is counter intutitive and you might see this error message:

    You have attempted to start the debugger, but based on your current debug settings on the Web properties page there is no process to debug.

    This occurs when the “Don’t open a page. Wait for a request from another process” option is selected, and ASP.NET debugging is disabled. Please check your settings on the Web properties page and try again. As the error message says, the Start Action at the top of the Web properties should be another option, like “Current page“.

    Set breakpoints in your .ts code inside Visual Studio now or later.

    Hit F5

While you can use the Visual Studio Editor to debug and edit .ts files, “Edit and Continue” will not work, there is currently no browser that can reload .js and .js.map files and continue. (Correct me anyone if I am wrong and I will be happy.)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)