You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/csharp/language-reference/compiler-messages/unsafe-code-errors.md
+28-30Lines changed: 28 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,36 +68,34 @@ This article covers the following compiler errors:
68
68
<!-- The text in this list generates issues for Acrolinx, because they don't use contractions.
69
69
That's by design. The text closely matches the text of the compiler error / warning for SEO purposes.
70
70
-->
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.*
Copy file name to clipboardExpand all lines: docs/csharp/misc/cs1654.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ Cannot modify members of 'variable' because it is a 'read-only variable type'
14
14
15
15
This error occurs when you try to modify members of a variable which is read-only because it is in a special construct.
16
16
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).
0 commit comments