roslyn: CodeLens doesn't work on records

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

About this issue

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

Most upvoted comments

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

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

There is no chance of that happening.