Skip to content

Conversation

@hamzamahmood
Copy link
Collaborator

What

  • This PR improves the thread safety and reliability of parameter handling by:
  • Replacing the List used for collecting parameters with ConcurrentBag to ensure safe concurrent access.
  • Updating unit tests to account for the unordered nature of ConcurrentBag by comparing parameter sets in an order-independent way.
  • Fixing an incorrect README.md file path in the .csproj file to ensure the file is properly included in the build/package output.

Why

  • Thread Safety: The original use of List was not safe in concurrent scenarios, which could lead to race conditions or inconsistent parameter states. Using ConcurrentBag eliminates this issue.
  • Test Stability: Since ConcurrentBag does not guarantee order, the unit tests were updated to validate parameter content regardless of sequence, ensuring deterministic and reliable test results.
  • Project Cleanliness: The incorrect file path for README.md in the project file has been corrected to maintain project integrity and consistency.

Type of change

Select multiple if applicable.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause a breaking change)
  • Tests (adds or updates tests)
  • Documentation (adds or updates documentation)
  • Refactor (style improvements, performance improvements, code refactoring)
  • Revert (reverts a commit)
  • CI/Build (adds or updates a script, change in external dependencies)

Testing

List the steps that were taken to test the changes

Checklist

  • My code follows the coding conventions
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added new unit tests

- Added `ConfigureAwait(false)` to `await` calls in async methods to prevent deadlocks.
…d improve test reliability

- Replaced List with ConcurrentBag for thread-safe parameter collection
- Updated unit tests to support unordered parameter comparison
- Fixed incorrect README.md file path in .csproj
@hamzamahmood hamzamahmood self-assigned this May 21, 2025
@hamzamahmood hamzamahmood added the bug Something isn't working label May 21, 2025
@sonarqubecloud
Copy link

@hamzamahmood hamzamahmood changed the title fix(client): prevent client freeze when calling async from sync methods fix(parameters): resolve freeze issue when updating auth model concurrently May 22, 2025
@hamzamahmood hamzamahmood merged commit 83f3f5c into main May 22, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants