This project is read-only.


Visual Studio hang editing TypeScript - reproducible example


I've been using TypeScript for a week or so and have hit a number of problems with Visual Studio just hanging and needing to be terminated via Task Manager after editing TypeScript code. I've never seen this before (well, very very rarely) in my normal C#/C++ development.

I got a reproducible example using 0.8.2 a few days ago. We had about two dozen JS files we were trying to port to TS, and the contained a lot of errors, mostly missing references to each other and things like that. I upgraded to 0.8.3 and the hangs seemed to stop, so I was very pleased. However, I've now found a simple example that causes VS 2012 SR1 to hang on my machine with the latest TS 0.8.3:

(1) Create a new "HTML with TypeScript" project

(2) Paste the following code over the top of the sample code in app.ts:
module M {
    export static class S {
        static f(): bool { return false; }

    export class D extends S {
As soon as you save the file you'll find VS freezes and clicks in the editor window are not registered. On my machine, devenv.exe sits there using about half a core pretty much continuously.

If you use the keyboard to move the cursor around the editor window, sometimes it seems to come back to life, allowing me to stop the hang (for example, removing the first 'static' in the above example), but sometimes it never seems to return.

It does seem that invalid TypeScript syntax, or files with certain kinds of errors, can cause VS to stop responding. My suspicion is the Intellisense engine trying to parse/work on the (invalid) TypeScript. The above example is, of course, trivially fixed, but in a real-world project with many files I keep repeatedly finding errors in various places of various types seem to cause VS to hang, which is very frustrating!

Has anyone else noticed similar hangs?

P.S. Later I've found that you can often just paste all sorts of garbage into the editor window and it causes VS to hang as well.

file attachments

Closed Mar 5, 2013 at 1:17 AM by RyanCavanaugh
Duplicate of as far as I can tell. Thanks for the repro -- this will help us narrow it down more quickly.


nabog wrote Mar 4, 2013 at 6:06 PM

This discussion may help:

The problem is to do with pasting duplicate declarations. Also try disabling Web Essentials and see if you can reproduce.