dotnet / dotnet/roslyn

Record type doesn't show up in completion list for generic type parameter above the record declaration

Open
#76,594 2 comments 0 reactions 0 assignees View on GitHub
Area-IDE help wanted
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

If I define a `record` type, the type doesn't show up in the completion list in code before the type is defined, even though the code does build.

The screenshot is from a Razor document but the issue repros in a plain .cs file too.

![devenv_cISL73I8x5](https://github.com/user-attachments/assets/6a20ec5b-3f68-4515-abab-0bd36b9b0667)

The `record` type does show up in the completion list in code after the `record` type is defined.

If I define a `class` instead of a `record`, then the type shows up in completions before and after the type definition.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the completion behavior in a plain .cs file, then verify whether it also occurs in the Razor document shown in the report. Compare a record declaration with a class declaration when referenced from a generic type parameter before the declaration; done means the record appears in completion results before and after its declaration.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
compilers, developer-experience
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.