Skip to content

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

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 @AArnott

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions