microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
101.34k stars 12.54k forks source link

Loading TypeScript files crashes Visual Studio 2015 (TypeScript 1.5 beta) #4528

Closed AlexAugot closed 9 years ago

AlexAugot commented 9 years ago

I'm having an issue where any time a TypeScript file or definition is loaded in Visual Studio 2015, devenv.exe crashes. At one point in time it was working fine, but now it's happening consistently. I've uninstalled all extensions, typescript and visual studio 2015 and reinstalled both TypeScript and Visual Studio 2015 with no luck.

Event Log:

Application: devenv.exe
Framework Version: v4.0.30319
Description: The application requested process termination through System.Environment.FailFast(string message).
Message: System.AggregateException: One or more errors occurred. ---> System.InvalidOperationException: Instances of abstract classes cannot be created.
   at Microsoft.CodeAnalysis.Editor.TypeScript.ScriptServices.JsonHelpers.<ConvertNavigationBarItemArray>d__1.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Microsoft.CodeAnalysis.Editor.TypeScript.ScriptServices.JsonHelpers.ParseNavigationBarItems(String encoded, SourceText text)
   at Microsoft.CodeAnalysis.Editor.TypeScript.ScriptServices.Proxies.LanguageServiceProxy.GetNavigationBarItems(ProjectDataCache project, Document document, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Editor.TypeScript.Features.NavigationBar.TypeScriptNavigationBarItemService.<>c__DisplayClass0.<GetItemsAsync>b__1(LanguageServiceProxy proxy, ProjectDataCache cache, ScriptContext context)
   at Microsoft.CodeAnalysis.Editor.TypeScript.Features.TaskHandler.ComputeValue[T](ProjectDataCache cache, LanguageServiceOperation`1 operation)
   at Microsoft.CodeAnalysis.Editor.TypeScript.Features.TaskHandler.<>c__DisplayClass0`1.<PerformOperation>b__1()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.CodeAnalysis.Editor.TypeScript.Features.TaskHandler.<PerformSyntacticFeatureOperationAsync>d__1`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.CodeAnalysis.Editor.Implementation.NavigationBar.NavigationBarController.<ComputeModelAsync>d__30.MoveNext()
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.InvalidOperationException: Instances of abstract classes cannot be created.
   at Microsoft.CodeAnalysis.Editor.TypeScript.ScriptServices.JsonHelpers.<ConvertNavigationBarItemArray>d__1.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Microsoft.CodeAnalysis.Editor.TypeScript.ScriptServices.JsonHelpers.ParseNavigationBarItems(String encoded, SourceText text)
   at Microsoft.CodeAnalysis.Editor.TypeScript.ScriptServices.Proxies.LanguageServiceProxy.GetNavigationBarItems(ProjectDataCache project, Document document, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Editor.TypeScript.Features.NavigationBar.TypeScriptNavigationBarItemService.<>c__DisplayClass0.<GetItemsAsync>b__1(LanguageServiceProxy proxy, ProjectDataCache cache, ScriptContext context)
   at Microsoft.CodeAnalysis.Editor.TypeScript.Features.TaskHandler.ComputeValue[T](ProjectDataCache cache, LanguageServiceOperation`1 operation)
   at Microsoft.CodeAnalysis.Editor.TypeScript.Features.TaskHandler.<>c__DisplayClass0`1.<PerformOperation>b__1()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.CodeAnalysis.Editor.TypeScript.Features.TaskHandler.<PerformSyntacticFeatureOperationAsync>d__1`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.CodeAnalysis.Editor.Implementation.NavigationBar.NavigationBarController.<ComputeModelAsync>d__30.MoveNext()<---
mhegazy commented 9 years ago

What version of TypeScipt do you have installed? do you have a registry key: HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0\TypeScriptLanguageService\CustomTypeScriptServicesFileLocation? does it happen on any TS file? or a specific file/project?

AlexAugot commented 9 years ago

I'm using Visual Studio 2015 Professional (14.0.23107) and the TypeScript Tools 1.5 beta extension (1.5.22827).

I don't seem to have any TypeScriptLangageService folder under that registry path. I was looking at #4011 earlier, but couldn't apply the fix.

It seems to happen on every .ts or .d.ts file.

mhegazy commented 9 years ago

Why are you using 1.5 beta if i may ask? i do not think this can even work with VS2015 RTM. the API's that we depend on from Roslyn have changed in between the two versions.

Please install TypeScript 1.5.4: http://www.microsoft.com/en-us/download/details.aspx?id=48593&WT.mc_id=rss_alldownloads_devresources

AlexAugot commented 9 years ago

I'm using the 1.5 beta because that's all that seems to come up when searching for typescript in the Visual Studio Extensions UI.

typescript_ui

I will give 1.5.4 a shot, thanks for the direct link.

AlexAugot commented 9 years ago

1.5.4 fixes the issue, Typescript files now load fine. Thanks for all your help!