Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2015 codelens issues when using Typescript

I'm using Visual Studio 2015 Enterprise RTM. When creating an ASP.net 4.6 web application using the Web Api template, I noticed as soon as I add a TypeScript file, the codelens indicators stop working. I tested this on a new installation, with no extra extensions installed, as well and tried other asp.net 4.6 templates. When running in safe mode the problem doesn't occur.

Steps to reproduce:

  • Set the framework to 4.6
  • Create a web application by using the web api template.
  • Change authentication to no authentication
  • Open the webapiconfig.cs in App_Start
  • The codelens indicator on the register method should say: 1 reference
  • Add a typescript file called app.ts (doesn't really matter) in the scripts folder, tit may remain empty
  • The codelens indicator in the webapiconfig file should still say 1 reference
  • Close Visual Studio
  • Reopen Visual Studio and open the solution
  • Check the webapiconfig file, the codelens doesn't show references anymore or on any other file

Any idea on how to debug codelens or does anyone have this problem as well?

like image 518
tomeeraerts Avatar asked Jul 23 '15 07:07

tomeeraerts


2 Answers

I work for the visual studio team that is responsible for codelens references indicators. I can confirm that this is indeed a bug in VS2015 where codelens references stop working when you add typescript files to your project or typescript projects to your solution :( Unfortunately, we missed this bug for RTM. We're currently actively investigating this bug. At the moment, I am not aware of any workarounds for this problem. I can post an update when we have more information to share on this bug.

like image 71
balajikris Avatar answered Oct 16 '22 21:10

balajikris


I may have found a workaround that seems to do the trick for me:

So, I have a solution with multiple projects, only one of which has TypeScript files.

I just unloaded the project, cleaned + rebuilt (some restart to Visual Studio at this point may help + close all opened files), then loaded again, cleaned and rebuilt and now CodeLens shows my references (again, close all open files).

Note that until this bug is fixed, you may have to do this each time you open VS.

Hope this helps!

EDIT: If you only have a single project, then exclude the Scripts folder from the solution, clean, rebuilt, close Visual Studio then open it again. Now you should have the references back. Simply include the folder again.

Best of luck!

like image 2
radu-matei Avatar answered Oct 16 '22 19:10

radu-matei