Analyzer Warning Mitigation#1039
Conversation
… IconElement and IcounSourceElement classes instead
- Removed commented-out Toolbox attributes - Replaced single-line commented-out code with multi-line
- Add stylecop supression of 1502 "element should not be on a single line" - Wrap with braces where needed
WPF0100, WPF0005, WPF0012
WPF0108, WPF0060, SA1642, SA1623
- Use string, double, int rather than String, Double, Int32, etc - remove 'this' keyword when context is obvious
…umentation warnings
…uper-casing and private fields
There were some issue when having a class called ContextMenu that wasn't actually a contextmenu but a ResourceDictionary
There's still a lot of IDE0028 warnings as the auto fix really wants to use the C#12 collection expressions, which btw will trigger SA1010 warnings (DotNetAnalyzers/StyleCopAnalyzers#3687)
Justification: Menu was not a control.Menu, it's more like a hack to change private api settings.
… dependency properties. Also fixed some enum warnings
…ge name of ContentPresenter to DialogHost
|
Some additional comments. Many controls had protected fields, which i changed to protected properties, but in most cases private fields would be my recommendation. There probably aren't many instances of sub-classing the controls, but I didn't think it was my call to make, so I left them as protected. There were a few kinds of warnings that i didn't attempt.
|
|
You do realize that the warnings and suggestions you see are your personal code style settings, right? |
|
I'm not sure I do realize. There may be some warnings that are user specific -- for example the ReSharper warning suppressions I see in the code -- other warnings are very much project-wide configurable. If you look at the NuGet packages for Buried in some of those warnings are actual bugs. For example, CLR accessors pointing to the wrong DP (presumably due to sloppy copy-paste) or DP default values set to reference types. With so many warnings, it is easy to ignore actual red flags. In any case, enforcing rules is just good practice; switch a certain setting on and ensure that all contributors document their public members, etc. |
|
Hey @koal44, thanks for taking the time and organizing the code, a huge step in the right direction |
There are a large number of changes here with the overall goal of reducing the thousands of analyzer warnings to a more manageable amount.The majority of modifications are minor and involve routine enhancements such as standardizing documentation and enforcing syntax conventions, but there are some more notable changes.
Minor API Changes: For instance, removing the obsolete
forceBackgroundparameter when theme switching required breaking some publicApplymethodsRegression Risks: The extensive nature of these changes carries some risk as even seemingly benign changes can lead to bugs. A case in point involved a regression issue with the display of
ContentDialog. The analyzer's recommendation to useSetCurrentValueinstead of the CLR setter for theContentPropertyof aContentPresenterwas found to inadvertently skip the template reevaluation, preventing the dialog from showing itself.I've reviewed the GalleryApp and everything seems okay, but I'd still recommend a thorough re-vetting of the entire library.