This project is read-only.
11
Vote

Regression: XML documentation respects accessibility now?

description

C# 5 compiler version: 12.0.30110.0
Roslyn version: 0.6.40331.3

Sometimes it's useful for doc comments to be able to refer to a member which that piece of code wouldn't actually be able to access. For example, a bunch of private constants in one method might have to be kept in sync with a bunch of private constants in another. It's ugly, but it can happen. Within the same assembly, it feels reasonable - outside the same assembly, less so.

The C# 5 compiler allows this when checking method references in cref attributes; Roslyn doesn't.

Test file attached - under the C# 5 compiler it compiles with no warnings; under Roslyn I get:
Test.cs(7,31): warning CS1574: XML comment has cref attribute 'Ford.Method' that could not be resolved
Test.cs(20,31): warning CS1574: XML comment has cref attribute 'Zaphod.Method' that could not be resolved
(As context, I discovered this when trying to build Noda Time with Roslyn - we have warnings as errors, so this broke our build.)

file attachments

comments

MichaelKetting wrote Jul 18, 2014 at 10:10 AM

I just found this item. I also got a discussion for this here: https://roslyn.codeplex.com/discussions/547624
And the Connect issue https://connect.microsoft.com/VisualStudio/feedback/details/901988/cref-references-in-xml-doc-are-no-longer-able-to-link-to-non-public-members-from-a-different-type

I'm very interested in a fix for this. With our solution, I got dozens of errors from this and I would need to disable the warn-as-error for this accross several (10+ projects). That would mean I can't try Roslyn on the trunk. And that in turn makes it no fun to try Roslyn at all, give it performance spins etc...

MichaelKetting wrote Jan 26, 2015 at 7:45 AM

Re-posted this issue on GitHub: https://github.com/dotnet/roslyn/issues/77

MichaelKetting wrote Jan 27, 2015 at 8:35 PM