Skip to content

Refactors RequestLogs property to use ConcurrentBag for improved thread safety #1333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

waldekmastykarz
Copy link
Collaborator

No description provided.

@waldekmastykarz waldekmastykarz added the pr-bugfix Fixes a bug label Jul 17, 2025
@Copilot Copilot AI review requested due to automatic review settings July 17, 2025 09:13
@waldekmastykarz waldekmastykarz requested a review from a team as a code owner July 17, 2025 09:13
Copy link
Contributor

@Copilot 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 refactors the RequestLogs property to use ConcurrentBag<T> instead of Collection<T> to improve thread safety in the proxy state management. This change addresses potential race conditions when multiple threads access the request logs simultaneously.

Key changes:

  • Replaced Collection<RequestLog> with ConcurrentBag<RequestLog> for thread-safe operations
  • Updated corresponding using statements to reference System.Collections.Concurrent

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
DevProxy/Proxy/ProxyState.cs Updated RequestLogs property type and using statement
DevProxy/Proxy/IProxyState.cs Updated interface definition to match new collection type

@waldekmastykarz waldekmastykarz force-pushed the fix-requestlogs-racecondition branch from 9cfba7d to bce3a67 Compare July 17, 2025 09:16
@waldekmastykarz waldekmastykarz merged commit d497d00 into dotnet:main Jul 17, 2025
4 checks passed
@waldekmastykarz waldekmastykarz deleted the fix-requestlogs-racecondition branch July 17, 2025 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-bugfix Fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants