InvalidOperationException
The .NET exception thrown when a call is not valid for the object's current state, such as First on a sequence with no match.
In more detail
It signals a problem with when or how a method was called rather than with a particular argument. The course also throws it on purpose in async examples to show how exceptions travel across await.
Related terms
- exception — An error object a program raises to stop normal flow and report that something went wrong.
- FirstOrDefault — The LINQ operator that returns the first matching item, or null (or zero for value types) when nothing matches.
Taught in
- Collections, Generics, and LINQ — Modern .NET Core, C# & Enterprise Microservices
- Async and Await: Managing Concurrency — Modern .NET Core, C# & Enterprise Microservices