Skip to content

Enforce or guide towards async usage #299

Open

Description

@gliljas

Since, after all, this is distributed, the async usage of distributed locks is often the better path. Some providers may really benefit from enforced async usage.

What could help is separating the abstractions into Async+Sync / Async, like SE Redis https://github.com/seredis/StackExchange.Redis/blob/main/src/StackExchange.Redis/Interfaces/IDatabase.cs.

Or there could be a Roslyn analyzer where the detection of sync usage is something you can opt in to making a hard error or a warning.

Activity

  1. madelson commented on Nov 21, 2026

    @madelson
    Owner

    @gliljas I just tested https://www.nuget.org/packages/Microsoft.VisualStudio.Threading.Analyzers with this and it seems to do a good job of flagging any use of sync locking methods in an async context. That's what I would recommend for this use-case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions