27

I'm working on a TypeScript (0.9.1) project using Visual Studio 2012 with the latest Web Essentials as the IDE, and i debug using Chrome Developer tools.

Recently, and most probably after Chrome update (cur. Version 29.0.1547.66 m), typeScript files don't get updated after i edit them, and on the other hand the corresponding compiled js files are updated, but it seems that somehow the functionality still depends on the non-updated version of the sources.

Solutions tried and failed:

  • Rebuild the full solution.
  • Hard refreshing (Shift + F5) the local host site on chrome
  • Deleting Source map files and generate them again.

After some trials it looks like even a request to download the ts source files yields the non-updated version (http://localhost:1198/xxx.ts e.g)

It seems that the problem gets partially fixed after full restart (windows 8 if it matters), the source files are updated in chrome, but once i change it again, the same problem appears.

Another solution was using incognito, as it seems that it's a caching problem.

My question:

Is caching typeScript files that way is caused by a problem in the configurations of the project (even it was working before), or this is a bug in the new version of Chrome ?

Ali Essam
  • 502
  • 1
  • 7
  • 17
  • curious why you need sourcemaps. Are you compiling with the `--out` option? – basarat Sep 06 '13 at 12:52
  • I don't actually know what is the use of the source maps, but when i searched for similar problems, all i got is questions about maps not working on chrome, so i just gave it a try.I think i should consider reading about source maps :D . – Ali Essam Sep 06 '13 at 13:01
  • 1
    They are required if you need to debug TypeScript from Chrome (http://www.youtube.com/watch?v=RWXGMug_Rmo&hd=1) or VisualStudio + IE : (http://www.youtube.com/watch?v=TvD_ia7vkkA&hd=1) But I find myself not using SourceMaps as commonly. Unless I have all my TypeScript Files merged into a single JS : http://www.youtube.com/watch?v=KDrWLMUY0R0&hd=1 – basarat Sep 06 '13 at 13:08
  • I've watched your 1st video, and i think VS does that work automatically as i get the same results at the end. – Ali Essam Sep 06 '13 at 13:29
  • I'm experiencing the same problem. SO listed http://stackoverflow.com/questions/11019727/chrome-will-not-refresh-local-file-when-changing-backbone-template?rq=1 as a related question, and in fact the answer given there solves this problem as well (at least for me, since I have no problem with keeping the Chrome Dev Tools open). – Matthias Oct 08 '13 at 22:06
  • See the answer here: http://stackoverflow.com/questions/30770062/typescript-files-get-jambed-in-chrome-debugger-tools – Glen Little Feb 22 '16 at 17:20

7 Answers7

32

To I'm experiencing same problem. I solved this problem with chreome debug tools disable cache checked.

My second problem, i wrote a lot of class into a same file. i splice every class to seperate file.

enter image description here

Abdullah SARGIN
  • 1,646
  • 1
  • 13
  • 19
17

I solved this by removing the cached files manually. This can be done through Chrome's settings:

  1. Click on Customize and control Google Chrome - the burger menu icon in the top right corner of the browser window.
  2. Select Settings near the bottom of the menu.
  3. Scroll down and click on the Show advanced settings... link.
  4. Click on the Clear browing data... button.
  5. Check Cached images and files. The other checkboxes can be left unchecked.
  6. Click on the Clear browing data button.

The 'Disable cache' checkbox in the network tab didn't work for me, nor did a Ctrl+F5.

Jan Aagaard
  • 10,940
  • 8
  • 45
  • 80
14

If you are serving from IIS, We have manually disabled cache in our web.config file :

<system.webServer>

    <httpProtocol>

      <!--TODO: Remove this block for production (//TODO: Remove this block for production) -->
      <customHeaders>
        <!--DISABLE CACHE-->
        <add name="Cache-Control" value="no-cache, no-store, must-revalidate" />
        <add name="Pragma" value="no-cache" />
        <add name="Expires" value="0" />
      </customHeaders>

    </httpProtocol>
</system.webServer>     
basarat
  • 261,912
  • 58
  • 460
  • 511
  • 5
    I think these configs fixed the problem, but i'm curious, why didn't it update the ts files but it updated js files, and what is driving me more crazy why was it running the non-updated js files even it's viewing the latest version ? – Ali Essam Sep 06 '13 at 13:16
  • You could have done an `empty cache and hard reload` in chrome. But that quickly becomes painful to do over and over again. – basarat Sep 06 '13 at 13:52
  • 1
    Putting that code in my config file, along with right-click-refresh (while dev tools is open) then "Empty Cache and Hard Reload" worked for me! – ThePartyTurtle May 27 '16 at 16:01
0

I don't know why it doesn't work normally. But even when you turn off caching it still doesn't work. What does work as a manual work around. If chrome dev tools is open then you can right click the refresh icon and do a hard reload (I do 'Empty Cache and Hard Reload') and it works.

0

I solved this like Jan Aagaard .

Customize and control Google Chrome > Settings > Show advanced settings... > Clear browing data... > Check in 'Cached images and files' > Clear browing data.

0

If anyone have the same issue on Visual Studio 2015 after installing ASP.Net 5 RC1. Check if the Browser Link Dashboard displays "No current connections" when running or debugging a DNX project a repair of the update will correct the issue:

  • Close Visual Studio
  • Open Control Panel > Programs and Features
  • Right click on "Microsoft ASP.NET 5 RC1 Update 1"
  • Click "change"
  • In the ASP.NET 5 RC1 Update 1 Installer, click "Repair"
Whistler
  • 1,897
  • 4
  • 29
  • 50
0

In our case we had the wrong workspace directory set on the Sources - Page tab.
i.e. it was pointing to project-master but we were actually debugging in project-branch

So the solution was simply to set the correct workspace directory.

TmTron
  • 17,012
  • 10
  • 94
  • 142