Skip to content

![security-medium](https://www.gstatic.com/codereviewagent/security-medium-priority.svg) ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg) #84

@jun92

Description

@jun92

security-medium medium

The Build method uses a non-atomic check-and-set pattern on a ConcurrentDictionary (TryGetValue followed by Add). In a multi-threaded environment, this can lead to an ArgumentException if multiple threads attempt to add the same key simultaneously, causing the game session to terminate. Additionally, the cache uses args.GetType() as the key while resolving the builder based on typeof(TArgs). If the method is called with the same argument type but different generic type parameters, it may retrieve a cached builder that cannot be cast to the expected interface, leading to an InvalidCastException and session termination.

Originally posted by @gemini-code-assist[bot] in #83 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions