KirillOsenkov / SourceBrowser

Source browser website generator that powers http://referencesource.microsoft.com and http://sourceroslyn.io
Apache License 2.0
1.07k stars 196 forks source link

When interface method is implemented in base class it's not found detected as reference #113

Open DavidKarlas opened 5 years ago

DavidKarlas commented 5 years ago

E.g: http://source.roslyn.io/#Microsoft.CodeAnalysis.EditorFeatures.Wpf/InlineRename/IInlineRenameUndoManager.cs,6753deb461ea671f,references Looks like nothing implements this method but here is implementation: http://source.roslyn.io/#Microsoft.CodeAnalysis.EditorFeatures.Wpf/InlineRename/AbstractInlineRenameUndoManager.cs,7369572a58fa5329 Trick is that http://source.roslyn.io/#Microsoft.CodeAnalysis.EditorFeatures.Wpf/InlineRename/UndoManagerServiceFactory.cs,32 implements interface but method implementation is actually in base class.

KirillOsenkov commented 5 years ago

Oh wow, nice bug!

I wouldn't even know how to fix this, it may even be impossible to fix. The base class may be in a different assembly from the one that adds the interface implementation, so we can't retroactively add a reference.

Minimal repro:

public interface IAnimal
{
    void Eat();
}

public abstract class AbstractAnimal
{
    public void Eat() { }
}

public class Giraffe : AbstractAnimal, IAnimal
{
}
KirillOsenkov commented 5 years ago

I think this issue is practically unfixable in SourceBrowser because of a static single-pass nature of the HTML generator.

We'd need somehow to come back to the class every time for each derived class that adds an interface implementation and retroactively add a link.