Mutex helper for interprocess sychronization of accessing a network drive
Unfortunately you are in fact doing something wrong, but maybe not terribly! Because you are accessing the Mutex either side of an await, there is no guarantee that the same thread will be accessing it each time. The question and answer here have more detail. This is only a problem if your SynchronizationContext doesn't guarantee async calls will return to the same thread (as I suspect is the case when running your tests). If you only call this code from the UI thread of a WPF app for example, you won't have any issues. The code breaks when used in a console app however.

public class Program
{
    public static async Task Main()
    {
        using (var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30)))
        {
            await Task.WhenAll(
                InterprocessSynchronizer.TryExecuteAsync("resource", c =&gt; SwitchThreads("FIRST", c), TimeSpan.FromSeconds(60), cts.Token),
                InterprocessSynchronizer.TryExecuteAsync("resource", c =&gt; SwitchThreads("SECOND", c), TimeSpan.FromSeconds(60), cts.Token)
            );
        }
    }

    private static async Task&lt;int&gt; SwitchThreads(string name, CancellationToken arg)
    {
        Console.WriteLine($"{name} ON THREAD ID {Thread.CurrentThread.ManagedThreadId}");
        await Task.Delay(1000, arg);
        Console.WriteLine($"{name} NOW ON THREAD ID {Thread.CurrentThread.ManagedThreadId}");
        return 0;
    }
}



  Object synchronization method was called from an unsynchronized block of code


If you encounter this error some of the suggesting in the afformentioned SO question could help.