diff --git a/src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsHelper.cs b/src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsHelper.cs index 1f2c6fb22b..ca6ae15d80 100644 --- a/src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsHelper.cs +++ b/src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsHelper.cs @@ -113,9 +113,21 @@ namespace ICSharpCode.SharpDevelop.Refactoring public ObservableCollection BuildTreeViewModel(IEnumerable> classTree) { - return new ObservableCollection( - classTree.Select( - node => MakeGoToMemberAction(node.Content, BuildTreeViewModel(node.Children))).Where(action => action != null)); + ObservableCollection c = new ObservableCollection(); + foreach (var node in classTree) { + var childNodes = BuildTreeViewModel(node.Children); + var action = MakeGoToMemberAction(node.Content, childNodes); + if (action != null) { + c.Add(action); + } else { + // If the member doesn't exist in the derived class, directly append the + // children of that derived class here. + c.AddRange(childNodes); + // This is necessary so that the method C.M() is shown in the case + // "class A { virtual void M(); } class B : A {} class C : B { override void M(); }" + } + } + return c; } } }