7

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?

3 Answers3

4

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.

balajikris
  • 201
  • 2
  • 7
  • Is there any development on this issue, because it is very annoying not to be able to use this feature? – radu-matei Aug 12 '15 at 07:09
  • I have just found a workaround for this, but it kinda sucks that it is not yet resolved. My fix works until you close VS:)) I really hope that this issue will get a fix. Thanks! – radu-matei Aug 12 '15 at 17:47
  • Sorry for getting back late on this.. This is now fixed and should be available in the next public update to Vs2015. – balajikris Oct 14 '15 at 18:13
  • Any idea when the update is likely to be released? Been struggling without this feature for sometime now =( – Luke Baulch Nov 01 '15 at 01:26
  • [Update 1 RC](https://www.visualstudio.com/en-us/news/vs2015-update1-vs.aspx) is already here, which has the fix and a slew of new features as well :-) – balajikris Nov 02 '15 at 15:40
  • I'm facing this issue for Visual Studio 2019 Enterprise @balajikris . Any advice? – shikharraje Sep 28 '20 at 08:33
2

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!

radu-matei
  • 3,469
  • 1
  • 29
  • 47
  • I have tried several times this solution and it works. The problem is that you have to do this every time you open VS. Let me know if it works for you. Good luck! – radu-matei Aug 12 '15 at 17:44
  • God I hope this isn't the only option, this is very invasive. Thanks for the tip though. – Spets Aug 27 '15 at 22:34
  • Works for me except don't need to clean and rebuild, just exclude scripts, unload project, reload and re-include scripts. Interesting thing is the typescript files I have written as part of the project are not in the scripts folder so are never excluded. The scripts folder only has typescript definition files and all the js files and other stuff from packages. – nick66 Oct 12 '15 at 15:08
0

in my case references start working after uninstalling vssonar extension, vs2015ent