Use Random.Shared if available. - #21149
Conversation
|
Ideally don't lock on the random instance. Check the logic in ThreadSafeRandomizer |
There was a problem hiding this comment.
🟡 Changes recommended
A test asserts that one random shuffle must change ordering, which can fail nondeterministically.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Updates RandomHelper to use Random.Shared and Shuffle on modern target frameworks while retaining compatibility with .NET Standard.
Changes:
- Uses thread-safe shared randomness on supported frameworks.
- Replaces list randomization with Fisher–Yates or
Shuffle. - Adds comprehensive
RandomHelpertests.
File summaries
| File | Description |
|---|---|
framework/src/Volo.Abp.Core/Volo/Abp/RandomHelper.cs |
Updates random number and list-shuffling implementations. |
framework/test/Volo.Abp.Core.Tests/Volo/Abp/RandomHelper_Tests.cs |
Adds coverage for random helper behavior. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #21149 +/- ##
==========================================
- Coverage 49.98% 49.97% -0.02%
==========================================
Files 3837 3838 +1
Lines 134467 134507 +40
Branches 10210 10211 +1
==========================================
+ Hits 67210 67214 +4
- Misses 65244 65279 +35
- Partials 2013 2014 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
No description provided.