Skip to content

Thread safety: static mutable lists in BlockRegistrationService #22

@ThindalTV

Description

@ThindalTV

Problem

RegisteredBlocks and RegisteredGroups in BlockRegistrationService are static mutable List<T> instances with no synchronization. In multi-threaded scenarios — such as parallel test execution or concurrent startup initialization — concurrent modifications can cause race conditions, lost registrations, or exceptions.

File: src/BlazorBlocks/BlockRegistrationService.cs:17-18

Suggested Fix

Use ConcurrentBag<T> or add lock statements around all list modifications, or ensure registration is guaranteed to only happen once at startup in a single-threaded context.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions