Skip to content

Support for rewriting SemaphoreSlim? #163

Closed

Description

I'm attempting to use Coyote to check for bugs in a library of mine, but some of my code is using System.Threading.SemaphoreSlim, which currently isn't supported.
It seems that there is a compatible implementation already available here:
https://github.com/microsoft/coyote/blob/main/Source/Core/Tasks/Locks/Semaphore.cs
My code seems to work normally when I manually rewrite it to use this implementation.

Could a rewrite rule be added to directly support code which uses SemaphoreSlim, or is there a detail I've missed?

Activity

  1. pdeligia commented on Apr 22, 2021

    @pdeligia
    Member

    Thanks for trying out Coyote Cameron Martens (@camerondm9), and raising this issue! No you are right, if you manually switch to the Semaphore implementation available in Coyote then it will indeed work, it is just that we did not add yet a rewriting pass to automate this type.

    We basically used to ask developers to manually change the default .NET types to the "concurrency testable" versions provided by Coyote, like this Semaphore one, but a few months ago we introduced rewriting to fully automate this process and make it much more user friendly. So far we have focused on the most common TPL types, but we are happy to add rewriting for SemaphoreSlim, as its already there after all :)

    I will ping you once I add it to rewriting. Btw, we also welcome (and would love) contributions if tackling this was something that you would be interested to try out! Feel free to let me know in that case.

  2. pdeligia commented on Sep 13, 2022

    @pdeligia
    Member

    Closing as this is duplicate of #368, this is now supported and will be available in the next release.

  3. locked and limited conversation to collaborators on Oct 17, 2022
  4. converted this issue into a discussion #397 on Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions