Skip to content

[Infra] Fix new code analysis warnings#7098

Merged
martincostello merged 1 commit intoopen-telemetry:mainfrom
martincostello:dotnet-11-prep
Apr 16, 2026
Merged

[Infra] Fix new code analysis warnings#7098
martincostello merged 1 commit intoopen-telemetry:mainfrom
martincostello:dotnet-11-prep

Conversation

@martincostello
Copy link
Copy Markdown
Member

Changes

Cherry-pick fixes for new code analysis warnings identified by the .NET 11 preview 3 SDK in #6899.

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)

Cherry-pick fixes for new code analysis warnings identified by the .NET 11 preview 3 SDK in open-telemetry#6899.
@github-actions github-actions bot added pkg:OpenTelemetry.Extensions.Propagators Issues related to OpenTelemetry.Extensions.Propagators NuGet package pkg:OpenTelemetry Issues related to OpenTelemetry NuGet package perf Performance related labels Apr 15, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.73%. Comparing base (e0948d0) to head (1dbdd25).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #7098      +/-   ##
==========================================
- Coverage   88.79%   88.73%   -0.07%     
==========================================
  Files         270      270              
  Lines       12928    12927       -1     
==========================================
- Hits        11480    11471       -9     
- Misses       1448     1456       +8     
Flag Coverage Δ
unittests-Project-Experimental 88.69% <100.00%> (-0.09%) ⬇️
unittests-Project-Stable 88.65% <100.00%> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...lemetry.Extensions.Propagators/JaegerPropagator.cs 95.23% <ø> (-0.05%) ⬇️
.../OpenTelemetry/Internal/BatchExportThreadWorker.cs 82.92% <100.00%> (ø)
...ernal/PeriodicExportingMetricReaderThreadWorker.cs 75.47% <ø> (ø)

... and 3 files with indirect coverage changes

@martincostello martincostello marked this pull request as ready for review April 15, 2026 21:16
@martincostello martincostello requested a review from a team as a code owner April 15, 2026 21:16
Copilot AI review requested due to automatic review settings April 15, 2026 21:16
Copy link
Copy Markdown
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

Cherry-picks small code tweaks to address new .NET 11 preview 3 SDK code analysis warnings across tests, benchmarks, and a few internal/runtime components.

Changes:

  • Updates test/benchmark code to satisfy newer analyzer expectations (e.g., collection expressions, local function formatting).
  • Adjusts a unit test timeout pattern using WaitAsync on modern TFMs while keeping compatibility for older targets.
  • Makes minor internal code cleanups (e.g., switch exhaustiveness, thread naming, null-forgiveness removal).

Reviewed changes

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

Show a summary per file
File Description
test/OpenTelemetry.Tests/Logs/BatchLogRecordExportProcessorTests.cs Uses collection expressions for list initialization in tests.
test/OpenTelemetry.Tests/Internal/InterlockedHelperTests.cs Refines timeout handling to avoid hangs and align with newer analyzers across TFMs.
test/Benchmarks/Context/Propagation/BaggagePropagatorBenchmarks.cs Rewrites a local function body to satisfy updated analyzer/style expectations.
src/OpenTelemetry/Internal/PeriodicExportingMetricReaderThreadWorker.cs Adds an explicit default switch case for analyzer satisfaction (no functional change).
src/OpenTelemetry/Internal/BatchExportThreadWorker.cs Adjusts nameof usage in thread naming to avoid generic-type analyzer warnings.
src/OpenTelemetry.Extensions.Propagators/JaegerPropagator.cs Removes redundant null-forgiveness/conditional compilation around a non-nullable parameter.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@martincostello martincostello added this pull request to the merge queue Apr 16, 2026
Merged via the queue into open-telemetry:main with commit 1f3582a Apr 16, 2026
124 of 126 checks passed
@martincostello martincostello deleted the dotnet-11-prep branch April 16, 2026 05:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf Performance related pkg:OpenTelemetry.Extensions.Propagators Issues related to OpenTelemetry.Extensions.Propagators NuGet package pkg:OpenTelemetry Issues related to OpenTelemetry NuGet package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants