Skip to content

Visual studio 2015 typescript debugger breakpoint is not work as expected when enabling inlineSourceMap in tsconfig.json #8399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
halajohn opened this issue Apr 30, 2016 · 7 comments
Labels
External Relates to another program, environment, or user action which we cannot control.

Comments

@halajohn
Copy link

TypeScript Version:

1.8.10

Visual studio Version:

2015 community version update 2
typescript tools for visual studio 1.8.29.0

Code

any typescript code

Expected behavior:

Visual studio typescript debugger could correctly setup breakpoint red point at the line I double clicked.

Actual behavior:

When enable inlineSourceMap: true in tsconfig.json, when setting a breakpoint in VS editor, it can map that source line number from .ts file to the corresponding line number in the .js file, however, the breakpoint red point in the VS editor is shown on the line number in the .js file, rather than the line number on the .ts file. Therefore, if I double click on line 100 in one .ts file, the breakpoint red point would be shown on maybe line 90 of that .ts file, corresponding to what the mapped line number is in the corresponding .js file.

If I disable inlineSourceMap: true, and enable sourceMap: true in tsconfig.json, everything would be just fine.

I've noticed that there is a previous issue similar to this: #4360, and that issue is closed. Is my configuration wrong or missing something? Thanks.

My tsconfig.json:

{
  "compileOnSave": true,
  "compilerOptions": {
    "module": "commonjs",
    "target": "ES5",

    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true,
    "removeComments": false,
    "preserveConstEnums": true,
    "forceConsistentCasingInFileNames": true,
    "noEmitOnError": true,

    // "sourceMap": true,
    "inlineSourceMap": true,

    "inlineSources": true
  }
}
@mhegazy
Copy link
Contributor

mhegazy commented May 2, 2016

Is this running on node? if not what loader/bundler are you using? can you share your project? this does not repro for me with a vanilla project.

@mhegazy mhegazy added the Needs More Info The issue still hasn't been fully clarified label May 2, 2016
@halajohn
Copy link
Author

halajohn commented May 4, 2016

The simplest sample I tried is (one file only):

console.log("1");
// space
console.log("2");
// space
console.log("3");
// space
console.log("4");
// space
console.log("5");
// space
console.log("6");
// space
console.log("7");

if sourceMap: true, and run the VS debugger, when stop on a breakpoint, the VS editor would show the the content of the ts file where the breakpoint reside. but if inlineSourceMap: true, the VS editor would show the content of the js file where the breakpoint reside. And if you set a breakpoint on console.log("7"), inlineSourceMap: true would make the VS debugger not stop on that breakpoint.

You mention that it could not be reproducible in your VS 2015 environment, and I think it is highly possible that it might be some environment settings issue. And I finally found one possible setting that could cause this strange behavior. I install the "NTVS" (Nodejs Tools for Visual Studio) v.1.1.1 for VS 2015, and I remember the version of the nodejs in it would be 0.1x, therefore, I modify the following VS settings to enable VS to find the latest nodejs I installed in my computer (version 4.4.3, I think this would be the most stable version currently).

Tools --> Options --> Projects and Solutions --> External Web Tools --> and I add the folder where I installed node.js v4.4.3 in it. (i.e., c:\program files\nodejs)

If I unselect the path I added for node.js 4.4.3, the breakpoint I set on line console.log("7"); would be hit in the VS debugger (however, the content of the VS editor when the breakpoint is hit is still of the js file). And if I add the path of node.js 4.4.3 back to the External Web Tools, the strange behavior appears.

@mhegazy
Copy link
Contributor

mhegazy commented May 5, 2016

so this is an NTVS project? is this correct?

@mhegazy
Copy link
Contributor

mhegazy commented May 5, 2016

@mousetraps i know you have been looking into this on the ntvs side, any thoughts?

@halajohn
Copy link
Author

halajohn commented May 6, 2016

Yes. this is an NTVS project.

@mhegazy
Copy link
Contributor

mhegazy commented May 6, 2016

there are actually two debuggers, one for node (NTVS projects), and one for IE/Edge (web site projects). @mousetraps was looking into unifying the source map loading logic for both. but this issue should be filed on https://github.com/Microsoft/nodejstools

@mhegazy mhegazy added External Relates to another program, environment, or user action which we cannot control. and removed Needs More Info The issue still hasn't been fully clarified labels May 6, 2016
@halajohn
Copy link
Author

halajohn commented May 7, 2016

ok. I'll post this to that project. Thx.

@halajohn halajohn closed this as completed May 7, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
External Relates to another program, environment, or user action which we cannot control.
Projects
None yet
Development

No branches or pull requests

2 participants