Skip to content

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

Merged
waldekmastykarz merged 1 commit into
dotnet:mainfrom
waldekmastykarz:fix-requestlogs-racecondition
Jul 17, 2025
Merged

Refactors RequestLogs property to use ConcurrentBag for improved thread safety#1333
waldekmastykarz merged 1 commit into
dotnet:mainfrom
waldekmastykarz:fix-requestlogs-racecondition

Conversation

@waldekmastykarz

Copy link
Copy Markdown
Collaborator

No description provided.

@waldekmastykarz waldekmastykarz added the pr-bugfix Fixes a bug label Jul 17, 2025
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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread DevProxy/Proxy/ProxyState.cs Outdated
@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.

3 participants