From 9455dc5992cbadbd9f05d9315c5dfe7b0116fe18 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 23 Jun 2021 13:03:12 -0700 Subject: [PATCH] Filter out records from code model --- .../CSharp/Impl/CodeModel/CSharpCodeModelService.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/VisualStudio/CSharp/Impl/CodeModel/CSharpCodeModelService.cs b/src/VisualStudio/CSharp/Impl/CodeModel/CSharpCodeModelService.cs index b971a269abbb5..30b7dd781d14a 100644 --- a/src/VisualStudio/CSharp/Impl/CodeModel/CSharpCodeModelService.cs +++ b/src/VisualStudio/CSharp/Impl/CodeModel/CSharpCodeModelService.cs @@ -438,6 +438,12 @@ private static bool NodeIsSupported(bool test, SyntaxNode node) /// of the field. /// If true, only members supported by Code Model are returned. public override IEnumerable GetMemberNodes(SyntaxNode container, bool includeSelf, bool recursive, bool logicalFields, bool onlySupportedNodes) + { + // Filter out all records from code model, they are not supported at all. + return GetMemberNodesWorker(container, includeSelf, recursive, logicalFields, onlySupportedNodes).Where(t => t is not RecordDeclarationSyntax); + } + + private IEnumerable GetMemberNodesWorker(SyntaxNode container, bool includeSelf, bool recursive, bool logicalFields, bool onlySupportedNodes) { if (!IsContainerNode(container)) {