[Infra] Fix new code analysis warnings#4379
Conversation
Fix new code analysis warnings raised when using the .NET 11 SDK.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4379 +/- ##
==========================================
- Coverage 75.65% 75.62% -0.03%
==========================================
Files 456 456
Lines 18246 18246
==========================================
- Hits 13804 13799 -5
- Misses 4442 4447 +5
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR addresses new C#/.NET code analysis warnings introduced when building the repository with the .NET 11 SDK (per #3867), by making small, analyzer-friendly updates in affected unit tests.
Changes:
- Refactor exception-type checks in
WsTransportTestto use modern pattern matching (is ... or ...) instead of chained||. - Remove an unnecessary
asyncmodifier from a test method that contains noawait, eliminating “async method lacks await” warnings.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/OpenTelemetry.OpAmp.Client.Tests/WsTransportTest.cs | Updates exception assertions to use is null or ... pattern matching to satisfy analyzers. |
| test/OpenTelemetry.Instrumentation.EventCounters.Tests/EventCountersMetricsTests.cs | Removes async from a test that performs no awaits to avoid analyzer warnings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Changes
Fix new code analysis warnings raised when using the .NET 11 SDK in #3867.
Merge requirement checklist
AppropriateCHANGELOG.mdfiles updated for non-trivial changesChanges in public API reviewed (if applicable)