-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Closed
DocumentationCommentId.GetSymbolsForDeclarationId doesn't work with method declared in
extension#78606Bug
Copy link
Labels
Area-CompilersFeature - Extension EverythingThe extension everything featureThe extension everything featureResolution-FixedThe bug has been fixed and/or the requested behavior has been implementedThe bug has been fixed and/or the requested behavior has been implemented
Milestone
Description
Version Used: 4.14.0
Steps to Reproduce:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Basic.Reference.Assemblies.NetStandard20" Version="1.8.0" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.14.0" PrivateAssets="all" />
</ItemGroup>
</Project>using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
var options = new CSharpParseOptions(LanguageVersion.Preview);
var syntaxTree = CSharpSyntaxTree.ParseText("""
static partial class Dummy
{
extension(string target)
{
public void Foo()
{
}
}
}
""", options);
var compilation = CSharpCompilation.Create("dummy", [syntaxTree], Basic.Reference.Assemblies.NetStandard20.References.All);
var symbol = compilation.GetSymbolsWithName("Foo").Single();
// id is empty ("")
var id = DocumentationCommentId.CreateReferenceId(symbol);
// result is null
var result = DocumentationCommentId.GetFirstSymbolForDeclarationId("Dummy.Foo()", compilation);Expected Behavior:
DocumentationCommentId.CreateReferenceIdshould return a non-empty stringDocumentationCommentId.GetFirstSymbolForDeclarationIdshould return a symbol
Actual Behavior:
DocumentationCommentId.CreateReferenceIdreturns an empty stringDocumentationCommentId.GetFirstSymbolForDeclarationIdreturns null
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area-CompilersFeature - Extension EverythingThe extension everything featureThe extension everything featureResolution-FixedThe bug has been fixed and/or the requested behavior has been implementedThe bug has been fixed and/or the requested behavior has been implemented