dotnet / dotnet/dotnet-api-docs

InvalidOperationException: why it could be thrown if collection is empty?

Open
#1,242 0 comments 0 reactions 0 assignees View on GitHub
area-System.Collections dotnet-api/prod Pri2 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

It's unclear why InvalidOperationException could be thrown if BlockingCollection<T> is empty. Expected and observed behavior is blocking until any element(s) will appear.

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: 8fabfe6d-7861-ba15-9577-54315d8f3c9a
* Version Independent ID: 389d65d9-a325-491f-1acd-bdd72531f04b
* Content: [BlockingCollection<T>.Take Method (System.Collections.Concurrent)](https://docs.microsoft.com/en-us/dotnet/api/system.collections.concurrent.blockingcollection-1.take?view=netframework-4.7.2#feedback)
* Content Source: [xml/System.Collections.Concurrent/BlockingCollection`1.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Collections.Concurrent/BlockingCollection`1.xml)
* Product: **dotnet-api**
* GitHub Login: @dotnet-bot
* Microsoft Alias: **dotnetcontent**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.