Skip to content

Commit 97761c2

Browse files
committed
fix build warnings
1 parent 045d298 commit 97761c2

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

.openpublishing.redirection.csharp.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1712,6 +1712,10 @@
17121712
"source_path_from_root": "/docs/csharp/misc/cs1629.md",
17131713
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/iterator-yield"
17141714
},
1715+
{
1716+
"source_path_from_root": "/docs/csharp/misc/cs1631.md",
1717+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/iterator-yield"
1718+
},
17151719
{
17161720
"source_path_from_root": "/docs/csharp/misc/cs1632.md",
17171721
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/lambda-expression-errors#syntax-limitations-in-lambda-expressions"

docs/csharp/language-reference/compiler-messages/iterator-yield.md

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,20 @@ There are numerous *errors* related to the `yield return` statement and iterator
4040
<!-- The text in this list generates issues for Acrolinx, because they don't use contractions.
4141
That's by design. The text closely matches the text of the compiler error / warning for SEO purposes.
4242
-->
43-
- [**CS1622**](#): *Cannot return a value from an iterator. Use the yield return statement to return a value, or yield break to end the iteration.*
44-
- [**CS1624**](#): *The body of 'accessor' cannot be an iterator block because 'type' is not an iterator interface type*
45-
- [**CS1625**](#): *Cannot yield in the body of a finally clause*
46-
- [**CS1626**](#): *Cannot yield a value in the body of a try block with a catch clause*
47-
- [**CS1627**](#): *Expression expected after yield return*
48-
- [**CS1629**](#): *Unsafe code may not appear in iterators*
49-
- [**CS1631**](#): *Cannot yield a value in the body of a catch clause*
50-
- [**CS1637**](#): *Iterators cannot have unsafe parameters or yield types*
51-
- [**CS4013**](#): *Instance of type cannot be used inside a nested function, query expression, iterator block or async method*
52-
- [**CS8154**](#): *The body cannot be an iterator block because it returns by reference*
53-
- [**CS8176**](#): *Iterators cannot have by-reference locals*
54-
- [**CS9237**](#): *'yield return' should not be used in the body of a lock statement*
55-
- [**CS9238**](#): *Cannot use 'yield return' in an 'unsafe' block*
56-
- [**CS9239**](#): *The `&` operator cannot be used on parameters or local variables in iterator methods.*
57-
58-
In addition, the compiler might produce the following *warning* related to `lock` statements and thread synchronization:
59-
60-
- [**CS9216**](#lock-warning): *A value of type `System.Threading.Lock` converted to a different type will use likely unintended monitor-based locking in `lock` statement.*
43+
- [**CS1622**](#compiler-error-cs1622): *Cannot return a value from an iterator. Use the yield return statement to return a value, or yield break to end the iteration.*
44+
- [**CS1624**](#compiler-error-cs1624): *The body of 'accessor' cannot be an iterator block because 'type' is not an iterator interface type*
45+
- [**CS1625**](#compiler-error-cs1625): *Cannot yield in the body of a finally clause*
46+
- [**CS1626**](#compiler-error-cs1626): *Cannot yield a value in the body of a try block with a catch clause*
47+
- [**CS1627**](#compiler-error-cs1627): *Expression expected after yield return*
48+
- [**CS1629**](#compiler-error-cs1629): *Unsafe code may not appear in iterators*
49+
- [**CS1631**](#compiler-error-cs1631): *Cannot yield a value in the body of a catch clause*
50+
- [**CS1637**](#compiler-error-cs1637): *Iterators cannot have unsafe parameters or yield types*
51+
- [**CS4013**](#compiler-error-cs4013): *Instance of type cannot be used inside a nested function, query expression, iterator block or async method*
52+
- [**CS8154**](#compiler-error-cs8154): *The body cannot be an iterator block because it returns by reference*
53+
- [**CS8176**](#compiler-error-cs8176): *Iterators cannot have by-reference locals*
54+
- [**CS9237**](#new-errors): *'yield return' should not be used in the body of a lock statement*
55+
- [**CS9238**](#new-errors): *Cannot use 'yield return' in an 'unsafe' block*
56+
- [**CS9239**](#new-errors): *The `&` operator cannot be used on parameters or local variables in iterator methods.*
6157

6258
## Compiler Error CS1622
6359

@@ -232,7 +228,7 @@ class C
232228
}
233229
```
234230

235-
# Compiler Error CS1631
231+
## Compiler Error CS1631
236232

237233
Cannot yield a value in the body of a catch clause
238234

@@ -476,6 +472,7 @@ class C
476472
}
477473
}
478474
```
475+
479476
## New errors
480477

481478
- **CS9237**: *''yield return' should not be used in the body of a lock statement*

docs/csharp/language-reference/toc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ items:
465465
CS9093, CS9094, CS9095, CS9096, CS9097, CS9101, CS9102, CS9104, CS9190, CS9191, CS9192, CS9193, CS9195, CS9196, CS9197,
466466
CS9198, CS9199, CS9200, CS9201
467467
- name: Iterator methods
468-
href: ./iterator-yield.md
468+
href: ./compiler-messages/iterator-yield.md
469469
displayName: >
470470
yield return, yield break,
471471
CS1622, CS1624, CS1625, CS1626, CS1627, CS1629, CS1631, CS1637, CS4013, CS8154, CS8176, CS9237, CS9238, CS9239

0 commit comments

Comments
 (0)