C# 14 new syntax for extension methods, xml documentation is broken
- Dominant language
- C#
- Stars
- 20.7k
- Forks
- 4.3k
- PR merge metrics
- PR metrics pending
Description
**C# 14 compiler, as part of .NET SDK 10.0.8**:
**Steps to Reproduce**:
I've tested both Rider and Visual Studio Community, and neither shows documentation for my extension methods declared using the new syntax.
Repository with nuget package code:
https://github.com/lassevk/LasseVK.Bootstrapping/tree/0.1.0-prerelease
in particular, the xml documentation referenced in this issue can be found here:
https://github.com/lassevk/LasseVK.Bootstrapping/blob/0.1.0-prerelease/LasseVK.Bootstrapping/HostApplicationBuilderExtensions.cs#L24-L39
Nuget package: (0.1.0 is important, as 0.1.1 switched back to old-style extension methods which work)
https://www.nuget.org/packages/LasseVK.Bootstrapping/0.1.0-prerelease
To reproduce, do the following:
1. Create a new .NET application in C#, console application is fine
2. Add the following two nuget packages:
1. Microsoft.Extensions.Hosting
2. LasseVK.Bootstrapping (pre-release checked, pick 0.1.0)
3. Replace program.cs code with the following:
```csharp
using LasseVK.Bootstrapping;
using Microsoft.Extensions.Hosting;
HostApplicationBuilder builder = Host.CreateApplicationBuilder();
builder.Bootstrap(new ApplicationBootstrapper());
public class ApplicationBootstrapper : IModuleBootstrapper
{
public void Bootstrap(IHostApplicationBuilder builder)
{
throw new NotImplementedException();
}
}
```
4. Do a build, or otherwise make sure packages are restored
5. Hover over the `.Bootstrap` method to see if documentation is shown (it won't be)
6. Hover over the `IModuleBootstrapper` interface to verify that the documentation is working for other things declared in the same nuget package.
It seems the way the compiler generates a new class, similar to (if I understand the syntax correctly) ```LasseVK.Bootstrapping.HostApplicationBuilderExtensions.randomnumber`1``` and using `` to forward the documentation is tripping up both Visual Studio and Rider in this regard.
**Expected Behavior**:
I expected the documentation to be visible when hovering over members declared using the new C# 14 extension method syntax.
**Actual Behavior**:
No documentation shown.
More information can be found in the original issue, filed under github/docs (because I didn't check carefully enough which repository I was in when I filed the issue).
https://github.com/dotnet/docs/issues/54005
Contributor guide
Research direction
Reproduce the issue with the .NET SDK 10.0.8, Microsoft.Extensions.Hosting, and LasseVK.Bootstrapping 0.1.0-prerelease using the provided Program.cs example. Compare documentation for Bootstrap with documentation for IModuleBootstrapper, then inspect Roslyn's handling of the generated extension-method class and XML documentation forwarding. Done means documentation appears for the new C# 14 extension method syntax in Visual Studio and Rider.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100