Skip to content

Documenting InvalidOperationException for ReadLockAsync (and possibly other methods) #1128

Closed

Description

@MartyIX

I know that AsyncReaderWriterLock has the "completion" feature (i.e. asyncReaderWriterLock.Complete()) but:

/// <summary>
/// Obtains a read lock, asynchronously awaiting for the lock if it is not immediately available.
/// </summary>
/// <param name="cancellationToken">
/// A token whose cancellation indicates lost interest in obtaining the lock.
/// A canceled token does not release a lock that has already been issued. But if the lock isn't immediately available,
/// a canceled token will cause the code that is waiting for the lock to resume with an <see cref="OperationCanceledException"/>.
/// </param>
/// <returns>An awaitable object whose result is the lock releaser.</returns>

is not really helpful in explaining what happens when the AsyncReaderWriterLock.Complete() has been called.

For me it throws: System.InvalidOperationException : This lock has already been marked for completion. No new top-level locks can be serviced.

Would it be worth documening that?

cc Andrew Arnott (@AArnott)

Activity

  1. AArnott commented on Jan 6, 2023

    @AArnott
    Member

    Sure. Are you thinking some /// <exception docs on the impacted APIs? If so, would you be interested in sending a PR?

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions