Skip to content

Conversation

@stephentoub
Copy link
Member

@stephentoub stephentoub commented Nov 30, 2025

Microsoft Reviewers: Open in CodeFlow

Copilot AI review requested due to automatic review settings November 30, 2025 04:43
@stephentoub stephentoub requested review from a team as code owners November 30, 2025 04:43
@stephentoub stephentoub changed the title Update to latest SonarAnalyzer.CSharp Update SonarAnalyzer.CSharp to latest Nov 30, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the SonarAnalyzer.CSharp analyzer from version 8.56.0.67649 to 10.16.0.128591 and addresses the new analyzer warnings and suggestions introduced by this update. The changes are purely code quality improvements with no functional impact - they improve performance, code clarity, and consistency across the codebase.

Key Changes:

  • Enhanced culture-aware DateTime/DateTimeOffset parsing in tests using DateTimeFormatInfo.InvariantInfo
  • Optimized LINQ-to-Objects operations by replacing with more efficient array-based methods (FirstOrDefaultArray.Find, AnyArray.Exists/List.Exists, AllArray.TrueForAll)
  • Improved structured logging with PascalCase template parameter names following Microsoft conventions
  • Various code simplifications including boolean expression cleanup, named parameter usage, and control flow consolidation

Reviewed changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated no comments.

Show a summary per file
File Description
eng/packages/General.props Updates SonarAnalyzer.CSharp package version from 8.56.0.67649 to 10.16.0.128591
test/.editorconfig Configures new analyzer rules (S6672, S6966, S6967) and disables rules with too many false positives (S107, S3247, S6588)
src/Libraries/.editorconfig Same analyzer rule configuration updates for source libraries
eng/Tools/.editorconfig Same analyzer rule configuration updates for engineering tools
test/Libraries/Microsoft.Extensions.AI.Tests/Embeddings/DistributedCachingEmbeddingGeneratorTest.cs Adds culture-aware DateTimeOffset parsing with InvariantInfo for test data
test/Libraries/Microsoft.Extensions.AI.Tests/ChatCompletion/DistributedCachingChatClientTest.cs Adds culture-aware DateTime parsing with InvariantInfo for test assertions
test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/Embeddings/EmbeddingTests.cs Adds culture-aware DateTimeOffset parsing with InvariantInfo for test data
test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/Embeddings/BinaryEmbeddingTests.cs Adds culture-aware DateTimeOffset parsing with InvariantInfo for test data
test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/ChatCompletion/ChatResponseUpdateExtensionsTests.cs Adds culture-aware DateTimeOffset parsing with InvariantInfo across multiple test scenarios
test/Generators/Microsoft.Gen.Logging/TestClasses/NonSensitiveRecordExtensions.cs Simplifies record declaration syntax by removing empty parameter list
src/Shared/ServerSentEvents/SseItem.cs Simplifies boolean comparisons by removing redundant is true checks
src/Shared/FxPolyfills/IPEndPoint.cs Consolidates duplicate conditional branches with identical assignments
src/Libraries/Microsoft.Extensions.Telemetry/Buffering/GlobalLogBufferManager.cs Adds closure-free GetOrAdd overload using static lambda for NET target framework
src/Libraries/Microsoft.Extensions.ServiceDiscovery.Dns/Resolver/DnsResolver.cs Replaces LINQ methods with more efficient List methods (FirstOrDefault → Find, Any → Exists)
src/Libraries/Microsoft.Extensions.ServiceDiscovery.Dns/DnsServiceEndpointProviderBase.cs Consolidates duplicate conditional branches with combined condition
src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Linux/LinuxUtilizationParserCgroupV2.cs Optimizes string concatenation using string interpolation to avoid ToString() allocation
src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Linux/Disk/DiskStatsReader.cs Replaces LINQ Any with Array.Exists and removes unused System.Linq import
src/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.ResourceUtilization/ResourceUtilizationHealthCheck.cs Uses named parameter syntax for better code clarity
src/Libraries/Microsoft.Extensions.DataIngestion.MarkItDown/MarkItDownMcpReader.cs Uses named parameter syntax for better code clarity
src/Libraries/Microsoft.Extensions.DataIngestion.Abstractions/Microsoft.Extensions.DataIngestion.Abstractions.csproj Suppresses additional SonarAnalyzer rule S2368
src/Libraries/Microsoft.Extensions.AI/ChatCompletion/FunctionInvokingChatClient.cs Replaces LINQ Any with List.Exists for better performance
src/Libraries/Microsoft.Extensions.AI.OpenAI/MicrosoftExtensionsAIChatExtensions.cs Uses named parameters for factory method calls to improve code clarity
src/Libraries/Microsoft.Extensions.AI.Evaluation/CompositeEvaluator.cs Uses named parameter syntax for better code clarity
src/Libraries/Microsoft.Extensions.AI.Evaluation.Console/Telemetry/TelemetryHelper.cs Updates logging statement to use structured logging with PascalCase parameter names
src/Libraries/Microsoft.Extensions.AI.Evaluation.Console/Telemetry/EnvironmentHelper.cs Replaces LINQ All with Array.TrueForAll and removes unused System.Linq import
src/Libraries/Microsoft.Extensions.AI.Evaluation.Console/Commands/ReportCommand.cs Updates logging template parameter names to PascalCase convention
src/Libraries/Microsoft.Extensions.AI.Evaluation.Console/Commands/CleanResultsCommand.cs Updates logging template parameter names to PascalCase convention
src/Libraries/Microsoft.Extensions.AI.Evaluation.Console/Commands/CleanCacheCommand.cs Updates logging template parameter names to PascalCase convention
src/Generators/Shared/DiagDescriptorsBase.cs Uses named parameter syntax for DiagnosticDescriptor constructor
src/Generators/Microsoft.Gen.Logging/Parsing/Parser.cs Replaces LINQ All with List.TrueForAll for consistency
src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/JsonValue.cs Adds culture-aware DateTime parsing with InvariantInfo and DateTimeStyles.None
src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/JsonObject.cs Fixes DebuggerDisplay attribute to reference correct field names
src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/AssemblyAnalysis.cs Replaces LINQ FirstOrDefault with Array.Find for better performance across multiple locations
bench/Libraries/Microsoft.Extensions.Telemetry.PerformanceTests/ModernCodeGen.cs Replaces FormattableString.Invariant with string.Create for modern .NET optimization

This was referenced Dec 22, 2025
renebentes pushed a commit to renebentes/3054 that referenced this pull request Dec 23, 2025
… 10.1.0 (#90)

Updated
[Microsoft.Extensions.Http.Resilience](https://github.com/dotnet/extensions)
from 10.0.0 to 10.1.0.

<details>
<summary>Release notes</summary>

_Sourced from [Microsoft.Extensions.Http.Resilience's
releases](https://github.com/dotnet/extensions/releases)._

## 10.1.0

## What's Changed
* [MEDI] start producing NuGet packages by @​adamsitnik in
dotnet/extensions#7016
* Deprecate AddServiceLogEnricher method with its overloads, introduce
replacements by @​evgenyfedorov2 in
dotnet/extensions#6529
* Update version numbers in AI changelogs by @​stephentoub in
dotnet/extensions#7008
* HttpDependencyMetadataResolver class for the custom downstream
dependency metadata resolution by @​rainsxng in
dotnet/extensions#6880
* [MEDI] Don't stop document processing on enricher error by
@​adamsitnik in dotnet/extensions#7005
* [MEDI] add PackageTags by @​adamsitnik in
dotnet/extensions#7022
* Add a new Microsoft.Agents.AI.Templates package with an aiagent-webapi
project template by @​jeffhandley in
dotnet/extensions#7014
* Add MarkItDownMcpReader for MCP server support by @​Copilot in
dotnet/extensions#7025
* Image generation tool by @​ericstj in
dotnet/extensions#6749
* Make MEAI packages use 10.0 runtime packages by @​ericstj in
dotnet/extensions#7028
* When using latest .NET packages, force System.Numerics.Tensors to 10.0
(for MEAI) by @​jeffhandley in
dotnet/extensions#7031
* [main] Update dependencies from dotnet/arcade by @​dotnet-maestro[bot]
in dotnet/extensions#7032
* Use DataContent from Microsoft.Extensions.AI for data URI generation
by @​Copilot in dotnet/extensions#7027
* Add AmbientMetadata.Build component by @​evgenyfedorov2 in
dotnet/extensions#6623
* Introduce SectionChunker by @​KrystofS in
dotnet/extensions#7015
* Use `Microsoft.Extensions.DataIngestion` in AI Chat Web template by
@​MackinnonBuck in dotnet/extensions#7023
* Add Agent Framework DevUI into the aiagent-webapi template by
@​jeffhandley in dotnet/extensions#7026
* Adjust cgroupv2 drive format check for .NET 10 and higher by
@​KeterSCP in dotnet/extensions#6877
* Replace custom IAsyncEnumerable extensions with
System.Linq.AsyncEnumerable by @​Copilot in
dotnet/extensions#7039
* Add Image Detail support for Image DataContent to
OpenAIResponsesChatClient. by @​rogerbarreto in
dotnet/extensions#7042
* [main] Update dependencies from dotnet/arcade by @​dotnet-maestro[bot]
in dotnet/extensions#7043
* Update to OpenAI 2.7.0 by @​stephentoub in
dotnet/extensions#7044
* Merge changes from internal by @​joperezr in
dotnet/extensions#7038
* Merge rel10 by @​joperezr in
dotnet/extensions#7047
* Disable AzDO dependabot by @​mmitche in
dotnet/extensions#7045
* Bump version to 10.1.0 for next development cycle by @​Copilot in
dotnet/extensions#7018
* Update AI Chat Web template to Aspire 13.0.0 by @​Copilot in
dotnet/extensions#7036
* Fix flaky SetupSequence tests by @​amadeuszl in
dotnet/extensions#7051
* Update AI changelogs by @​stephentoub in
dotnet/extensions#7037
* Update project template dependencies by @​jeffhandley in
dotnet/extensions#7064
* Reset Microsoft.Agents.AI.ProjectTemplates versioning by @​jeffhandley
in dotnet/extensions#7034
* Fix operator precedence bug in ValidateSchemaDocument causing
rejection of valid boolean schemas by @​Copilot in
dotnet/extensions#7066
* Use JsonElement.Parse for JsonElement conversions in AI libraries by
@​Copilot in dotnet/extensions#7067
* .NET: Change type of ContinuationToken properties by @​SergeyMenshykh
in dotnet/extensions#7050
* Fix OpenAIEmbeddingGenerator to handle missing usage data by
@​stephentoub in dotnet/extensions#7074
* Add AIJsonSchemaCreateOptions.ParameterDescriptions by @​stephentoub
in dotnet/extensions#7068
* Improve FunctionInvokingChatClient's awareness of agents by
@​stephentoub in dotnet/extensions#7030
* Add Kubernetes based Resource Monitoring by @​amadeuszl in
dotnet/extensions#6748
* Ensure all ResponseItems are yielded in AIContent by @​crickman in
dotnet/extensions#7063
* Add CHANGELOG.md files for Microsoft.Extensions.DataIngestion*
projects by @​Copilot in dotnet/extensions#7072
* Assign authors only on PR creation by @​sebastienros in
dotnet/extensions#7083
* Update to .NET 10 GA release by @​Copilot in
dotnet/extensions#7078
* Fix package references from M.E.AI packages by @​stephentoub in
dotnet/extensions#7076
* Workaround OpenAI bug with streaming error events by @​stephentoub in
dotnet/extensions#7085
* Update AI changelogs for 10.0.1 release by @​stephentoub in
dotnet/extensions#7086
* Add metering for baseline resource quotas by @​amadeuszl in
dotnet/extensions#7080
* Update Microsoft.VisualStudio.Threading.Analyzers to latest by
@​stephentoub in dotnet/extensions#7091
* Update SonarAnalyzer.CSharp to latest by @​stephentoub in
dotnet/extensions#7092
* Remove Microsoft.Extensions.AI.AzureAIInference by @​stephentoub in
dotnet/extensions#7096
 ... (truncated)

Commits viewable in [compare
view](dotnet/extensions@v10.0.0...v10.1).
</details>

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=Microsoft.Extensions.Http.Resilience&package-manager=nuget&previous-version=10.0.0&new-version=10.1.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
renebentes added a commit to renebentes/3054 that referenced this pull request Dec 23, 2025
…o 10.1.0 (#91)

Updated
[Microsoft.Extensions.ServiceDiscovery](https://github.com/dotnet/extensions)
from 10.0.0 to 10.1.0.

<details>
<summary>Release notes</summary>

_Sourced from [Microsoft.Extensions.ServiceDiscovery's
releases](https://github.com/dotnet/extensions/releases)._

## 10.1.0

## What's Changed
* [MEDI] start producing NuGet packages by @​adamsitnik in
dotnet/extensions#7016
* Deprecate AddServiceLogEnricher method with its overloads, introduce
replacements by @​evgenyfedorov2 in
dotnet/extensions#6529
* Update version numbers in AI changelogs by @​stephentoub in
dotnet/extensions#7008
* HttpDependencyMetadataResolver class for the custom downstream
dependency metadata resolution by @​rainsxng in
dotnet/extensions#6880
* [MEDI] Don't stop document processing on enricher error by
@​adamsitnik in dotnet/extensions#7005
* [MEDI] add PackageTags by @​adamsitnik in
dotnet/extensions#7022
* Add a new Microsoft.Agents.AI.Templates package with an aiagent-webapi
project template by @​jeffhandley in
dotnet/extensions#7014
* Add MarkItDownMcpReader for MCP server support by @​Copilot in
dotnet/extensions#7025
* Image generation tool by @​ericstj in
dotnet/extensions#6749
* Make MEAI packages use 10.0 runtime packages by @​ericstj in
dotnet/extensions#7028
* When using latest .NET packages, force System.Numerics.Tensors to 10.0
(for MEAI) by @​jeffhandley in
dotnet/extensions#7031
* [main] Update dependencies from dotnet/arcade by @​dotnet-maestro[bot]
in dotnet/extensions#7032
* Use DataContent from Microsoft.Extensions.AI for data URI generation
by @​Copilot in dotnet/extensions#7027
* Add AmbientMetadata.Build component by @​evgenyfedorov2 in
dotnet/extensions#6623
* Introduce SectionChunker by @​KrystofS in
dotnet/extensions#7015
* Use `Microsoft.Extensions.DataIngestion` in AI Chat Web template by
@​MackinnonBuck in dotnet/extensions#7023
* Add Agent Framework DevUI into the aiagent-webapi template by
@​jeffhandley in dotnet/extensions#7026
* Adjust cgroupv2 drive format check for .NET 10 and higher by
@​KeterSCP in dotnet/extensions#6877
* Replace custom IAsyncEnumerable extensions with
System.Linq.AsyncEnumerable by @​Copilot in
dotnet/extensions#7039
* Add Image Detail support for Image DataContent to
OpenAIResponsesChatClient. by @​rogerbarreto in
dotnet/extensions#7042
* [main] Update dependencies from dotnet/arcade by @​dotnet-maestro[bot]
in dotnet/extensions#7043
* Update to OpenAI 2.7.0 by @​stephentoub in
dotnet/extensions#7044
* Merge changes from internal by @​joperezr in
dotnet/extensions#7038
* Merge rel10 by @​joperezr in
dotnet/extensions#7047
* Disable AzDO dependabot by @​mmitche in
dotnet/extensions#7045
* Bump version to 10.1.0 for next development cycle by @​Copilot in
dotnet/extensions#7018
* Update AI Chat Web template to Aspire 13.0.0 by @​Copilot in
dotnet/extensions#7036
* Fix flaky SetupSequence tests by @​amadeuszl in
dotnet/extensions#7051
* Update AI changelogs by @​stephentoub in
dotnet/extensions#7037
* Update project template dependencies by @​jeffhandley in
dotnet/extensions#7064
* Reset Microsoft.Agents.AI.ProjectTemplates versioning by @​jeffhandley
in dotnet/extensions#7034
* Fix operator precedence bug in ValidateSchemaDocument causing
rejection of valid boolean schemas by @​Copilot in
dotnet/extensions#7066
* Use JsonElement.Parse for JsonElement conversions in AI libraries by
@​Copilot in dotnet/extensions#7067
* .NET: Change type of ContinuationToken properties by @​SergeyMenshykh
in dotnet/extensions#7050
* Fix OpenAIEmbeddingGenerator to handle missing usage data by
@​stephentoub in dotnet/extensions#7074
* Add AIJsonSchemaCreateOptions.ParameterDescriptions by @​stephentoub
in dotnet/extensions#7068
* Improve FunctionInvokingChatClient's awareness of agents by
@​stephentoub in dotnet/extensions#7030
* Add Kubernetes based Resource Monitoring by @​amadeuszl in
dotnet/extensions#6748
* Ensure all ResponseItems are yielded in AIContent by @​crickman in
dotnet/extensions#7063
* Add CHANGELOG.md files for Microsoft.Extensions.DataIngestion*
projects by @​Copilot in dotnet/extensions#7072
* Assign authors only on PR creation by @​sebastienros in
dotnet/extensions#7083
* Update to .NET 10 GA release by @​Copilot in
dotnet/extensions#7078
* Fix package references from M.E.AI packages by @​stephentoub in
dotnet/extensions#7076
* Workaround OpenAI bug with streaming error events by @​stephentoub in
dotnet/extensions#7085
* Update AI changelogs for 10.0.1 release by @​stephentoub in
dotnet/extensions#7086
* Add metering for baseline resource quotas by @​amadeuszl in
dotnet/extensions#7080
* Update Microsoft.VisualStudio.Threading.Analyzers to latest by
@​stephentoub in dotnet/extensions#7091
* Update SonarAnalyzer.CSharp to latest by @​stephentoub in
dotnet/extensions#7092
* Remove Microsoft.Extensions.AI.AzureAIInference by @​stephentoub in
dotnet/extensions#7096
 ... (truncated)

Commits viewable in [compare
view](dotnet/extensions@v10.0.0...v10.1).
</details>

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=Microsoft.Extensions.ServiceDiscovery&package-manager=nuget&previous-version=10.0.0&new-version=10.1.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Rene Bentes Pinto <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants