Welcome to Microsoft Q&A!
What is the type of your project? Have you tried Repair Visual Studio? Does CodeLens still not work after building the project, You can try to delete the obj folder of the project.
*
Update:
Please try to delete the .vs folder of the project.
Then:
Go into Tools -> Options... -> Text Editor -> All Languages -> CodeLens.
Uncheck "Enable CodeLens" option and click OK.
Go back into Tools -> Options... -> Text Editor -> All Languages -> CodeLens.
Check the "Enable CodeLens" option and click OK.
Then open this project in Visual Studio.
Sincerely,
Peng
*
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread