Skip to content

CS0419: ambiguous cref where no ambiguity should exist #51013

Open
@AArnott

Description

Version Used: VS 16.10 Preview 1 (31004.24.main)

Steps to Reproduce:

  1. Create a .NET Standard 2.0 class library.
  2. Replace the project file content with:
     <Project Sdk="Microsoft.NET.Sdk">
    
       <PropertyGroup>
         <TargetFramework>netstandard2.0</TargetFramework>
         <GenerateDocumentationFile>true</GenerateDocumentationFile>
       </PropertyGroup>
    
       <ItemGroup>
         <!--<PackageReference Include="MessagePack" Version="2.2.85" />-->
         <PackageReference Include="StreamJsonRpc" Version="2.7.67" />
       </ItemGroup>
    
     </Project>
  3. Replace the .cs file content with:
     using MessagePack;
    
     internal class HashingBufferWriter
     {
         /// <summary>
         /// Writes the content of a dictionary to a <see cref="MessagePackWriter"/>.
         /// </summary>
         internal static void Write()
         {
         }
     }

Repro solution

Expected Behavior:

No warnings.

Actual Behavior:

The compiler and error list report this warning:

(6,60,6,77): warning CS0419: Ambiguous reference in cref attribute: 'MessagePackWriter'. Assuming 'MessagePackWriter', but could have also matched other overloads including 'MessagePackWriter'.

Note there is no ambiguity. Using MessagePackWriter as a parameter type in the method produces no such diagnostic, so this is unique to cref docs.
Also note that replacing the one PackageReference in the project with the other will mysteriously make the warning disappear.

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions