CS0419: ambiguous cref where no ambiguity should exist #51013
Open
Description
Version Used: VS 16.10 Preview 1 (31004.24.main)
Steps to Reproduce:
- Create a .NET Standard 2.0 class library.
- 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>
- 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() { } }
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.