Skip to content

Commit c5e0427

Browse files
authored
Add articles for remaining C# 13 and C# 14 errors (dotnet#46376)
* Add target for remaining C# 13 errors Add all errors and warnings for any warnings added in C# 13. Also, add list of undocumented (as of yet) C# 14 errors. * Add C# 14 error message before extensions * consolidate existing extension articles Create a new article to include all the existing extension errors and warnings. * Add placeholders for all new extension errors Add the description and fixes for all new extension errors. * final edit pass * fix warnings.
1 parent 3c3389d commit c5e0427

21 files changed

+343
-434
lines changed

.openpublishing.redirection.csharp.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,10 @@
343343
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs0260.md",
344344
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/partial-declarations"
345345
},
346+
{
347+
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1112.md",
348+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
349+
},
346350
{
347351
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1683.md",
348352
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/assembly-references"
@@ -1818,14 +1822,50 @@
18181822
"source_path_from_root": "/docs/csharp/misc/cs1020.md",
18191823
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/overload-resolution"
18201824
},
1825+
{
1826+
"source_path_from_root": "/docs/csharp/misc/cs1100.md",
1827+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
1828+
},
1829+
{
1830+
"source_path_from_root": "/docs/csharp/misc/cs1101.md",
1831+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
1832+
},
1833+
{
1834+
"source_path_from_root": "/docs/csharp/misc/cs1102.md",
1835+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
1836+
},
1837+
{
1838+
"source_path_from_root": "/docs/csharp/misc/cs1103.md",
1839+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
1840+
},
18211841
{
18221842
"source_path_from_root": "/docs/csharp/misc/cs1104.md",
18231843
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/params-arrays"
18241844
},
1845+
{
1846+
"source_path_from_root": "/docs/csharp/misc/cs1105.md",
1847+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
1848+
},
1849+
{
1850+
"source_path_from_root": "/docs/csharp/misc/cs1106.md",
1851+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
1852+
},
18251853
{
18261854
"source_path_from_root": "/docs/csharp/misc/cs1007.md",
18271855
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/overload-resolution"
18281856
},
1857+
{
1858+
"source_path_from_root": "/docs/csharp/misc/cs1109.md",
1859+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
1860+
},
1861+
{
1862+
"source_path_from_root": "/docs/csharp/misc/cs1110.md",
1863+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
1864+
},
1865+
{
1866+
"source_path_from_root": "/docs/csharp/misc/cs1113.md",
1867+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
1868+
},
18291869
{
18301870
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1502.md",
18311871
"redirect_url": "/dotnet/csharp/misc/cs1503"

docs/csharp/language-reference/compiler-messages/assembly-references.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ f1_keywords:
2020
- "CS7079"
2121
- "CS8090"
2222
- "CS8203"
23+
- "CS9286"
2324
helpviewer_keywords:
2425
- "CS0012"
2526
- "CS0234"
@@ -39,7 +40,8 @@ helpviewer_keywords:
3940
- "CS7079"
4041
- "CS8090"
4142
- "CS8203"
42-
ms.date: 02/28/2024
43+
- "CS9286"
44+
ms.date: 05/27/2025
4345
---
4446
# Resolve errors and warnings related to assembly references
4547

@@ -64,6 +66,7 @@ That's by design. The text closely matches the text of the compiler error / warn
6466
- [**CS7079**](#invalid-assembly-reference): *The type is defined in a module that has not been added. You must add the module.*
6567
- [**CS8090**](#invalid-assembly-reference): *There is an error in a referenced assembly.*
6668
- [**CS8203**](#invalid-assembly-reference): *Invalid assembly name.*
69+
- [**CS9286**](#missing-references): *Type does not contain a definition and no accessible extension member for receiver type could be found (are you missing a using directive or an assembly reference?)*
6770

6871
In addition, the following warnings are covered in this article:
6972

@@ -76,13 +79,15 @@ The following errors and warnings indicate that you're missing an assembly refer
7679
- **CS0012**: *The type 'type' is defined in an assembly that is not referenced. You must add a reference to assembly 'assembly'.*
7780
- **CS0234**: *The type or namespace name does not exist in the namespace (are you missing an assembly reference?)*
7881
- **CS0246**: *The type or namespace name could not be found (are you missing a using directive or an assembly reference?)*
82+
- **CS9286**: *Type does not contain a definition and no accessible extension member for receiver type could be found (are you missing a using directive or an assembly reference?)*
7983

8084
These compiler errors indicate one of these problems in your code:
8185

8286
- The project doesn't reference the required assembly. To fix this error, [add a reference to the required assembly](../../../standard/assembly/index.md#add-a-reference-to-an-assembly).
8387
- You misspelled the name of a type. Check the name of the type.
8488
- You used a variable name where the name of a <xref:System.Type?displayProperty=nameWithType> was expected, such as in the [`typeof` operator](../operators/type-testing-and-cast.md#the-typeof-operator) or the [`is` operator](../operators/type-testing-and-cast.md#the-is-operator).
8589
- You used the [global scope operator, (`::`)](../operators/namespace-alias-qualifier.md) when the type isn't in the global namespace.
90+
- You're accessing an extension member and either the namespace isn't specified in a `using` directive, or you're not referencing the assembly that contains the extension.
8691

8792
## Type forwarding
8893

docs/csharp/language-reference/compiler-messages/cs1112.md

Lines changed: 0 additions & 36 deletions
This file was deleted.

docs/csharp/language-reference/compiler-messages/expression-tree-restrictions.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ f1_keywords:
4747
- "CS9170"
4848
- "CS9175"
4949
- "CS9226"
50+
- "CS9296"
51+
- "CS9307"
5052
helpviewer_keywords:
5153
- "CS0765"
5254
- "CS0831"
@@ -94,7 +96,9 @@ helpviewer_keywords:
9496
- "CS9170"
9597
- "CS9175"
9698
- "CS9226"
97-
ms.date: 09/06/2023
99+
- "CS9296"
100+
- "CS9307"
101+
ms.date: 05/27/2025
98102
---
99103
# Resolve errors and warnings generated from expressions prohibited in expression trees
100104

@@ -149,6 +153,8 @@ That's by design. The text closely matches the text of the compiler error / warn
149153
- **CS9170** - *An expression tree may not contain an inline array access or conversion.*
150154
- **CS9175** - *An expression tree may not contain a collection expression.*
151155
- **CS9226** - *An expression tree may not contain an expanded form of non-array params collection parameter.*
156+
- **CS9296** - *An expression tree may not contain an extension property access*.
157+
- **CS9307** - *An expression tree may not contain a named argument specification out of position*.
152158

153159
## Expression tree restrictions
154160

@@ -184,6 +190,7 @@ The following expressions are prohibited:
184190

185191
Other restrictions are:
186192

193+
- Extension properties can't be accessed as extensions.
187194
- Attributes can't be applied to the lambda expression, its parameters or return.
188195
- The lambda expression must be convertible to a type derived from <xref:System.Linq.Expressions.Expression?displayProperty=fullName> whose type parameter is a delegate type.
189196
- [named and optional parameters](../../programming-guide/classes-and-structs/named-and-optional-arguments.md) are restricted. The expression can't call a method specifying named arguments, and it can't use the default value of an optional parameter.

0 commit comments

Comments
 (0)