Skip to content

Commit 8a010e8

Browse files
committed
warnings
1 parent 4c3075e commit 8a010e8

File tree

3 files changed

+33
-35
lines changed

3 files changed

+33
-35
lines changed

.openpublishing.redirection.csharp.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,10 @@
343343
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs0188.md",
344344
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/feature-version-errors"
345345
},
346+
{
347+
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs0233.md",
348+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/unsafe-code-errors"
349+
},
346350
{
347351
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs0234.md",
348352
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/assembly-references"
@@ -1677,10 +1681,6 @@
16771681
"source_path_from_root": "/docs/csharp/misc/cs0227.md",
16781682
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/unsafe-code-errors"
16791683
},
1680-
{
1681-
"source_path_from_root": "/docs/csharp/misc/cs0233.md",
1682-
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/unsafe-code-errors"
1683-
},
16841684
{
16851685
"source_path_from_root": "/docs/csharp/misc/cs0242.md",
16861686
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/unsafe-code-errors"

docs/csharp/language-reference/compiler-messages/unsafe-code-errors.md

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -68,36 +68,34 @@ This article covers the following compiler errors:
6868
<!-- The text in this list generates issues for Acrolinx, because they don't use contractions.
6969
That's by design. The text closely matches the text of the compiler error / warning for SEO purposes.
7070
-->
71-
- [**CS0193**](#pointer-operations-and-dereferencing): *The \* or -> operator must be applied to a data pointer*
72-
- [**CS0196**](#pointer-operations-and-dereferencing): *A pointer must be indexed by only one value*
73-
- [**CS0208**](#pointer-types-and-managed-types): *Cannot take the address of, get the size of, or declare a pointer to a managed type ('type')*
74-
- [**CS0209**](#fixed-buffers): *The type of local declared in a fixed statement must be a pointer type*
75-
- [**CS0210**](#fixed-buffers): *You must provide an initializer in a fixed or `using` statement declaration*
76-
- [**CS0211**](#fixed-buffers): *Cannot take the address of the given expression*
77-
- [**CS0212**](#fixed-buffers): *You can only take the address of an unfixed expression inside of a fixed statement initializer*
78-
- [**CS0213**](#fixed-buffers): *You cannot use the fixed statement to take the address of an already fixed expression*
79-
- [**CS0214**](#unsafe-context-restrictions): *Pointers and fixed size buffers may only be used in an unsafe context*
80-
- [**CS0227**](#unsafe-context-restrictions): *Unsafe code may only appear if compiling with /unsafe*
81-
- [**CS0233**](#pointer-types-and-managed-types): *'identifier' does not have a predefined size, therefore sizeof can only be used in an unsafe context*
82-
- [**CS0242**](#pointer-operations-and-dereferencing): *The operation in question is undefined on void pointers*
83-
- [**CS0244**](#unsafe-context-restrictions): *Neither 'is' nor 'as' is valid on pointer types*
84-
- [**CS0254**](#fixed-buffers): *The right hand side of a fixed statement assignment may not be a cast expression*
85-
- [**CS0459**](#fixed-buffers): *Cannot take the address of a read-only local variable*
86-
- [**CS0821**](#fixed-buffers): *Implicitly typed locals cannot be fixed*
87-
- [**CS1641**](#fixed-size-buffers): *A fixed size buffer field must have the array size specifier after the field name*
88-
- [**CS1642**](#fixed-size-buffers): *Fixed size buffer fields may only be members of structs.*
89-
- [**CS1656**](#fixed-buffers): *Cannot assign to 'variable' because it is a 'read-only variable type'*
90-
- [**CS1663**](#fixed-size-buffers): *Fixed size buffer type must be one of the following: bool, byte, short, int, long, char, sbyte, ushort, uint, ulong, float or double*
91-
- [**CS1665**](#fixed-size-buffers): *Fixed size buffers must have a length greater than zero*
92-
- [**CS1666**](#fixed-size-buffers): *You cannot use fixed size buffers contained in unfixed expressions. Try using the fixed statement.*
93-
- [**CS1708**](#fixed-size-buffers): *Fixed size buffers can only be accessed through locals or fields*
94-
- [**CS1716**](#fixed-size-buffers): *Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute. Use the 'fixed' field modifier instead.*
95-
- [**CS1919**](#unsafe-context-requirements): *Unsafe type 'type name' cannot be used in object creation.*
96-
- [**CS4004**](#unsafe-context-requirements): *Cannot await in an unsafe context*
97-
- [**CS8812**](#function-pointers): *Cannot convert `&Method` group to non-function pointer type.*
98-
- [**CS9123**](#unsafe-context-requirements): *The '`&`' operator should not be used on parameters or local variables in async methods.
99-
100-
In addition, the following warnings are covered in this article:
71+
- [**CS0193**](#pointer-operations-and-dereferencing): *The \* or -> operator must be applied to a data pointer*
72+
- [**CS0196**](#pointer-operations-and-dereferencing): *A pointer must be indexed by only one value*
73+
- [**CS0208**](#pointer-types-and-managed-types): *Cannot take the address of, get the size of, or declare a pointer to a managed type ('type')*
74+
- [**CS0209**](#fixed-buffers): *The type of local declared in a fixed statement must be a pointer type*
75+
- [**CS0210**](#fixed-buffers): *You must provide an initializer in a fixed or `using` statement declaration*
76+
- [**CS0211**](#fixed-buffers): *Cannot take the address of the given expression*
77+
- [**CS0212**](#fixed-buffers): *You can only take the address of an unfixed expression inside of a fixed statement initializer*
78+
- [**CS0213**](#fixed-buffers): *You cannot use the fixed statement to take the address of an already fixed expression*
79+
- [**CS0214**](#unsafe-context-restrictions): *Pointers and fixed size buffers may only be used in an unsafe context*
80+
- [**CS0227**](#unsafe-context-restrictions): *Unsafe code may only appear if compiling with /unsafe*
81+
- [**CS0233**](#pointer-types-and-managed-types): *'identifier' does not have a predefined size, therefore sizeof can only be used in an unsafe context*
82+
- [**CS0242**](#pointer-operations-and-dereferencing): *The operation in question is undefined on void pointers*
83+
- [**CS0244**](#unsafe-context-restrictions): *Neither 'is' nor 'as' is valid on pointer types*
84+
- [**CS0254**](#fixed-buffers): *The right hand side of a fixed statement assignment may not be a cast expression*
85+
- [**CS0459**](#fixed-buffers): *Cannot take the address of a read-only local variable*
86+
- [**CS0821**](#fixed-buffers): *Implicitly typed locals cannot be fixed*
87+
- [**CS1641**](#fixed-size-buffers): *A fixed size buffer field must have the array size specifier after the field name*
88+
- [**CS1642**](#fixed-size-buffers): *Fixed size buffer fields may only be members of structs.*
89+
- [**CS1656**](#fixed-buffers): *Cannot assign to 'variable' because it is a 'read-only variable type'*
90+
- [**CS1663**](#fixed-size-buffers): *Fixed size buffer type must be one of the following: bool, byte, short, int, long, char, sbyte, ushort, uint, ulong, float or double*
91+
- [**CS1665**](#fixed-size-buffers): *Fixed size buffers must have a length greater than zero*
92+
- [**CS1666**](#fixed-size-buffers): *You cannot use fixed size buffers contained in unfixed expressions. Try using the fixed statement.*
93+
- [**CS1708**](#fixed-size-buffers): *Fixed size buffers can only be accessed through locals or fields*
94+
- [**CS1716**](#fixed-size-buffers): *Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute. Use the 'fixed' field modifier instead.*
95+
- [**CS1919**](#unsafe-context-restrictions): *Unsafe type 'type name' cannot be used in object creation.*
96+
- [**CS4004**](#unsafe-context-restrictions): *Cannot await in an unsafe context*
97+
- [**CS8812**](#function-pointers): *Cannot convert `&Method` group to non-function pointer type.*
98+
- [**CS9123**](#unsafe-context-restrictions): *The '`&`' operator should not be used on parameters or local variables in async methods.*
10199

102100
## Pointer operations and dereferencing
103101

docs/csharp/misc/cs1654.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Cannot modify members of 'variable' because it is a 'read-only variable type'
1414

1515
This error occurs when you try to modify members of a variable which is read-only because it is in a special construct.
1616

17-
One common area that this occurs is within [foreach](../language-reference/statements/iteration-statements.md#the-foreach-statement) loops. It is a compile-time error to modify the value of the collection elements. Therefore, you cannot make any modifications to elements that are [value types](../language-reference/builtin-types/value-types.md), including [structs](../language-reference/builtin-types/struct.md). In a collection whose elements are [reference types](../language-reference/keywords/reference-types.md), you can modify accessible members of each element, but any try to add or remove or replace complete elements will generate [Compiler Error CS1656](../language-reference/compiler-messages/cs1656.md).
17+
One common area that this occurs is within [foreach](../language-reference/statements/iteration-statements.md#the-foreach-statement) loops. It is a compile-time error to modify the value of the collection elements. Therefore, you cannot make any modifications to elements that are [value types](../language-reference/builtin-types/value-types.md), including [structs](../language-reference/builtin-types/struct.md). In a collection whose elements are [reference types](../language-reference/keywords/reference-types.md), you can modify accessible members of each element, but any try to add or remove or replace complete elements will generate [Compiler Error CS1656](../language-reference/compiler-messages/unsafe-code-errors.md#fixed-buffers).
1818

1919
## Example
2020

0 commit comments

Comments
 (0)