[Infra] .NET 11 preparation

Merged
MA
3mo ago
+17-13

Changes

Cherry-pick changes from #3867 to fix new warnings and reduce the diff.

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)