Open
Description
Remove error "Cannot yield a value in the body of a try block with a catch clause"
- Specification: Allow yield inside of try / catch and catch #8413
- Discussion: Champion: Remove error "Cannot yield a value in the body of a try block with a catch clause" #8994
Summary
As recently noted by C# users, the existing restriction that you cannot yield a value in the body of a try block with a catch clause is one that interferes with reasonable code refactoring. The restriction does not make the compiler any easier. Rather it was added to align with the conceptual model that the caller's loop is logically "called" at the point of the yield
. But that is not how people think of the construct, and the restriction has little value. We propose to remove it.