From 055511734af054b3124f8e0711f25c344e050df9 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Fri, 2 Nov 2018 08:26:25 +0100 Subject: [PATCH] AttributeAppliedToAnalyzer: Ensure that accessors are never returned as results. --- ILSpy/Analyzers/Builtin/AttributeAppliedToAnalyzer.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ILSpy/Analyzers/Builtin/AttributeAppliedToAnalyzer.cs b/ILSpy/Analyzers/Builtin/AttributeAppliedToAnalyzer.cs index cd15ccab9..08f75db76 100644 --- a/ILSpy/Analyzers/Builtin/AttributeAppliedToAnalyzer.cs +++ b/ILSpy/Analyzers/Builtin/AttributeAppliedToAnalyzer.cs @@ -80,7 +80,8 @@ namespace ICSharpCode.ILSpy.Analyzers.Builtin { return ts.MainModule.TypeDefinitions .SelectMany(t => t.Members.OfType()) - .Where(m => m.HasAttribute(attribute)); + .Where(m => m.HasAttribute(attribute)) + .Select(m => m.AccessorOwner ?? m); } IEnumerable ScanFields(DecompilerTypeSystem ts) @@ -101,7 +102,8 @@ namespace ICSharpCode.ILSpy.Analyzers.Builtin { return ts.MainModule.TypeDefinitions .SelectMany(t => t.Members.OfType()) - .Where(m => m.Parameters.Any(p => p.HasAttribute(attribute))); + .Where(m => m.Parameters.Any(p => p.HasAttribute(attribute))) + .Select(m => m.AccessorOwner ?? m); } foreach (Decompiler.Metadata.PEFile module in scope.GetAllModules()) {