0

In this scenario I have a .Net Core 2 web project, and working on one TypeScript file. It used to be (if I recall correctly) that errors should break on the opened source tab. Instead now I'm seeing Visual Studio (2017) break on a NEW tab with the [dynamic] tag next to the tab name; however, the path of this file (when viewing properties) is a file path to the SAME source file I have open! :( It looks like this (lines are tabs):

| File.ts | Files.ts [dynamic] # | (#: the second tab is also locked)

It's been awhile now and I can't recall if this is normal, or if I'm missing something?

TS file structure:

Project/
       wwwroot/js/ (.js and .js.map files, where 'outDir' points in tsconfig)
       Scripts/ (.ts files, and where 'rootDir' points in tsconfig)

Things I already tried and other info:

  1. Made sure all .ts file actions are "TypeScriptCompile".
  2. Verified that the .map files correctly point to the source.
  3. The .js and .js.map files are stored together in the wwwroot\js folder.
  4. The .ts files exist in a Scripts folder in the project root.
  5. Right-clicking on the .ts file in question under the Script Documents node during a debug session shows that the URL reference file//C:///...pathtofile..., which is correct (obviously! or it wouldn't be found in the first place)
  6. Made sure script debugging is enabled in IE (not sure that matters for VS, since I think it still works regardless).
  7. Breakpoints, including the debugger; keyword, always break in the dynamic tab and never my opened source tab.

Is this normal behaviour? Thanks.

Specs: Windows 10, Visual Studio 2017, and debugging with IE11.

James Wilkins
  • 6,836
  • 3
  • 48
  • 73

1 Answers1

0

The answer is here: https://stackoverflow.com/a/31854370/1236397

For some reason my files (coming in and out of Git source control) ended up invalid. They ARE text files, but ASCII text files. I converted one file to UTF8 as a test and now the .ts file in my working tab gets focused instead of a dynamic tab! I think this should be a bug really, not sure. I don't understand why I can edit text .ts files easily in Visual Studio and have it get confused and load it dynamically.

To convert files in Visual Studio there are two options:

  1. Save As ..., then click the arrow next to Save and select Save with Encoding....
  2. Change using File->Advanced Save Options.... If you don't have that, then go to Tools->Customize...->Commands, select File in the dropdown next to Menu bar:, then click Add Command..., and you'll see it under the Files category.

You can also use Notepad++, under the Encoding menu.

James Wilkins
  • 6,836
  • 3
  • 48
  • 73