* Reapply "[main] Update dependencies from dotnet/roslyn-analyzers (#98984)" (#99327)
* Configure new analyzers severity in src and test projects
* Fix some of CA2263 warnings
* Set severity of rule CA1870 to warning
* Replace one more usage in nativeaot corelib
* Set severity for tests as well
* pragma disable the rule in nativeaot's reflection impl
Use Microsoft.CodeAnalysis.Analyzer in our builds, to help validate our analyzers and source generators. A few projects were doing this explicitly; this does it for all.
I ran it over runtime, and the only things flagged were for exceptional cases where it's not worth using. Rather than a bunch of suppressions, I'm just enabling it as info-level.
* Fix warnings found with CA1861
* Update src/coreclr/tools/aot/ILCompiler/Program.cs
Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Remove supression from static field
* Revert using string.Split(char)
* Update src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationILGen.cs
---------
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Dan Moseley <danmose@microsoft.com>
* Enable new analyzers CA1510/11/12/13 and CA1856/57/58
CA1510: Use ArgumentNullException throw helper
CA1511: Use ArgumentException throw helper
CA1512: Use ArgumentOutOfRangeException throw helper
CA1513: Use ObjectDisposedException throw helper
CA1856: Incorrect usage of ConstantExpected attribute
CA1857: A constant is expected for the parameter
CA1858: Use 'StartsWith' instead of 'IndexOf'
* More fixes
* Address PR feedback
* Enable CA1727: Use PascalCase for named placeholders
Also CA2253: Named placeholders should not be numeric values
* Fix MonoProxy logging placeholder names
* Enable new CA1311 (ToLower/Upper culture) and CA1852 (seal internal/private types)
CA1311 flagged a few issues, all addressed by using ToLowerInvariant/ToUpperInvariant.
CA1852 flagged a bunch that previous cleanups around sealing types missed or that are new since. Sealing types then highlighted places where protected or virtual members were being exposed unnecessarily, so those were fixed, too. Adding sealed to things also highlighted some discrepancies in the order of "unsafe sealed" keywords, where the vast majority in the repo were "sealed unsafe", so I fixed the few that weren't.
* Address PR feedback and fix more CI failures
* Fix unit test build error
* Remove usage of !! from dotnet/runtime
- Use ArgumentNullException.ThrowIfNull instead where possible. It's only usable for projects that only target .NET 6+, and it can't be used in places like this(...) or base(...).
- In other cases, if the project already has a ThrowHelper, augment it for null as needed and use that.
- For most of the extensions projects, add a ThrowHelper.ThrowIfNull that replicates ArgumentNullException.ThrowIfNull.
- For everything else, just use "throw new".
* Address PR feedback
* Address PR feedback
* Remove false positives from searches
* Address PR feedback
* Uncomment the user-defined checked operators for generic math
* Change SA1000 to be a suggestion until https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3478 can be resolved
* Regenerating the System.Runtime ref assembly
* Adding tests covering user-defined checked operators in generic math
* Remove the checked() context from integer division, since there is no behavioral difference on .NET
* Ensure the doc comments around user-defined checked operators are uncommented
* Fix some doc comments that shouldn't have been uncommented yet
* Bump version of C# compiler
This should be reverted when arcade brings in a new enough compiler.
* Fix a few new warnings from updating compiler
* Enable IDE0190 to employ parameter null checking
* Initial roll out of !!
* Fix more compiler warnings from upgrade, plus some test fixes / reverts
* Fix a few more tests
* Disable profiling test