question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CodeLens doesn't work on records

See original GitHub issue

Version Used:

Visual Studio 16.8.0 Preview 2.1 .NET SDK 5.0.100-preview.8.20417.9 Compiler version: ‘3.8.0-2.20418.7 (0276b9b7)’. Language version: 9.0.

Steps to Reproduce:

Enter the following code:

public class Person
{
    public string Name { get; init; }
}

public record PersonRecord
{
    public string Name { get; init; }
}

public static class Factory
{
    public static Person MakePerson(string name)
        => new() { Name = name };

    public static PersonRecord MakeRecord(string name)
        => new() { Name = name };
}

Expected Behavior:

Code Lens shows number of references above PersonRecord and PersonRecord.Name.

Actual Behavior:

Code Lens is missing for record type and its members:

image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:22 (18 by maintainers)

github_iconTop GitHub Comments

12reactions
CyrusNajmabadicommented, Apr 6, 2021

This has been fixed and is in the latest vs (internal) previews:

image

Fixed with: https://devdiv.visualstudio.com/DevDiv/_git/a290117c-5a8a-40f7-bc2c-f14dbe3acf6d/pullrequest/279270

Should be in 16.10

6reactions
CyrusNajmabadicommented, Mar 22, 2021

I’ll see if i can make some time in the weekend to get this working.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Codelens doesn't show up for records
I'm updating a project from .NET Core 3.1 to .NET 5.0, and I had a few classes that I wanted to change to...
Read more >
CodeLens not showing references - visual studio
Go to Tools -> Options -> Text Editor -> All Languages -> CodeLens then click the "Enable CodeLens" option if it is not...
Read more >
CodeLens not working VS 2019 Community (16.11.1)
Go into Tools -> Options... -> Text Editor -> All Languages -> CodeLens. Uncheck "Enable CodeLens" option and click OK. Go back into...
Read more >
Practical Microsoft Visual Studio 2015 - Page 46 - Google Books Result
See Figure 2-14 for an example of the commits in CodeLens. Figure 2-14. A record of commits shown in CodeLens As work items...
Read more >
Professional Visual Studio 2015 - Page 1265 - Google Books Result
NET, 967–970 output from, 969 tracking changes in editor space, 60–62 records, ... 379–380 TreeView control, 508 troubleshooting email for information on, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found