Closed davidwangms closed 5 years ago
Good callout. I think filtering on that attribute could be done here: PropertyPathSuggestionProvider.cs (line 158). @davidwangms - any interest in taking a stab at a fix? 🙂
Could be interesting, I'll take a stab at it next week if no one else is around to look into it, sure
@davidwangms , you can probably do this by adding a Where clause to that line which checks for GeneratedCodeAttribute.
Something like this:
.Where(p => p.GetCustomAttribute<GeneratedCodeAttribute>() == null);
Haven't tested this code.
Just noticed that you already found another attribute. I'm not very familiar with the two, but I found this old blog post about them. https://blogs.msdn.microsoft.com/codeanalysis/2007/04/27/correct-usage-of-the-compilergeneratedattribute-and-the-generatedcodeattribute/
Sounds to me like we should consider filtering out properties with any of the following attributes:
CompilerGeneratedAttribute
GeneratedCodeAttribute
DebuggerNonUserCodeAttribute
EditorBrowsableAttribute
(with EditorBrowsableState.Never
)
The dropdown appears to be showing compiler generated classes as well, which may be confusing for the user, and also bloats up the suggestions box. These should be marked with CompilerGeneratedAttribute, so they can be filtered out from the results