dotnet / dotnet/roslyn

If class has primary constructor, cannot provide XML documentation comment for class

Open
#75,272 2 comments 11 reactions 0 assignees View on GitHub
Area-Compilers Feature - Primary Constructors
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

**Version Used**: .NET 8.0

**Steps to Reproduce**:

1. Create a class with primary constructor
2. Add XML documentation to primary constructor

**Expected Behavior**:

It should be possible to provide independent XML documentation comment for class data type even when primary constructor is used.

**Actual Behavior**:

The constructor XML documentation is displayed when the class data type is being hovered above:

![Primary constructor XML documentation](https://github.com/user-attachments/assets/def3ac36-218f-4c8d-af80-6bf7dbc6040a)

Contributor guide

Open the contributing guide

Research direction

No source file or test is named. First reproduce the issue in .NET 8 with a class primary constructor and XML documentation, then trace how the compiler or language service associates that documentation with the class and constructor. Done means the class hover shows independent class documentation and a regression test covers the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.